Im working on a gamemode and Im looking for something (possibly a override) that would disable players being able to spawn weapons from the q menu. If there are ways to disable the other tabs as well, such as ammo spawning, please let me know if theres a way to do this.
use the PlayerSpawnSWEP and PlayerSpawnedSWEP and inside it, check if a convar is true or false, if true, disable while if false, enable.
[lua]function GM:PlayerSpawnSWEP( ply, class, info )
if ( not ply:IsAdmin() then
return false
end
end[/lua]
[QUOTE=Lerpaderp;39274622][lua]function GM:PlayerSpawnSWEP( ply, class, info )
if ( not ply:IsAdmin() then
return false
end
end[/lua][/QUOTE]
That works perfect! it just needs a hook (i added it). Thanks a lot!!
[QUOTE=Triple-X;39284339]That works perfect! it just needs a hook (i added it). Thanks a lot!![/QUOTE]
That doesn't need a hook, it overrides the gamemode's hook for it.
Actually i just did a restart and it doesnt work with or without a hook. (I didnt make any changes to it) O_o
[QUOTE=Triple-X;39284568]Actually i just did a restart and it doesnt work with or without a hook. (I didnt make any changes to it) O_o[/QUOTE]
There's an extra "(" before "not" that you should remove.
I did. Still nothing.
Do you have it in server-side autorun or are you incorporating it into the gamemode?
init.lua
Is that wrong? ._.
[lua]function GM:PlayerSpawnSWEP( ply, class, info )
if (not ply:IsAdmin()) then
return false
end
end[/lua]
and you have that exact code in there?
[CODE]local function RestrictWeapons(ply, class, weapon)
return ply:IsSuperAdmin()
end
hook.Add("PlayerSpawnSWEP", "RestrictWeapons", RestrictWeapons)
hook.Add("PlayerGiveSWEP", "RestrictWeapons", RestrictWeapons)[/CODE]
I threw this in there and it started working again.... Thanks anyways!! :)
Sorry, you need to Log In to post a reply to this thread.