Raised This Month: $ Target: $400
 0% 

Disable Shooting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GuLdUn
New Member
Join Date: Oct 2010
Old 10-04-2010 , 07:07   Disable Shooting
Reply With Quote #1

Hey guys,

I've been searching, tried many things, but just cant seem to get this to work... So i thought i would ask as a last resort.

What i'm trying to do is: We want to disable being able to shoot or be shot at in a certain area, we have all the co ordinates and checking if the player is in the area down pat... my problem is disabling people to shoot or if they do shoot when they are in that area to take no effect to anyone or for them to have no effect on them while they are in that area?
I have tried the EventHooks and disabling "player_shoot", "player_hurt" and anything else i could find that sort of made sense to what I wanted (Including disabling, changing and editing the way the events handled) now I'm guessing its not that simple... So if anyone could point me in the right direction or anyone that knows of any example code or where I should go from here would be great.

Thank you!
GuLdUn is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 10-04-2010 , 07:28   Re: Disable Shooting
Reply With Quote #2

There are some ways.
If you truely want to "stop" them from shooting, you can change buttons to disable the action, but you'd get prediction issues.

Best way of doing this would be to use SDKHooks, hook OnTakeDamage and check if the attacker == the guy in the no-shoot zone and if so, set damage to 0.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
GuLdUn
New Member
Join Date: Oct 2010
Old 10-04-2010 , 08:08   Re: Disable Shooting
Reply With Quote #3

That worked a treat!
heres an example for future ref:
Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
  damage = 0;
  return Plugin_Changed
}
pretty simple, just changed the damage to 0 so ur invinsible...
(this obviously isnt with our co-ordinate code in it)
but im going to do a if statement like so:
if ( attacker or victim in safe zone)
take no damage
else
take damage

thanks for the help
GuLdUn is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode