ItsMods

Full Version: Didn't show var ?!? - SOLVED
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi.
I allredy have a new problem Wink
I have some line code, but the var's didn't work...
If i want to write the Var on screen, nothing happens Sad
Here's Code [all in _rank.gsc]
Code:
-REMOVED-
Code:
-REMOVED-
Code:
-REMOVED-
Code:
-REMOVED-
[this was all, i have changed in _rank.gsc]
They should come a massage on spawn with the var: "self.gcmykills"
(it was only for me to controll, if it didnt work...)
But i start the game and nothing happens. No massage...
Why? and how can i debug this ?

*sorry for mutch code Wink hope you can help me...

EDIT: Upload Unready Mod
Attach the mod as a .rar file
Done with upload.

Please help...
In the init() function in _rank, 'self' doesn't refer to a player because the function isn't called on a player. So when you write "self.gcmykills = 0;", it doesn't assign the variable to a player and that's why you can't print it out later, because it's undefined.

Try defining the player variables when they connect:

PHP Code:
level waittill"connected"player );
player.gcmykills 0;
player thread onPlayerSpawned();
... 
(11-04-2011, 22:41)Phl3x_ Wrote: [ -> ]In the init() function in _rank, 'self' doesn't refer to a player because the function isn't called on a player. So when you write "self.gcmykills = 0;", it doesn't assign the variable to a player and that's why you can't print it out later, because it's undefined.

Try defining the player variables when they connect:

PHP Code:
level waittill"connected"player );
player.gcmykills 0;
player thread onPlayerSpawned();
... 

Funny so far, I've always defined my variable in init().
and there never was a problem with it...

I will test it.

EDIT: I didn't want the var for one player, i want it for ALL players...
the self-vars are still not working...


Now, all works.
-> remove Upload
Just writing 'self.var = 0;' anywhere doesn't assign the variable to every player. I think you're a bit confused. As I said in another thread of yours: inside a function, the variable 'self' just refers to the entity that the function was called on.
I've use your way with put it into connect...
and it works