• attempt to index global 'umsg' (a nil value)
    7 replies, posted
This code: [lua] timer.Create("BuildTimer", 1, 0, function() UpdateClientBuildTime( ) end) [/lua] [lua] function UpdateClientBuildTime() if Stage == 0 then if BuildTimeLeft > 0 then BuildTimeLeft = BuildTimeLeft - 1 UpdateClientTime(BuildTimeLeft) else Stage = 1 end end end function UpdateClientTime(timeleft) umsg.Start( "UpdateTime" ) umsg.Short( timeleft ) umsg.End() end [/lua] Gives me this error: Timer Error: [gamemodes\zombiedefense\gamemode\init.lua:65] attempt to index global 'umsg' (a nil value) Timer Error: [gamemodes\zombiedefense\gamemode\init.lua:65] attempt to index global 'umsg' (a nil value) Timer Error: [gamemodes\zombiedefense\gamemode\init.lua:65] attempt to index global 'umsg' (a nil value) Timer Error: [gamemodes\zombiedefense\gamemode\init.lua:65] attempt to index global 'umsg' (a nil value) Timer Error: [gamemodes\zombiedefense\gamemode\init.lua:65] attempt to index global 'umsg' (a nil value) Timer Error: [gamemodes\zombiedefense\gamemode\init.lua:65] attempt to index global 'umsg' (a nil value) Timer Error: [gamemodes\zombiedefense\gamemode\init.lua:65] attempt to index global 'umsg' (a nil value) Could anybody tell me why? Thanks in advance.
-snip i'm wrong-
Anywhere else you calling umsg ? Editing it in any way? And what's the clientside function to recieve?
[QUOTE=Freze;34877427]Anywhere else you calling umsg ? Editing it in any way? And what's the clientside function to recieve?[/QUOTE] Yes I'm using it in a few other places in the same exact method. Clientside: [lua] usermessage.Hook("UpdateTime", function(msg) BuildTimeLeftC = msg:ReadShort() end) [/lua]
Any addons?
I've already talked him through it, he was including init.lua in cl_init.lua :tinfoil:
Explains a lot. Alright then.
Just a tip, you can avoid these things by prefixing your files, (except init.lua), with either sv_ sh_ or cl_. That way you will always know on which side to run the files. (like you normally do with cl_init and sh_init)
Sorry, you need to Log In to post a reply to this thread.