• Making a team that cannot kill anyone?
    5 replies, posted
I want to make a green kind of team that has like medics and more,however I don't know how to make them UNABLE to kill anything,they'll probably just get a gun from something and use that, they are godded and can't die so I don't want someone to get a gun,pocket it,switch teams and start shooting the other teams while they can't do anything,I'm trying to make this server as automated as possible,a little concept I made,I'm making superadmins nearly useless as the concept is too easy to understand,however it runs off DarkRP. Any ideas on how to make a team such as TEAM_GREEN_CIV unable to hurt anyone,but be able to heal them using a medic kit? Please reply with anything that [B]might[/B] be a way of fixing this problem,thank you. Also remember,there are guns and this team is unable to be hurt or godded,they are like medics, and I want to use a medic kit or something for one of the green teams jobs to be able to heal someone. Preferably using a med kit anyway. Thanks. (So like disabling them to use weapons,I don't want)
[url]http://wiki.garrysmod.com/page/GM/EntityTakeDamage[/url] Check in this hook if the attacker or victim is part of the voided team. If so, return true. This will block the damage.
[QUOTE=code_gs;48027930][url]http://wiki.garrysmod.com/page/GM/EntityTakeDamage[/url] Check in this hook if the attacker or victim is part of the voided team. If so, return true. This will block the damage.[/QUOTE] Hmm,I'm not good at lua,could you provide a example? (I mean there is examples on there but both of them are for things that are explosions,and aren't close to need I want,I'll keep looking for a solution,maybe disabling to be given at spawn and make it so that only a few certain classes have it? That might make it nearly close enough to fix the problem but not really. -disable picking up of weapons without license -not give green team pocket -make teams not spawn with pocket unless defined Actually I think I just got this idea,but I'm not sure if there is a way to receive a item,pointshop is the only other way I think... [B]Edit:[/B] Actually,now I'm certain its impossible for them to get any weapons other than by a admin giving them using FAdmin or something... [IMG]http://i.imgur.com/lSiSIn5.png[/IMG] - [IMG]http://i.imgur.com/Ow0gqKf.png[/IMG]
You can use GM:PlayerCanPickupWeapon to prevent that team from getting any weapons to begin with. Just remember to allow the healing ones they're supposed to have.
[code] local allowed = { ["weapon_medkit"] } hook.Add("PlayerCanPickupWeapon","Medics",function(ply,wep) if ply:Team() == TEAM_MEDIC then if allowed[wep:GetClass()] then return true end return false end end) [/code]
[QUOTE=Sandblast;48027975]Hmm,I'm not good at lua,could you provide a example?[/QUOTE] [lua] local function BlockDamage( targ, dmg ) if( targ:IsPlayer() && dmg:GetAttacker():IsPlayer() ) then if( dmg:GetAttacker():Team() == TEAM_ONE ) then return false; end end end hook.Add( "EntityTakeDamage", "BlockDamage", BlockDamage ); [/lua]
Sorry, you need to Log In to post a reply to this thread.