Which ? (gVar and pVar)
#1

Which should I use for small things

+ Global Var:
Код:
new fcontrol[MAX_PLAYERS];

stock fblabla(playerid){
if(ftest == 0){
fcontrol[playerid] = 1;
}else{
fcontrol[playerid] = 0;
}
+ Player Var:
Код:
stock sblabla(playerid){
if(stest == 1){
SetPVarInt(playerid, "scontrol", 1);
}else{
SetPVarInt(playerid, "scontrol", 0);
}
Reply
#2

For smaller things I suggest using pVar - it also use less memory, but are slower than gVar.
Reply
#3

PVars are slower than normal variables...
Reply
#4

Use normal variables.
Reply
#5

What's the point here in making a choice between PVar or variables ?

You only use PVars when you want to access the value of that specific variable in other scripts.
(e.g. My admin level is 5, so i need to check if i am admin as well in a seperate filterscript, so i'll make use of PVars).
Reply
#6

Quote:
Originally Posted by Gammix
Посмотреть сообщение
What's the point here in making a choice between PVar or variables ?

You only use PVars when you want to access the value of that specific variable in other scripts.
(e.g. My admin level is 5, so i need to check if i am admin as well in a seperate filterscript, so i'll make use of PVars).
Example :
Код:
if(GetPVarInt(playerid,"spawncmd") == 1) return SendClientMessage(playerid,-1,"You did not spawn");
OR
Код:
if(spawncmd[playerid] == 1) return SendClientMessage(playerid,-1,"You did not spawn");
Which makes sense here
Reply
#7

https://sampforum.blast.hk/showthread.php?tid=571043
Reply
#8

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I was looking for it somewhere about, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)