Raised This Month: $ Target: $400
 0% 

The best player of round


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
^^KaMaZZ~.^
Junior Member
Join Date: Jan 2009
Old 01-03-2009 , 18:24   The best player of round
Reply With Quote #1

I made a plugin, but can you check correctly?
Srry, my english is ulow

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "BestPlayer"
#define VERSION "1.0"
#define AUTHOR "KaMaZZ"

new kills[33]
new 
deaths[33]

new 
bestplayerid

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("clear"2"1=Round_Start")
    
register_logevent("endround",2,"1=Round_End")    
}

public 
client_connect(id
{
    
kills[id] = 0
    deaths
[id] = 0
}

public 
client_death(attacker)
{
    
id attacker    
    kills
[id] += 1;
    
deaths[id] += 1;        
}
        
public 
endround() 
{
    new 
players[32], pnumid;
    
get_players(playerspnum);
    
    if(
pnum 2)
        return

    
bestplayer players[0];
    
    for(new 
i=0pnumi++)
    {
        
id players[i]
        if(
kills[id] > kills[bestplayer] || kills[id] == kills[bestplayer] && deaths[id] < deaths[bestplayer])
        
bestplayer id
    
}
    
    new 
name[32];
    
get_user_name(bestplayername31);

    
client_print(0print_chat"Najlepszy gracz rundy: %s"name)
    
client_print(0print_chat"Zdobyl %d fragow"kills[bestplayer])
    
// client_print(0, print_chat, "Trafil %d razy w leb", hsfrag)
}

public 
clear()
{
    new 
players[32], pnum
    get_players
(playerspnum);
    
kills[players[pnum]] = 0
    deaths
[players[pnum]] = 0
    bestplayer 
players[0];

EDIT:
Newer version
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "BestPlayer"
#define VERSION "1.0"
#define AUTHOR "KaMaZZ"

new kills[33]
new 
deaths[33]

new 
bestplayer

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("DeathMsg""death_event""a""1>0");
    
register_logevent("wyczysc"2"1=Round_Start")
    
register_logevent("wiadomosc",2,"1=Round_End")    
}

public 
client_connect(id
{
    
kills[id] = 0
    deaths
[id] = 0
}

public 
death_event(id)
{
    new 
killer read_data(1);
    new 
victim read_data(2);    
    
        
kills[killer] += 1;
        
kills[victim] = 0;
        
deaths[killer] = 0;
        
deaths[victim] += 1;        
}
        
public 
wiadomosc() 
{
    new 
players[32], pnumid;
    
get_players(playerspnum);
    
    if(
pnum 2)
        return

    
bestplayer players[0];
    
    for(new 
i=0pnumi++)
    {
        
id players[i]
        if(
kills[id] > kills[bestplayer] || kills[id] == kills[bestplayer] && deaths[id] < deaths[bestplayer])
        
bestplayer id
    
}
    
    new 
name[32];
    
get_user_name(bestplayername31);

    
client_print(0print_chat"Najlepszy gracz rundy: %s"name)
    
client_print(0print_chat"Zdobyl %d fragow"kills[bestplayer])
    
// client_print(0, print_chat, "Trafil %d razy w leb", hsfrag)
}

public 
wyczysc()
{
    new 
players[32], pnum
    get_players
(playerspnum);
    
kills[players[pnum]] = 0
    deaths
[players[pnum]] = 0
    bestplayer 
players[0];


Last edited by ^^KaMaZZ~.^; 01-03-2009 at 21:07.
^^KaMaZZ~.^ is offline
 


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 09:06.


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