Raised This Month: $ Target: $400
 0% 

Headshot counter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hellraser
Member
Join Date: Jul 2004
Old 07-15-2004 , 19:58   Headshot counter
Reply With Quote #1

well well,i know how to get user frags but how would i get the number of headshots the user made?
like
if HS >= 50% of Frags would display a message otherwise nothing...

Thx ?[/code]
hellraser is offline
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 07-15-2004 , 21:38  
Reply With Quote #2

you'd need to make a death event that stores all player's headshot kills in a global variable. like so.

Code:
#define HEADSHOT_RATIO 0.50 new g_iHeadshots[33]; // Death event public Ev_Death() {     new kId = read_data( 1 );    // Killer Index     new iHeadshot = read_data( 3 );     if ( iHeadshot )         g_iHeadshots[kId] += 1;     // Display message if headshots > HEADSHOT_RATIO     new iKills = get_user_frags( kId );     new Float:fRatio = float( g_iHeadshots[kId] ) / float( iKills );     if ( fRatio >= HEADSHOT_RATIO )     {         new szMessage[64];         format( szMessage, 63, "%0.0f%s of your kills are headshots!", fRatio * 100.0, "%%" );         // display this message however you need.     }         return PLUGIN_CONTINUE; } public plugin_init() {     // .. do other initializing in here     register_event( "DeathMsg", "Ev_Death", "a" );     return PLUGIN_CONTINUE; }

I'm pretty sure you can display a % sign by stringing "%%", but i'm not 100% sure.

Hope this helps.
__________________
Warcraft 3: Expansion
Homepage | Downloads | Forums
Ryan is offline
Send a message via AIM to Ryan
hellraser
Member
Join Date: Jul 2004
Old 07-16-2004 , 05:27  
Reply With Quote #3

Thx m8
hellraser is offline
DanRaZor
Senior Member
Join Date: Apr 2004
Location: Paris ( France )
Old 07-16-2004 , 07:17  
Reply With Quote #4

What do you think of that :



Search powwwwwwwwa ...

__________________
My name is Dan, just Dan ...
DanRaZor is offline
Send a message via MSN to DanRaZor
DanRaZor
Senior Member
Join Date: Apr 2004
Location: Paris ( France )
Old 07-16-2004 , 07:20  
Reply With Quote #5

Just kidding ... go HERE

__________________
My name is Dan, just Dan ...
DanRaZor is offline
Send a message via MSN to DanRaZor
hellraser
Member
Join Date: Jul 2004
Old 07-16-2004 , 08:18  
Reply With Quote #6

hehe thx ;)
One simple question how to i print a hudmessage to onlyone specific player??
I tried show_hudmessage(id, "Status : %d %",rnd)

But it prints it to everyone...
hellraser is offline
DanRaZor
Senior Member
Join Date: Apr 2004
Location: Paris ( France )
Old 07-16-2004 , 08:45  
Reply With Quote #7

Verify that your id is right by printing it ( 0 is for all ... )

Do not use format in the show_hudmessage, don't know if it really works well

Do like that :

Code:
new text[64] format(text,63,"[%d] Status : %d %%",id,rnd) set_hudmessage( .... ) show_hudmessage(id, text)

PS : Add "%%" to show % ...

You will see a message like

Quote:
[12] Status : 10 %
And watch what is in [], if 0, all will see it ... and it is normal.
__________________
My name is Dan, just Dan ...
DanRaZor is offline
Send a message via MSN to DanRaZor
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 14:40.


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