• How to make it so a class cant pick up weapons?
    6 replies, posted
How would i make it so only a certain class can't pick up weapons?
[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerCanPickupWeapon]Gamemode.PlayerCanPickupWeapon [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
So would this be right? [LUA]function PlayerCanPickupWeapon(ply, team) if ply:TEAM() == "TEAM_SOLIDER" then return false end return true end hook.Add("PlayerCanPickupWeapon", "RandomUniqueName", PlayerCanPickupWeapon)[/LUA] [editline]04:35PM[/editline] [LUA]for k, v in pairs(player.GetAll(Teams)) do function PlayerCanPickupWeapon(ply, teams) if ply:GetTeam() == "TEAM_SOLDIER" then return false end return true end end hook.Add("PlayerCanPickupWeapon", "RandomUniqueName", PlayerCanPickupWeapon)[/LUA] This worked for people who have this problem
That'd make TEAM_SOLDIER unable to pick up weapons and everyone else able, but if that's what you want, sure. Return weather ply can pickup weapon wep (which you have as team for some reason). Don't forget lua is case sensitive so ply:TEAM() wouldn't work whereas ply:Team() would
Can someone also tell me how to strip the weapons when people try to join team solider and team hostage? I tryed this [LUA]for k, v in pairs(player.GetAll(Teams)) do if ply:Team() == "TEAM_SOLIDER" or "TEAM_HOSTAGE" then ply:StripWeapons() else return end end [/LUA] I'm not getting any errors its just not working
well... is TEAM_SOLIDER spelled correctly?
you got lots of problems in there, first off: dont have quotes around TEAM_SOLIDER, it dosent make sense at all. second, use this: if ply:Team() == TEAM_SOLIDER or ply:Team() == TEAM_HOSTAGE then
Sorry, you need to Log In to post a reply to this thread.