How to give weapon dependant on what they choose

I’ve successfully made working classes for my gamemode, but now I am going to implement weapon selection for each class, but seeing as the Give() command is serverside only and Derma Panels are clientside only how would I go about making it so they spawn with the weapon they chose.

Console command the weapons they pick on the derma and then use a console command hook to give them the one they pick?

Yeah I was thinking about using usermessages, but i didn’t think they would be appropriate for this

You can’t use usermessages to send data to the server.

have the derma trigger a concommmand maybe?

Yea, console commands are the only way to do it (datastream uses them).

For a aminute i thought creating concommands were serverside only >.> rate me dumbs for my stupidity

That was… actually pretty stupid, lol :smug:

I know. Very forgetful indeed :frowning:

[editline]04:52PM[/editline]

Also, how would i structure it so the concommand does not make the player spawn with every weapon in the list.

There will be multiple weapons to choose from, Primary, Secondary and Grenades

Anyone?

a Derma Menu?

Send different arguments depending on which button they press.

Thankyou ralle.

May as well get another question in here instead of making a new thread, but;

If i create a table of SteamIDs of different people, do I use table.ToString to check if their steamid is in the table, and then do a function after that and then hook it to playerspawn?

Example of how you could check:

[lua]
local SteamIDS = {
“Steam ID1”,
“Steam ID2”,
“Steam ID3”
}

local function CheckSID(ply, sid)
if (!table.HasValue(SteamIDS, sid)) then
ply:Kick(“Your steamID is not in the table!”)
end
end
hook.Add(“PlayerAuthed”, “CheckSID”, CheckSID)
[/lua]

Ah thankyou