OnPlayerText Help +REP
#1

Hello

This is /SetVip Command

PHP Code:
CMD:setvip(playeridparams[])
{
    
GetPlayerName(playerid,NamMAX_PLAYER_NAME);//define the playerid name
    
GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
    
if(levels == 0)
    {
        
format(strsizeof(str),"%s Changed Your rank %d  !",Nam,levels);
        
SendClientMessage(ID,0xFF9900AA,str);
        
format(strsizeof(str)," you changed %s Rank to %d  !",pname,levels);
        
SendClientMessage(playerid,0xFF9900AA,str);
        
PlayerInfo[ID][pVip] = levels;//this sets the player level
        
new INI:File INI_Open(UserPath(playerid));
        
INI_SetTag(File"Player's Data");
            
INI_WriteInt(File"ViP Level"PlayerInfo[playerid][pVip]);
        
INI_Close(File);
        return 
1;
    }
    
format(strsizeof(str),"{FF0000}%s {ffffff}Changed {ffffff}your {ffffff}rank to {0066CC} %d !.",Nam,levels);
    
SendClientMessage(ID,0xFF9900AA,str);
    
format(strsizeof(str),"{FF0000}you {FF0000}changed {15FF00}%s {FF0000}rank {FF0000}to {0066CC}%d!",pname,levels);
    
SendClientMessage(playerid,0xFF9900AA,str);
    
PlayerInfo[ID][pVip] = levels;
    new 
INI:File INI_Open(UserPath(playerid));
       
INI_SetTag(File"Player's Data");
    
INI_WriteInt(File"ViP Level"PlayerInfo[playerid][pVip]);
    
INI_Close(File);
    return 
1;

& This is OnPlayerText

PHP Code:
public OnPlayerText(playeridtext[])
{
    if(
PlayerInfo[playerid][pAdmin] == 1)
    {
        new 
pName[MAX_PLAYER_NAME], String[128], Prefix[] = "{FF2400}[King] ";
        
GetPlayerName(playeridpName24);
        
format(Stringsizeof(String), "%s%s%s{FFFFFF}[%d]: {FFFFFF}%s {FFFFFF}%s"PrefixTeamColor[gTeam[playerid]], pNameplayeridtext);
        
SendClientMessageToAll(-1,String);
        return 
0;
    }
    if(
PlayerInfo[playerid][pVip] == 1)
    {
        new 
pName[MAX_PLAYER_NAME], String[128], Prefix[] = "{FF2400}[VIP+] ";
        
GetPlayerName(playeridpName24);
        
format(Stringsizeof(String), "%s%s%s{FFFFFF}[%d]: {FFFFFF}%s {FFFFFF}%s"PrefixTeamColor[gTeam[playerid]], pNameplayeridtext);
        
SendClientMessageToAll(-1,String);
        return 
0;
    }
    
HideClassTextdraw(playerid);
    return 
1;


& These are Enums

PHP Code:
enum pInfo
{
    
pAdmin// will save player's Admin !
    
pVip// will save player's Vip !
    
Level,

PHP Code:
new PlayerInfo[MAX_PLAYERS][pInfo]; // Player Info
new text2[MAX_TEAMS][9];
new 
levels,vlevels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID,amount;
new 
PlayerText:capturePlayerTextDraw[MAX_PLAYERS]; 

When i Enter SAMP and i make myself VIP
& when i chat in game VIP Tag Doesen't Show

anyone Could Help ?
Reply
#2

Code:
public OnPlayerText(playerid, text[]) 
{ 
    if(PlayerInfo[playerid][pAdmin] == 1) 
    { 
        new pName[MAX_PLAYER_NAME], String[128], Prefix[] = "{FF2400}[King] "; 
        GetPlayerName(playerid, pName, 24); 
        format(String, sizeof(String), "%s%s%s{FFFFFF}[%d]: {FFFFFF}%s {FFFFFF}%s", Prefix, TeamColor[gTeam[playerid]], pName, playerid, text); 
        SendClientMessageToAll(-1,String); 
        return 1; 
    } 
    if(PlayerInfo[playerid][pVip] > 0) 
    { 
        new pName[MAX_PLAYER_NAME], String[128], Prefix[] = "{FF2400}[VIP+] "; 
        GetPlayerName(playerid, pName, 24); 
        format(String, sizeof(String), "%s%s%s{FFFFFF}[%d]: {FFFFFF}%s {FFFFFF}%s", Prefix, TeamColor[gTeam[playerid]], pName, playerid, text); 
        SendClientMessageToAll(-1,String); 
        return 1; 
    } 

    HideClassTextdraw(playerid); 
    return 0; 
}
Reply
#3

doesen't work :/
Reply
#4

How ID is defined? I don't see it anywhere, use sscanf with a temporary variable. Or if you want to test, make just your pInfo[playerid][VIP] = 1; Then retry.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)