gTeam[playerid] or PVarInt("Team")??
#1

gTeam[playerid] or PVarInt("Team")??

1. Are they interchangeable?
2. If so, would PVarInt be the better route?
Reply
#2

They are and I strongly suggest you go for PVars
Reply
#3

Does SetPVarInt(playerid, "login_spawn", 1) == SetPVarInt(playerid, "LoGiN_SpAwN", 1) ?

Does case matter?
Reply
#4

There you go:

Quote:

- PVar names use exact names instead of partial matching, they're case-insensitive still ("id" is the same as "ID").

Reply
#5

Quote:
Originally Posted by cAMo
gTeam[playerid] or PVarInt("Team")??

1. Are they interchangeable?
2. If so, would PVarInt be the better route?
It all depends on what you like more. Personally i think pvars are for players who cant script that well and declare MAX_PLAYERS arrays left and right. The only thing pvars have going for them is that they can be used in other scripts where they were not declared.

The same can be done with regular variables by using CallRemoteFunction (there is a speed difference tho, callremotefunction is a bit slower) but in the end its not slow enough/a big enough difference for me to convert all my scripts over.

Just my personal view :P.
Reply
#6

I strongly recommend not to listen to the text above.

No offense, but if you don't know anything about PVars, nor array cells, don't give wrong advices to others.
Reply
#7

Quote:
Originally Posted by juice.j
I strongly recommend not to listen to the text above.

No offense, but if you don't know anything about PVars, nor array cells, don't give wrong advices to others.
I know about array cells. If you use an enum and a multidimensional array for storing player information regular variables are not that bad at all. If i remember correctly pvars were made for people who were declaring MAX_PLAYERS arrays left and right to store small things.


Also, there is no wrong or right in this area, its all opinion based. So cut your superior tone.





Reply
#8

I don't mean to offend you so chill out.

There is definitely wrong and right, a statement like "i think pvars are for players who cant script" is simply wrong as well as "The only thing pvars have going for them is that they can be used in other scripts where they were not declared."

This definitely shows you haven't spent enough time reading information about PVars, nontheless you give advices and potentially encourage others to follow that wrong imagination.

If you have a 20k lines script based on arrays and you don't want to convert them to PVars it is totally fine. It's a bit of work and not necessary if your server runs just well.

However if you start from scratch it'd be a step backwards to use arrays, hence if someone asks which one offers more advantages the answer simply is PVars.
Reply
#9

I am assuming that these two are interchangeable... maybe I am wrong?

Which is ideal:

SetPVarInt(playerid, "Jail_Time", 0); -or- DeletePVar(playerid, "Jail_Time");
Reply
#10

If a variable is not declared and you try to get its value it will return 0.

Instead of setting a PVar Integer to zero you can just delete it, as you said. It's perfectly fine and also frees the dynamically allocated memory.
Reply


Forum Jump:


Users browsing this thread: