• Beta garrysmod Sets NW Ints differently than normal gmod?
    14 replies, posted
Well, I currently have a fretta server that I am trying to add a level/exp system to. I have the VGUI done, and I tested it on my single player and gave myself exp with this code lua_run for k, v in pairs( player.GetAll() ) do v:SetNWInt("Exp", 5) end It worked, for my exp bar went up. I tried the same code on my dedicated server, that used beta gmod, and it gave me this error: :1: bad argument #1 to 'SetNWInt' (string expected, got nil) Please tell me the correct syntax I should use to fix this problem. Thanks
Are you trying to SetNWInt via console on the client? From what I know, you can only do it server-side.
I'm using RCON, but yes. I forgot to mention, I tried doing it through a gamemode (Lock N' Load) to where at the end of the round it gave you 2 exp and it constipated the gamemode and we had to wait like 20 seconds for a new round.
I'm not entirely sure, because I've never played with the beta gmod. (Didn't know there was one) but the only thing I can suggest, is running it in a server-side script to see what's wrong, and then try changing the gamemode to see if it's that. Sorry that I can't be much help.
Well maybe someone else can explain my dillema, thanks for your help though :)
lua_run doesn't work properly when ran in-game through rcon lua_run unless it's singleplayer don't ask me why but yea, either put a lua file in auto-run or use hlsw
[QUOTE=Averice;16955206]lua_run doesn't work properly when ran in-game through rcon lua_run unless it's singleplayer don't ask me why but yea, either put a lua file in auto-run or use hlsw[/QUOTE] Hlsw = in-game rcon .
lua_run "for k, v in pairs( player.GetAll() ) do v:SetNWInt('Exp', 5) end" [editline]08:46AM[/editline] never use "s or ;s in your code when doing a lua_run via rcon, and always wrap it in "s.
[QUOTE=Lexic;16957024]lua_run "for k, v in pairs( player.GetAll() ) do v:SetNWInt('Exp', 5) end" [editline]08:46AM[/editline] never use "s or ;s in your code when doing a lua_run via rcon, and always wrap it in "s.[/QUOTE] HLSW will format it right (you can use "), valve's console not.
[QUOTE=The-Stone;16957521]HLSW will format it right (you can use "), valve's console not.[/QUOTE] That must be why in-game rcon fucks up for me instead of hlsw :P
[code] ] rcon lua_run "player.GetAll( )[1]:Kill( )" > "player.GetAll( )[1]:Kill( )"... :1: unexpected symbol near '"player.GetAll( )[1]:Kill( )"'[/code] :/
[QUOTE=Overv;16958673][code] ] rcon lua_run "player.GetAll( )[1]:Kill( )" > "player.GetAll( )[1]:Kill( )"... :1: unexpected symbol near '"player.GetAll( )[1]:Kill( )"'[/code] :/[/QUOTE] [code] ] rcon lua_run player.GetAll( )[1]:Kill( ) ] rcon lua_run player.GetAll()[1]:Execute('say lol') -- not Execute("say lol") [/code] :science:
[QUOTE=Overv;16958673][code] ] rcon lua_run "player.GetAll( )[1]:Kill( )" > "player.GetAll( )[1]:Kill( )"... :1: unexpected symbol near '"player.GetAll( )[1]:Kill( )"'[/code] :/[/QUOTE] try rcon "lua_run player.GetAll( )[1]:Kill( )", which is what I meant.
Ok, I will try what Lexic said, I'll edit this post to show the results. Ok, it didn't work. Here's what it says now: rcon lua_run "for k, v in pairs( player.GetAll() ) do v:SetNWInt('Exp', 50) end" <- The exact command I entered This is the error I got: :1: unexpected symbol near '"for k, v in pairs( player.GetAll() ) do v:SetNWInt('Exp', 50) end"' Any ideas now? Nevermind, I didn't put the quotes in front of lua_run... it works now :D THANK YOU.
[QUOTE=Lexic;16959009]try rcon "lua_run player.GetAll( )[1]:Kill( )", which is what I meant.[/QUOTE] As expected, [code]rcon "lua_run player.GetAll( )[1]:Kill( )" Unknown command "lua_run player.GetAll( )[1]:Kill( )"[/code] [b]Edit: [/b]cheiftiger, what's your final command which works? [b]Edit 2: [/b]Nevermind, this works: [code]rcon lua_run player.GetAll( )[1]:Kill( )[/code]
Sorry, you need to Log In to post a reply to this thread.