Witam,
Czy mógłby mi ktoś przerobić plugin na najlepszego gracza rundy?
Aktualnie sytuacja wyglada tak, ze gdy nie ma żadnego najlepszego gracza rundy tzn. 0 kill, 0 headow to na chacie pojawia się informacja:
Najlepszym graczem rundy został (TUTAJ JEST NAZWA SERWERA zamiast nicku - nie wiedzieć czemu) (0 fragow w tym 0 HS)
Zależałoby mi, że gdy nie ma żadnego najlepszego gracza to nie pojawia się żadna informacja.
Z góry dziękuje ![]()
#include <amxmodx>
#include <colorchat>
#define PLUGIN "BestPlayer"
#define VERSION "1.0"
#define AUTHOR "KaMaZZ"
new g_iKills[33]
new g_iDeaths[33]
new g_hs[33]
new bestplayer = 0, g_iMaxPlayers;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "death_event", "a", "1>0");
register_event("HLTV", "eHLTV", "a", "1=0", "2=0");
register_logevent("wiadomosc",2,"1=Round_End")
g_iMaxPlayers = get_maxplayers();
}
public client_connect(id)
{
g_iKills[id] = 0
g_iDeaths[id] = 0
}
public death_event()
{
new iKiller = read_data(1), iVictim = read_data(2), iHitplace = read_data(3);
if (iKiller == iVictim)
{
g_iDeaths[iKiller]++;
return;
}
g_iKills[iKiller]++;
g_iDeaths[iVictim]++;
if(iHitplace)
{
g_hs[iKiller]++;
}
}
public wiadomosc()
{
if(get_playersnum() < 2)
return
for(new i=1; i <= g_iMaxPlayers; i++)
{
if (g_iKills[i] > g_iKills[bestplayer] || g_iKills[i] == g_iKills[bestplayer] && g_iDeaths[i] < g_iDeaths[bestplayer] || g_iKills[i] == g_iKills[bestplayer] && g_hs[i] > g_hs[bestplayer])
{
bestplayer = i;
}
}
new name[32];
get_user_name(bestplayer, name, 31);
new iKills = g_iKills[bestplayer]
new iHS = g_hs[bestplayer]
if(iKills >= 5 || iKills == 0)
{
ColorChat(0, GREEN, "~^x01 Najlepszym graczem rundy zostal^x03 %s^x01 (^x04%d^x01 fragow w tym^x04 %d^x01 HS)", name, iKills, iHS)
}
else if(iKills > 1 && iKills < 5)
{
ColorChat(0, GREEN, "~^x01 Najlepszym graczem rundy zostal^x03 %s^x01 (^x04%d^x01 fragi w tym^x04 %d^x01 HS)", name, iKills, iHS)
}
else if(iKills == 1)
{
ColorChat(0, GREEN, "~^x01 Najlepszym graczem rundy zostal^x03 %s^x01 (^x04%d^x01 frag w tym^x04 %d^x01 HS)", name, iKills, iHS)
}
}
public eHLTV()
{
for( new i = 1 ; i <= g_iMaxPlayers ; i++ )
{
g_iKills[ i ] = 0;
g_iDeaths[ i ] = 0;
g_hs[ i ] = 0;
}
}


Dodatki SourceMod



Temat jest zamknięty










