Im trying to make a function wich drops the players current weapon but doesn't drop if the weapon is "weapon_fists" So I tried using this:
[CODE]function dropwep( ply )
if (ply:GetActiveWeapon() == "weapon_fists") then
return false
else
ply:DropWeapon(ply:GetActiveWeapon())
end
end
concommand.Add( "drop", dropwep )[/CODE]
But that doesn't work. Any ideas?
[lua]if ply:GetActiveWeapon():GetClass() ~= "weapon_fists" then
ply:DropWeapon(ply:GetActiveWeapon())
end[/lua]
Thanks Alot! Also is there a IN_KEY for Q?
lua_find IN_
If you can't find it then no.
[QUOTE=Bohnenbaum;41540099]Thanks Alot! Also is there a IN_KEY for Q?[/QUOTE]
[url]http://wiki.garrysmod.com/page/SANDBOX/SpawnMenuOpen[/url]
[b]EDIT: [/b] You can also use hooks for other keys:
In a clientside lua file:
[lua]
hook.Add("Think", "PressAnyKey", function()
if LocalPlayer():KeyPressed(KEY_P) then
LocalPlayer():ChatPrint("You've pressed the P Key! Congratulations!")
elseif LocalPlayer():KeyPressed(KEY_N) then
LocalPlayer():ChatPrint("You've pressed the N Key! Congratulations!")
end
end)
[/lua]
Sorry, you need to Log In to post a reply to this thread.