Raised This Month: $ Target: $400
 0% 

killing anounce


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Caldeum
Senior Member
Join Date: Jul 2010
Location: United Kingdom
Old 09-11-2012 , 00:24   killing anounce
Reply With Quote #1

Anyone can help to fix thix code? if player kill 5 enemys in one round on hud will print message... after round end must count from begin.

PHP Code:
#include < amxmodx >

new kill_num32 ];
new 
g_HudMsg1;

public 
plugin_init( )
{
    
register_logevent"logevent_round_end"2"1=Round_End" );
    
register_event"DeathMsg""event_death""a""1>0" );
    
    
g_HudMsg1 CreateHudSyncObj( );
}

public 
client_connectid )
    
kill_numid ] = 0;

public 
client_disconnectid )
    
kill_numid ] = 0;

public 
logevent_round_endid )
    
kill_numid ] = 0;

public 
event_death( )
{
    static 
iKiller;
    
iKiller read_data);
    
kill_numiKiller ]++;
    
    new 
name32 ];
    
get_user_nameiKillername31 );
    
    if ( 
kill_numiKiller ] == )
    {
        
set_hudmessage5050500.070.1020.14.00.10.1, -);
        
ShowSyncHudMsg0g_HudMsg1"Wow! %s killed 5 enemys"name );
    }
    else if ( 
kill_numiKiller ] == 10 )
    {
        
set_hudmessage5050500.070.1020.14.00.10.1, -);
        
ShowSyncHudMsg0g_HudMsg1"Wow! %s killed 10 enemys"name );
        
kill_numiKiller ] = 0;
    }

__________________
Of all the things I lost, I miss my brain the most.
Caldeum is offline
Caldeum
Senior Member
Join Date: Jul 2010
Location: United Kingdom
Old 09-11-2012 , 17:46   Re: killing anounce
Reply With Quote #2

anyone?
__________________
Of all the things I lost, I miss my brain the most.
Caldeum is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-11-2012 , 17:49   Re: killing anounce
Reply With Quote #3

PHP Code:
public logevent_round_end()
{
    new 
iPlayers[32], iNum;
    
get_players(iPlayersiNum);

    for(new 
iNum i++)
        
kill_num[iPlayers[i]] = 0//bad practice? w/e

Also get user name only when it's needed, when he got 5 or 10 kills (inside of if condition)
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 09-11-2012 at 17:53.
Alka is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 09-12-2012 , 06:38   Re: killing anounce
Reply With Quote #4

Also, check if he didn't commit suicide.
guipatinador is offline
Caldeum
Senior Member
Join Date: Jul 2010
Location: United Kingdom
Old 09-12-2012 , 07:51   Re: killing anounce
Reply With Quote #5

Quote:
Originally Posted by guipatinador View Post
Also, check if he didn't commit suicide.
Just wanted to write about it

This gonna fix?
PHP Code:
new iVictim read_data);

    if ( 
iKiller == iVictim )
        return; 
__________________
Of all the things I lost, I miss my brain the most.
Caldeum is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 09-12-2012 , 07:56   Re: killing anounce
Reply With Quote #6

Yes.
Also, make sure that he didn't make TK.

Last edited by guipatinador; 09-12-2012 at 07:57.
guipatinador is offline
Caldeum
Senior Member
Join Date: Jul 2010
Location: United Kingdom
Old 09-12-2012 , 08:20   Re: killing anounce
Reply With Quote #7

PHP Code:
if ( cs_get_user_teamiKiller ) == cs_get_user_teamiVictim ) )
   return; 
__________________
Of all the things I lost, I miss my brain the most.
Caldeum is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-12-2012 , 08:26   Re: killing anounce
Reply With Quote #8

or get_user_team() without the need of cstrike module :-)
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Caldeum
Senior Member
Join Date: Jul 2010
Location: United Kingdom
Old 09-12-2012 , 08:31   Re: killing anounce
Reply With Quote #9

ok thanks guys
__________________
Of all the things I lost, I miss my brain the most.
Caldeum is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-12-2012 , 08:42   Re: killing anounce
Reply With Quote #10

Code:
    else if ( kill_num[ iKiller ] == 10 )
    {
        set_hudmessage( 50, 50, 50, 0.07, 0.10, 2, 0.1, 4.0, 0.1, 0.1, -1 );
        ShowSyncHudMsg( 0, g_HudMsg1, "Wow! %s killed 10 enemys", name );
        kill_num[ iKiller ] = 0;
    }
Settting kill_num to 0 here will reset the score after 10 kills. Alive or not.
I'd also, depending what you want to do, put the the kill_num reset in event_death. This will make it so you don't need to deal with a round_start event. Allowing deathmatch servers to use this code because their rounds go on for god knows how long while the players continue to spawn.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Reply


Thread Tools
Display Modes

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 08:20.


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