spam rank
#1

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);

Reply
#2

On which callback this code is ?
Reply
#3

what?
Reply
#4

OnPlayerUpdate
Reply
#5

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

not work
Reply
#7

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);
}
Reply
#8

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)
Reply
#9

how i check
Reply
#10

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)