Raised This Month: $ Target: $400
 0% 

Detect Shoot on Player & HUD-Sprite


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Grinf4ce
Senior Member
Join Date: May 2006
Old 07-10-2008 , 15:13   Detect Shoot on Player & HUD-Sprite
Reply With Quote #1

Hello!
How i can detect a shoot on a player (without difference between enemy or friendly). And how i

Example:
I shoot on Player1. A function called which calculate the damage and show how many hp the player has left. [Its only an example]

Please help me
- Grinf4ce
__________________
Grinf4ce is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-10-2008 , 15:21   Re: Detect Shoot on Player
Reply With Quote #2

Hook the Damage event, or Ham_TakeDamage from hamsandwich, the forward from hamsandwich is called if a player is a team mate and friendly fire is deactivated too.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Old 07-10-2008, 15:23
hleV
This message has been deleted by hleV. Reason: Nevermind. Alka was faster.
Grinf4ce
Senior Member
Join Date: May 2006
Old 07-11-2008 , 03:22   Re: Detect Shoot on Player
Reply With Quote #3

Hello Alka!
Thanks for your tips!

How should i hook HAM_TakeDamage? Please give me an example, im new at scripting :-/

And how can i show a sprite above a player for 5 seconds? :-S
Please help me

+ Karma for you alka
Greets, Grinf4ce
__________________

Last edited by Grinf4ce; 07-11-2008 at 03:28.
Grinf4ce is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-11-2008 , 03:40   Re: Detect Shoot on Player & HUD-Sprite
Reply With Quote #4

Code:
    public plugin_init ()     {         RegisterHam ( Ham_TakeDamage, "player", "fwd_TakeDamage" );     }         public fwd_TakeDamage ( id, inflictor, attacker, Float:damage, damagebits )     {     }


Code:
message_begin ( MSG_BROADCAST, SVC_TEMPENTITY ); write_byte ( TE_PLAYERATTACHMENT ); write_byte ( id ); write_coord ( 50 ); // distance from player's head. write_short ( YourSprite ); write_short ( 5 * 10); message_end();
__________________
Arkshine 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 06:01.


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