I have a command
[code]
print("Is this shared?")
concommand.Add( "p_cashin", function(ply) if ply.pokertable then ply.pokertable:PlayerCashIn(ply) end end)
[/code]
I want client to use the command and the function to be executed server side.
However it's the oposite, it appears the concommand is CS only. I don't understand why.
The command is in a shared file. "Is this shared?" gets printed on both server and client on script load.
-snip-
[QUOTE=MuffinZerg;47126783]I have a command
[code]
print("Is this shared?")
concommand.Add( "p_cashin", function(ply) if ply.pokertable then ply.pokertable:PlayerCashIn(ply) end end)
[/code]
I want client to use the command and the function to be executed server side.
However it's the oposite, it appears the concommand is CS only. I don't understand why.
The command is in a shared file. "Is this shared?" gets printed on both server and client on script load.[/QUOTE]
you can add it on only serverside and it will work from client consoles.
however it won't show up in autocomplete.
[code]if ( SERVER ) then
concommand.Add( "p_cashin", function(ply) if ply.pokertable then ply.pokertable:PlayerCashIn(ply) end end)
else
RunConsoelCommand("p_cashin")
end[/code]
[QUOTE=Robotboy655;47126844][code]if ( SERVER ) then
concommand.Add( "p_cashin", function(ply) if ply.pokertable then ply.pokertable:PlayerCashIn(ply) end end)
else
RunConsoelCommand("p_cashin")
end[/code][/QUOTE]
This will run the command instantly on script load, I dont want it
When a client runs a console command, the game checks if the client has that console command. If so, the console command is executed clientside. Otherwise, it is networked to the server and executed serverside.
You can execute serverside console commands manually using the "cmd" command, but your best bet is to just have two separate commands or send a net message from the clientside command.
[QUOTE=MeepDarknessM;47126828]you can add it on only serverside and it will work from client consoles.
however it won't show up in autocomplete.[/QUOTE]
This solved my problem, thanks!
Sorry, you need to Log In to post a reply to this thread.