ItsMods

Full Version: [Solved] Prevent something from resetting next S&D round
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So let's say I want to do
self.stuff = 1;
on player connect, but when a round switches in Search & Destroy, it will run onPlayerConnect, init, and whatever again.

How do I prevent it from running a variable every round and only the first, without causing an 'uninitialized variable' error?
self.pers["persistent_var"] = "herpderp";
Thank you kindly. And I suppose
Code:
if(!game["roundsplayed"])
self.pers["LVL"] = 1;
(09-06-2011, 19:13)AZUMIKKEL Wrote: [ -> ]Thank you kindly. And I suppose
Code:
if(!game["roundsplayed"])
self.pers["LVL"] = 1;

are you checking for an undefined variable or if it is just false?
BTW: to prevent auto-set back to 1

Code:
if(!game["roundsplayed"] && !isDefined(self.pers["LVL"]))
self.pers["LVL"] = 1;
(09-06-2011, 20:20)Nukem Wrote: [ -> ]
(09-06-2011, 19:13)AZUMIKKEL Wrote: [ -> ]Thank you kindly. And I suppose
Code:
if(!game["roundsplayed"])
self.pers["LVL"] = 1;

are you checking for an undefined variable or if it is just false?
BTW: to prevent auto-set back to 1

Code:
if(!game["roundsplayed"] && !isDefined(self.pers["LVL"]))
self.pers["LVL"] = 1;

I already told him : - )