SA-MP Forums Archive
SetPVarInt question - 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 question (/showthread.php?tid=302938)



SetPVarInt question - Celson - 11.12.2011

Am I better of using these PVar functions or should I be using arrays?

In the case of keeping track of a players cash. Which should I do?

pawn Код:
SetPVarInt(playerid,"pCash",100);
Or

pawn Код:
new pCash[MAX_PLAYERS];

// In a callback...
pCash[playerid] = 100;
What are the advantages and disadvantages of each? Which is faster?

I'll Rep+ anyone who can give me some useful information.


Re: SetPVarInt question - suhrab_mujeeb - 11.12.2011

SetPVarInt is better but for the speed I am not sure.


Re: SetPVarInt question - PrawkC - 11.12.2011

https://sampwiki.blast.hk/wiki/Per-player_variable_system


Re: SetPVarInt question - Celson - 11.12.2011

Ahh thank you. Sounds like it's much for effective than using arrays. Rep+


Re: SetPVarInt question - THE_KNOWN - 11.12.2011

https://sampforum.blast.hk/showthread.php?tid=255512

EDIT: better https://sampforum.blast.hk/showthread.php?tid=161454

EDIT2: Arrays are better not pvars


Re: SetPVarInt question - Ash. - 11.12.2011

The only outstanding advantage for using PVars over Arrays is that you can share per-player-data across multiple scripts.


Re: SetPVarInt question - MadeMan - 11.12.2011

Arrays are faster, but PVars are shared between gamemode and filterscripts.