Raised This Month: $ Target: $400
 0% 

about headshot.....


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fot
Junior Member
Join Date: Feb 2010
Old 04-19-2010 , 06:08   about headshot.....
Reply With Quote #1

How to make
"if the zombie is die by headshot , then the zombie can't spawn , else spawn"

i use this
Code:
register_event("DeathMsg","headshot","ade","3=1","5=0")
but it is
"if a player killed a zombie by headshot , then..."
think you

sorry , my english not good......
fot is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 04-19-2010 , 12:15   Re: about headshot.....
Reply With Quote #2

Just call the "normal" death event and use read_data(3) like this :

PHP Code:
register_event("DeathMsg""DeathMsg""a");

public 
DeathMsg()
{
    if(
read_data(3))
    {
        
//Headshot
    
}

Please next time , search. I realised I better shouldn't have helped you since this is very easy to find.
__________________
I am out of order!
grimvh2 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-19-2010 , 21:44   Re: about headshot.....
Reply With Quote #3

Quote:
Originally Posted by grimvh2 View Post
Just call the "normal" death event and use read_data(3) like this :
If he is using DeathMsg to only catch headshots then he is better off putting the condition in the register_event().

I have no idea what the point of "5=0" is, though.
DeathMsg
Code:
1 = byte 	KillerID
2 = byte 	VictimID
3 = byte 	IsHeadshot
4 = string 	TruncatedWeaponName
Use this to catch only headshots:
PHP Code:
register_event"DeathMsg" "fw_DeathMsg" "a" "1>0" "3=1" );

public 
fw_DeathMsg()
{
     static 
iKiller
     static 
iVictimiVictim read_data);

     
//How do you store who is a zombie?
     
if ( IsZombieiVictim ) )
     {
           
iKiller read_data);
         
//iVictim is a zombie and iKiller killed iVictim.

         //Your code goes here
     


__________________
Bugsy is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 04-20-2010 , 11:48   Re: about headshot.....
Reply With Quote #4

Yes ur right about that. I got a question, is it "3=1" or "3!1"? Ive seen "3!1" somewhere but forgot it.
__________________
I am out of order!
grimvh2 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-20-2010 , 16:01   Re: about headshot.....
Reply With Quote #5

3=1 means 3rd arg is 1 which is what we want because that means the kill was via head shot. 3!1 would catch only non head shot kills.

http://www.amxmodx.org/funcwiki.php?go=func&id=26
__________________
Bugsy is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 04-20-2010 , 16:03   Re: about headshot.....
Reply With Quote #6

sorry for slightly off topic, but is it better to use read_data() or pass the params through the function?
PHP Code:
public fwdPlayerDeath(idiVictimiHeadshotszWeapon
__________________

Last edited by minimiller; 04-20-2010 at 16:34. Reason: fucked up the order
minimiller is offline
Send a message via MSN to minimiller
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 04-20-2010 , 16:06   Re: about headshot.....
Reply With Quote #7

Ah ty bugsy,

minimiller, if you only need the headshot. you would need to add a killer to or else it wont work. So I think it depends on the situation.
__________________
I am out of order!
grimvh2 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-20-2010 , 17:15   Re: about headshot.....
Reply With Quote #8

You must use read_data, you cannot pass the data as params like that. Putting the conditions in register_event is best because it will be less native calls
__________________
Bugsy is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 04-20-2010 , 18:20   Re: about headshot.....
Reply With Quote #9

oh
so there isnt anything passed into the deathmsg?
__________________
minimiller is offline
Send a message via MSN to minimiller
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-20-2010 , 18:33   Re: about headshot.....
Reply With Quote #10

Quote:
Originally Posted by minimiller View Post
oh
so there isnt anything passed into the deathmsg?
No everything is read with read_data.
__________________
Bugsy 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 10:24.


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