Player can choose weapons he spawns with while dead.

As title says. I would like some sort of menu so that the player can choose what he’ll spawn with next time he’s alive. Not all weapons should be allowed - administrators should be able to allow/disallow weapons on the fly and I would like to be able to have a permanent list in a file.

Administrators should be able to allow/disallow weapons for certain players, too, so I can have some players allowed to spawn with a rocket launcher, for example, and others may not.

If you have any questions please ask, I’d love to answer them so I can help you understand better, especially if you plan to create this script for me! :slight_smile: Thanks in advance.

This is not as easy like the respawn time scipt, anyway add me on steam so I can help you better.

Hook the menu to death.
menu has things.
saves some variable with weapons. or table or something
gives weapons at spawn

Thats not very helpfull :v:



function SpawningWeapons(ply)
timer.Simple(0.2,function() -- So we dont give weapons at the same time as other functions.
if ply.Weapon1 then
ply:Give(ply.Weapon)
end
if ply.Weapon2 then
ply:Give(ply.Weapon2)
end
if ply.Weapon3 then
ply:Give(ply.Weapon3)
end
end)
end
hook.Add("PlayerSpawn","SpawningWeaponsHoooooook",SpawningWeapons)

function SpawningWepsSets(ply,com,arg)
if arg[1] then
ply.Weapon1 = arg[1]
end
if arg[2] then
ply.Weapon2 = arg[2]
end
if arg[3] then
ply.Weapon3 = arg[3]
end
end
concommand.Add("SpawnWeapons",SpawningWepsSet)

SpawnWeapons “weapon_pistol” “weapon_357” “weapon_smg1”

Why the new account

Her"His" other one got perm-banned.

I’m going to test this out tomorrow (about 15~ hours), but, would it be possible for you to tie the weapons spawned with in with the initial gamemode loadout thing, so that with the “press e to pickup” script, this isn’t broken?

I’m guessing Zoey’s old avatar is the new ban then and the username stays blue now :downs:

Nope, Just wanted to reset my post count.

What’s wrong with tables?

[lua]
hook.Add(“PlayerSpawn”, “GiveChosenWeps”, function§
p.Weps = p.Weps or {};
for k,v in pairs(p.Weps) do
p:Give(tostring(v))
end
end)

concommand.Add(“ChooseWeps”, function(p,c,a)
local a = {a} or {};
p.Weps = p.Weps or {}
if( #p.Weps > 0 ) then
for k,v in pairs(a) do
table.insert(p.Weps, tostring(v))
end
else
p.Weps = a;
end
end)
[/lua]

Im not used to tables, Havnt used them much.

Well, about time you learned then.

-snip-

I made a script a while back that let me pick my own loadout. I’ll see about fixing it up tonight and giving it to you.

Sorry, I don’t have it anymore. I must have deleted it some time ago :frown:.