SA-MP Forums Archive
SetPVarInt - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetPVarInt (/showthread.php?tid=208818)



SetPVarInt - GiS - 09.01.2011

Hey,

Why isn't this working?

pawn Код:
SetPVarInt(playerid, "tries", ++);
PHP код:
error 029invalid expressionassumed zero
error 022must be lvalue (non-constant



Re: SetPVarInt - MadeMan - 09.01.2011

pawn Код:
SetPVarInt(playerid, "tries", GetPVarInt(playerid, "tries") + 1);
Or you can use the function AddPVarInt

pawn Код:
AddPVarInt(playerid, "tries", 1);
Then you need this:

pawn Код:
stock AddPVarInt(playerid, varname[], int_value)
{
    SetPVarInt(playerid, varname, GetPVarInt(playerid, varname) + int_value);
}



Re: SetPVarInt - GiS - 09.01.2011

Thanks, work perfectly!