SetpVarInt-GetPvarInt
#1

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)