Server and Client

I was making a derma menu, when I realized I needed some serversided functions to get stuff from not running clientsided, is it possible? Someone suggested using if SERVER then but that didn’t work at all.

You can set up server sided concommands and much more, then make your derma menu run them

Example:

init.lua
[lua]
concommand.Add(“Give_Crowbar”, function()
for k, v in pairs(player.GetAll()) do
if v:IsAdmin() && v:IsValid() then
v:Give(“weapon_crowbar”)
end
end
end)

concommand.Add(“Strip”, function()
for k, v in pairs(player.GetAll()) do
if v:IsAdmin() && v:IsValid() then
v:StripWeapons()
end
end
end)[/lua]

cl_init.lua
[lua]
DButton.DoClick = function()
RunConsoleCommand(“Strip”)
RunConsoleCommand(“Give_Crowbar”)
end
[/lua]

[editline]10th November 2010[/editline]

Refer to this tutorial for help with concommands

[editline]10th November 2010[/editline]

Updated code with working code.

That won’t work so read more tutorials, Don’t listen to c-unit he only knows a week of lua coding.

^ ye

He’s right with the concept though, make concommands serverside and call them in the derma.

Updated code with working code =]

Yeah i know maybe i should stop being an ass from now on, Meh im bored of it, getting old. :wink:

Wiki. Use it.