PDA

View Full Version : OnPlayerText Help +REP


Mohaowmad
25/03/2019, 07:33 AM
Hello

This is /SetVip Command

CMD:setvip(playerid, params[])
{
GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
if(levels == 0)
{
format(str, sizeof(str),"%s Changed Your rank %d !",Nam,levels);
SendClientMessage(ID,0xFF9900AA,str);
format(str, sizeof(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(str, sizeof(str),"{FF0000}%s {ffffff}Changed {ffffff}your {ffffff}rank to {0066CC} %d !.",Nam,levels);
SendClientMessage(ID,0xFF9900AA,str);
format(str, sizeof(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

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 0;
}
if(PlayerInfo[playerid][pVip] == 1)
{
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 0;
}

HideClassTextdraw(playerid);
return 1;
}



& These are Enums

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

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 ?

xRadical3
25/03/2019, 08:01 AM
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;
}

Mohaowmad
25/03/2019, 08:12 AM
doesen't work :/

TheToretto
25/03/2019, 09:52 AM
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.