• Remove weapons
    7 replies, posted
I don't like how my users always spawn with rockets and crossbows etc How could I make it so they only spawn with physgun, grav, crowbar, pistol, toolgun, and smg? -cheers
Add a hook that on spawn player:StripWeapon()s them. Let me know if you need an example.
Or just override the PlayerLoadout hook.
not sure if this works but [lua] hook.Add("PlayerLoadout","GiveWeapons",function(ply) ply:Give("weapon_physgun") --Give weapons here return true end) [/lua]
[QUOTE=gamer_cad;34883437]Add a hook that on spawn player:StripWeapon()s them. Let me know if you need an example.[/QUOTE] An example would be awesome. I'm guessing I'm going to have to write a lua? Where would I put it?
Actually, GRB's method was much more efficient and sensible, as his spawns only a set weapons. Mine spawns the weapons then remove them, wasting time/valuble memory. Having proofread his code, it seems fine, here's how to implement it, without using an addon. 1. Find/create the directory garrysmod/garrysmod/lua/autorun/server 2. Create the file SetLoadout.lua 3. Copy as paste the code as above, adding in ply:Give("weaponname") for each weapon you want them to have. That should overwrite the normal hooks and give them that loadout. Enjoy :) Thanks for the better method GRB.
[QUOTE=gamer_cad;34897615]Actually, GRB's method was much more efficient and sensible, as his spawns only a set weapons. Mine spawns the weapons then remove them, wasting time/valuble memory. Having proofread his code, it seems fine, here's how to implement it, without using an addon. 1. Find/create the directory garrysmod/garrysmod/lua/autorun/server 2. Create the file SetLoadout.lua 3. Copy as paste the code as above, adding in ply:Give("weaponname") for each weapon you want them to have. That should overwrite the normal hooks and give them that loadout. Enjoy :) Thanks for the better method GRB.[/QUOTE] Awesome! Thanks!, could you tell me like the "technical" name for the tool gun though? Is it like weapon_toolgun ?
gmod_tool
Sorry, you need to Log In to post a reply to this thread.