Checking if PVar is set
#1

Hello, i need a way to check if a player-variable (PVar) has been set. Because if you GetPVarInt from any variable it returns 0, which is a valid player ID.(Yes i'm storing them).




So is there a way to check if it's set?


This is irrelevant to the problem:
You may want to give me a link to the thread "PVars - when, and when not, to use them", i will explain why i am using them: I use them for selling a house, to store stuff like who is selling, what house is sold and the price. In my opinion(which may be wrong,i'm only human) houses won't be sold often in the server. So having global array of 500 slots is pretty useless. I assume that PVars use memory only when they are set(although more then a normal variable), and when are deleted they memory is up for grasp again.
Reply
#2

I think you could check if it's giving an output ? So it has been set ? And maybe i'm wrong..
Reply
#3

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
I think you could check if it's giving an output ? So it has been set ? And maybe i'm wrong..
This was my first try. It outputs "0" even if the pvar was NEVER set.
Reply
#4

Umm, Did you try to: Set the pvar for every player for any number, Like 1.. Then check it, So every time it gives 1 output that means he isn't selling the house or whatever you're using it for.. but I think that will be the same, The pvar will be always set and that what you don't want..
Reply
#5

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
Umm, Did you try to: Set the pvar for every player for any number, Like 1.. Then check it, So every time it gives 1 output that means he isn't selling the house or whatever you're using it for.. but I think that will be the same, The pvar will be always set and that what you don't want..
In this case, they would be always stored in memory. And they would be equal(even worse) to using normal global variables.

I'm afraid, this is not an option... Thanks for trying of course
Reply
#6

I think there is no way, if there was any I think most of the scripters would've used it, Anyway check this thread and you might find another ideas
Reply
#7

Nothing to look at, just a bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)