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



Few questions - dawidek11 - 30.10.2011

Hi,

Lets say that I have deleted Something PVar of thatplayer.
Now I am going to use GetPVarInt(thatplayer, "Something")
What will it return?


------------------------------------------------

And how do I check if thatplayer doesn't have PVar called Something?
Can I use if(GetPVarInt(thatplayer, "Something") == IsValidPlayerID(playerid))
Because this PVar would only store ID's.


If I would have 200 slots then this would work right? :
stock IsValidPlayerID(playerid)
{
if(playerid < 199 && playerid >= 0) return true; return false;
}


Re: Few questions - jonrb - 30.10.2011

If a PVar doesn't exist it returns 0, which is a possible ID.
I would advise that you simply add 1 to your pVar when storing it(So the range would be 1->500 instead of 0->499) and removing it again when you use GetPVarInt


Re: Few questions - dawidek11 - 30.10.2011

Quote:
Originally Posted by jonrb
Посмотреть сообщение
If a PVar doesn't exist it returns 0, which is a possible ID.
I would advise that you simply add 1 to your pVar when storing it(So the range would be 1->500 instead of 0->499) and removing it again when you use GetPVarInt
Thank, so there is other way to check if PVar exists?
I think that instead of deleting it I would SetPVarString(playerid,"Something",STRING); and then check for it and if it exists then return 0.

Oh, btw. is there any option to make a player not to drown. Something with lung capacity?

Thanks.


Re: Few questions - wups - 30.10.2011

Quote:
Originally Posted by dawidek11
Посмотреть сообщение
Thank, so there is other way to check if PVar exists?
I think that instead of deleting it I would SetPVarString(playerid,"Something",STRING); and then check for it and if it exists then return 0.

Oh, btw. is there any option to make a player not to drown. Something with lung capacity?

Thanks.
https://sampwiki.blast.hk/wiki/GetPVarType


Re: Few questions - dawidek11 - 30.10.2011

Quote:
Originally Posted by wups
Посмотреть сообщение
Thanks!

What about drowning?