Raised This Month: $ Target: $400
 0% 

[SOLVED] XXX Times kills


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 10-06-2010 , 06:49   [SOLVED] XXX Times kills
Reply With Quote #1

hi,

i tried to write a plugin to showes messages by kills. now i have no idea to show how manytimes is a user killed by the same user.

for example :

Quote:
[AMX] You are kiled by XXX! He has XX HP & XX AP. ( XX Times kills )
Quote:
[AMX] You killed XXX! ( XX Times Kills )
here is my code.
i just want to have a idea how to catch how manytimes is a player killed by the same Killer & how manytimes killed the killer the same Victim.

here is my code.

PHP Code:
#include <amxmodx>

new g_iMaxPlayers

public plugin_init()
{
    
register_plugin("Kill MSGs","1","One")
    
register_event("DeathMsg","EventDeathMsg","a")
    
g_iMaxPlayers get_maxplayers()
}
public 
EventDeathMsg()
{
    new 
iKiller read_data);
    new 
iVictim read_data);
    
    new 
szVictimName32 ];
    
get_user_nameiVictimszVictimNamecharsmaxszVictimName ) );
    
    if( 
iKiller == iVictim || !( <= iKiller <= g_iMaxPlayers ) )
    {
        
client_print0print_chat"%s killed self"szVictimName );
    }
    else
    {
        new 
szKillerName32 ]
        new 
szVictimname [32]
        new 
killershp get_user_health(iKiller)
        new 
killersAP get_user_armor(iKiller)
        
get_user_nameiKillerszKillerNamecharsmaxszKillerName ) )
        
get_user_nameiVictimszVictimnamecharsmaxszVictimname ) )
        
client_printc(iVictim"\nKilled by \g%s\n! He has \g%d \nHP & \g%d \nAP.",szKillerName,killershp,killersAP)
        
client_printciKiller"\nYou killed \g%s",szVictimname)
    }
}
stock client_printc(const id,const input[], any:...)
{
    new 
msg[191], players[32], count 1;
    
vformat(msg,190,input,3);
    
replace_all(msg,190,"\g","^4");// green
    
replace_all(msg,190,"\n","^1");// normal
    
replace_all(msg,190,"\t","^3");// team
    
if (idplayers[0] = id; else get_players(players,count,"ch");
    for (new 
i=0;i<count;i++)
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }

but i have no idea how to catch it i hope you understand me
__________________

Last edited by One; 10-06-2010 at 15:59.
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 10-06-2010 , 10:05   Re: XXX Times kills
Reply With Quote #2

i think you need use tries.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-06-2010 , 13:10   Re: XXX Times kills
Reply With Quote #3

Quote:
Originally Posted by lucas_7_94 View Post
i think you need use tries.
Unnecessary.

Just use a 2-dimensional array.

Code:
#define MAX_PLAYERS 32 new g_iKills[ MAX_PLAYERS + 1 ][ MAX_PLAYERS + 1 ]; new g_iMaxPlayers; public plugin_init( ) {     register_event( "DeathMsg", "EventDeathMsg", "a", "1>0" );         g_iMaxPlayers = get_maxplayers( ); } public client_disconnect( iPlayer ) {     arrayset( g_iKills[ iPlayer ], 0, ( g_iMaxPlayers + 1 ) );         for( new i = 1; i <= g_iMaxPlayers; i++ )     {         g_iKills[ i ][ iPlayer ] = 0;     } } public EventDeathMsg( ) {     new iKiller = read_data( 1 );         if( iKiller <= g_iMaxPlayers )     {         new iVictim = read_data( 2 );         new iKills = ++g_iKills[ iKiller ][ iVictim ];                 new szName[ 32 ];         get_user_name( iVictim, szName, charsmax( szName ) );         client_print( iKiller, print_chat. "* You have killed %s %i times!", szName, iKills );                 get_user_name( iKiller, szName, charsmax( szName ) );         client_print( iVictim, print_chat. "* You have been killed by %s %i times!", szName, iKills );     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 10-06-2010 , 15:58   Re: XXX Times kills
Reply With Quote #4

n1 Exolent. like Ever

ty.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
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:22.


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