SA-MP Forums Archive
spam rank - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: spam rank (/showthread.php?tid=612113)



spam rank - Loinal - 14.07.2016

Hey guys my rank system when player get 50 kills the system spam

codes:

PHP код:
new string[100+1000];
if(
pInfo[playerid][Kills] == 50)
{
rank[playerid] = 1;
TRank "XtremeX Newbie";
format(string,sizeof(string),"* %s (ID: %d) reached the rank level %d (%s)",GetName(playerid),playerid,rank,TRank);
SendClientMessageToAll(0xEBFF00FF,string);




Re: spam rank - Dayrion - 14.07.2016

On which callback this code is ?


Re: spam rank - SyS - 14.07.2016

what?


Re: spam rank - Loinal - 14.07.2016

OnPlayerUpdate


Re: spam rank - Stinged - 14.07.2016

OnPlayerUpdate gets called multiple times a second.
Use the callback that actually updates the player's kills, which is OnPlayerDeath.


Re: spam rank - Loinal - 14.07.2016

not work


Re: spam rank - TaiRinsuru - 14.07.2016

OnPlayerDeath

pawn Код:
pInfo[playerid][Kills]++;
new string[100+1000];

if(pInfo[playerid][Kills] == 50)
{
rank[playerid] = 1;
TRank = "XtremeX Newbie";
format(string,sizeof(string),"* %s (ID: %d) reached the rank level %d (%s)",GetName(playerid),playerid,rank,TRank);
SendClientMessageToAll(0xEBFF00FF,string);
}



Re: spam rank - Stinged - 14.07.2016

It should be killerid, not playerid.
OnPlayerDeath(playerid, killerid, reason);
playerid: The one that died.
killerid: The one that killed.

Make sure to check if killerid is invalid first (INVALID_PLAYER_ID or 0xFFFF/65535)


Re: spam rank - Loinal - 14.07.2016

how i check


Re: spam rank - Vince - 14.07.2016

Quote:
Originally Posted by Loinal
Посмотреть сообщение
how i check
Losing faith in humanity here ...

Quote:
Originally Posted by Stinged
Посмотреть сообщение
if killerid is [not] invalid (INVALID_PLAYER_ID)
Код:
if(killerid != INVALID_PLAYER_ID)