usermessage halp

Ok so, I tried to stop players from opening a menu in some rounds of the game because it respawns them, which I don’t want, most of the time.

What happened is the menu didnt come up ever :frowning: and I put this in console:

] lua_run_cl print(CurrentRound) <<< What I put in console
nil <<< The output

Why doesn’t it work :frowning:

errors bro errors

Oh I didn’t see the pastebin

[lua]
cl_init.lua
//THIS CONCOMMAND GETS CALLED AFTER SPAWN

local CurrentRound
usermessage.Hook( “getroundfromserver”, function( um )
CurrentRound = um:ReadChar()
end )

function zc_setteam()
if CurrentRound == 1 or CurrentRound == 2 then
//snipped the derma menu
else
LocalPlayer():PrintMessage( HUD_PRINTCENTER, “YOU CAN ONLY CHANGE TEAMS DURING THE WAITING OR SETUP ROUNDS” )
end
end // end the zc_setteam function

concommand.Add( “zc_choose”, zc_setteam ) //Now we add a hook for the function we just created.

init.lua
RND_INVALID = 0
RND_SETUP = 1
RND_FIGHT = 2
RND_FIN = 3
CurrentRound = RND_INVALID
umsg.Start( “getroundfromserver” )
umsg.Char( CurrentRound )
umsg.End()
function SetRound( rnd )
if rnd == RND_INVALID then
CurrentRound = RND_INVALID
umsg.Start( “getroundfromserver” )
umsg.Char( CurrentRound )
umsg.End()
//snipped code that happens here
elseif rnd == RND_SETUP then
CurrentRound = RND_SETUP
umsg.Start( “getroundfromserver” )
umsg.Char( CurrentRound )
umsg.End()
//snipped code that happens here
elseif rnd == RND_FIGHT then
CurrentRound = RND_FIGHT
umsg.Start( “getroundfromserver” )
umsg.Char( CurrentRound )
umsg.End()
//snipped code that happens here
elseif rnd == RND_FIN then
CurrentRound = RND_FIN
umsg.Start( “getroundfromserver” )
umsg.Char( CurrentRound )
umsg.End()
//snipped code that happens here – you were missing a slash
end
end
[/lua]

edit

Aide is a ninja + I was wrong

those comments arent there in the real file… still looking for more suggestions

I fixed it :slight_smile:

…wtf happened to automerge??? Geezus im gonna get flamed so bad for this -_-

is it possible for some moderator to delete this?

Automerge only works in the hour you post your last post.