Thread: Bug sistema vip
View Single Post
Old 18/05/2020, 07:04 PM   #4
XStormiest
Gangsta
 
Join Date: Jun 2012
Location: Continent: Europe, Country: Romania, City: Buzau
Posts: 558
Reputation: 46
Default Re: Bug sistema vip

The maximum characters that OnPlayerText allows are 256.

ID cannot be more than 1000 which means 4 characters at max.
Your text length is about 49 characters.


I'm assuming you want to create so that when a player speaks as a VIP, a message is send that notes he's a vip.
the below code is an example of how to create a chat for VIPs.
So you need to do something like this:
Code:
public OnPlayerText(playerid, text[])
{
     if(Vip[playerid] > 0) 
     {
           if(strcmp(text[0], "#", false) == 0) // the sign to use to text, example # I'm a V.I.P
           {
               new message[307];
               new name[24];
               GetPlayerName(playerid, name, sizeof(name));
               format(message, sizeof(message), "{FFFFFF}[%d] [{FF0000}VIP{FFFFFF}] {0080FF}%s", playerid,  text[1]);
               for(new player = 0; player < MAX_PLAYERS; player++)
              {
                   if(IsPlayerConnected(player) && Vip[player] == 1) SendClientMessage(player, color, message); 
              }
              return 0;
           }
     }
     return 1;
}
If however, you want so that all players are able to see his message, you need to do something like this

Code:
public OnPlayerText(playerid, text[])
{
     if(Vip[playerid] > 0) 
     {
           new message[307];
           new name[24];
           GetPlayerName(playerid, name, sizeof(name));
           format(message, sizeof(message), "{FFFFFF}[%d] [{FF0000}VIP{FFFFFF}] {0080FF}%s", playerid,  text[1]);
           SendClientMessageToAll(color, message);
           return 0;
     }
     return 1;
}
__________________
XStormiest is offline   Reply With Quote