SetPVar - 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: SetPVar (
/showthread.php?tid=618676)
SetPVar -
NeXoR - 08.10.2016
Hey guys, what should be actually more efficient
PHP код:
new x[MAX_PLAYERS];
x[playerid] = 1;
//
SetPVarInt(playerid, "x", 1);
Re: SetPVar -
CannonBolt - 08.10.2016
Well Option A,as i was told Pvars or slower than arrays.
Re: SetPVar -
Freaksken - 08.10.2016
(Dis)advantages listed
here.
EDIT:
Depends on the situation. If you have an array of MAX_PLAYERS of which you know only a select few elements will be used not very frequently, a PVar is a better choice I think. Otherwise the other elements are just wasted space. On the other hand, if many elements of the array will be used frequently, a normal array would be better. A PVar will still be slower than a normal variable though.
Re: SetPVar -
SickAttack - 08.10.2016
Only use a PVar when you want to use that same variable within the gamemode and other filterscripts at the same time.
Re: SetPVar -
Kaliber - 08.10.2016
Quote:
Originally Posted by SickAttack
Only use a PVar when you want to use that same variable within the gamemode and other filterscripts at the same time.
|
Nah thats not true..
It is good to use..for example in Dialogs..to save a specific player value..cause the performance in this situation doesn't matters..and it get deleted..when the dialog was reached...
So you have 0 space waste...for things like temporary availability this is very usefull