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



GivePlayerScore - manchestera - 27.11.2011

Im trying to make a stock to give playerscore (just to make it faster to script) but i can only setplayerscore how can i do giveplayerscore here is what i tried.

Код:
SetPlayerScore(GetPlayerScore(playerid)+=10);
Код:
C:\Users\GTA ONLY\My Samp Server\gamemodes\MySQL.pwn(363) : error 022: must be lvalue (non-constant)
C:\Users\GTA ONLY\My Samp Server\gamemodes\MySQL.pwn(363) : warning 215: expression has no effect
C:\Users\GTA ONLY\My Samp Server\gamemodes\MySQL.pwn(363) : error 001: expected token: ";", but found ")"
C:\Users\GTA ONLY\My Samp Server\gamemodes\MySQL.pwn(363) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\My Samp Server\gamemodes\MySQL.pwn(363) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: GivePlayerScore - [NoV]LaZ - 27.11.2011

pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) + 10);



Re: GivePlayerScore - Kostas' - 27.11.2011

pawn Код:
SetPlayerScore(playerid,GetPlayerScore(playerid)+10);



Re: GivePlayerScore - SmiT - 27.11.2011

If you want a "GivePlayerScore" function here is a simple stock:

pawn Код:
stock GivePlayerScore( playerid, score ) SetPlayerScore( playerid, GetPlayerScore( playerid ) + score );
An example would be:

pawn Код:
GivePlayerScore( playerid, 5 ); /* increase playerid score with 5 points */



Re: GivePlayerScore - fordawinzz - 27.11.2011

or using a macro:

pawn Код:
#define GivePlayerScore(%0, %1) SetPlayerScore(%0, GetPlayerScore(%0) + %1)



Re: GivePlayerScore - SmiT - 27.11.2011

Quote:
Originally Posted by fordawinzz
Посмотреть сообщение
or using a macro:

pawn Код:
#define GivePlayerScore(%0, %1) SetPlayerScore(%0, GetPlayerScore(%0) + %1)
It will not work.


Re: GivePlayerScore - Ash. - 27.11.2011

Quote:
Originally Posted by SmiT
Посмотреть сообщение
It will not work.
Correct, however this will:

pawn Код:
#define GivePlayerScore(%0,%1) SetPlayerScore(%0,GetPlayerScore(%0)+%1)
Anyway, I'm sure the topic starter has solved this issue now.


Re: GivePlayerScore - manchestera - 27.11.2011

thanks all repped who i could.