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



SetpVarInt-GetPvarInt - vassilis - 22.12.2011

Days/weeks/hours/seconds etc have passed however i can't understand what SetPVarInt-GetPVarInt are doing
Please do not start flame me into this topic i just want someone to explain me :S thx


Re: SetpVarInt-GetPvarInt - HB - 22.12.2011

PVar Example:
pawn Код:
SetPVarInt(playerid,"Test",1);
print(GetPVarInt(playerid,"Test"));
// This will print 1
Array example:
pawn Код:
new gTest[MAX_PLAYERS];
gTest[playerid]=1;
print(gTest[playerid]);
// Will print 1
These two pieces of code do exactly the same thing. PVars are Player Variables, and they can be used as a replacement for the array above.


Re: SetpVarInt-GetPvarInt - vassilis - 22.12.2011

hmm so SetPVarInt(playerid,"Test"1); = gTestplayerid = 1;?
and
GetPvarInt(playerid,"Test"); = if(gTest == 0 or 1) ?


Re: SetpVarInt-GetPvarInt - Ash. - 22.12.2011

Quote:
Originally Posted by vassilis
Посмотреть сообщение
hmm so SetPVarInt(playerid,"Test"1); = gTestplayerid = 1;?
and
GetPvarInt(playerid,"Test"); = if(gTest == 0 or 1) ?
GetPVar* just returns what you put in the name you're requesting.

If I put 10 in the PVar Called "MyNumber", and then did:
pawn Код:
GetPVarInt(playerid, "MyNumber");
it would return 10.