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



GetPVarInt - jaskiller - 14.01.2012

hi when Im not sure te pvar existe like that :

PHP код:
if(:::)
{
SetPVarInt()::::
}
// 
GetPVarInt Going to return what if not exist // 0??


Re: GetPVarInt - Scenario - 14.01.2012

I'm not exactly sure and it isn't listed on the Wiki. You could do something like this though:

pawn Код:
if(!GetPVarType(playerid, "varname")) // checking if "varname" doesn't exist
{
    SetPVarInt(playerid, "varname", value); // it doesn't, let's set the PVar
}
else // ... but if it does
{
    new iValue = GetPVarInt(playerid, "varname"); // obtain the value of the PVar and store it into a variable
}



Re : GetPVarInt - jaskiller - 14.01.2012

ok thx;