SA-MP Forums Archive
Adding score - 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: Adding score (/showthread.php?tid=539828)



Adding score - GunZ75 - 30.09.2014

Hi guys i cant add score on a robbery to a player pawno crashes idk why! heres my code
SetPlayerScore(playerid, ++1);
Ive tried this too:
SetPlayerScore(playerid,GetPlayerScore ++1);

both didnt work... CAn u guys help me please?


Re: Adding score - YanLanger - 30.09.2014

SetPlayerScore(playerid, GetPlayerScore(killerid)+1);


Re : Re: Adding score - DaTa[X] - 30.09.2014

Quote:
Originally Posted by YanLanger
Посмотреть сообщение
SetPlayerScore(playerid, GetPlayerScore(killerid)+1);
killerid ?


Re: Adding score - YanLanger - 30.09.2014

ah i thought he meants something else.. my fault sorry. lol


Re: Adding score - iSkate - 30.09.2014

Try this, just correcting YL's killerid mistake.

pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
Although, I don't think PAWNO should crash because of this. It mostly happens when there are more than 26 or 29 errors, somewhere near ...


Re: Adding score - Abagail - 30.09.2014

Try this.

pawn Код:
stock GivePlayerScore(playerid, score)
{
  if(playerid == INVALID_PLAYER_ID) return -1;
   new amount = GetPlayerScore(playerid);
   SetPlayerScore(playerid, amount+score);
   return 1;
}
If the player isn't connected "-1" is returned. Otherwise, 1 will be returned. Should work fine.


Re: Adding score - FloxX - 01.10.2014

Try this
Quote:

SetPlayerScore(playerid, GetPlayerScore(playerid)+1);

This if u want got score on kill

public OnPlayerDeath(playerid, killerid)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
return;1
}

Thanks before