GivePlayerScore
#1

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.
Reply
#2

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

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

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 */
Reply
#5

or using a macro:

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

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

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

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.
Reply
#8

thanks all repped who i could.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)