How to get Highest deaths with player name in a Round
#2

PHP код:
#include <a_samp>

new p_Deaths[MAX_PLAYERS] = {0, ...};

public 
OnPlayerDisconnect(playeridreason)
{
    
p_Deaths[playerid] = 0//reset player deaths
    
return 1;
}

public 
OnPlayerDeath(playeridkilleridreason)
{
    
p_Deaths[playerid] ++; //+1 death when player dies
    
return 1;
}

forward onroundend(); //on round end

public onroundend() //on round end
{
    new 
str[85], name[MAX_PLAYER_NAME], last_player = -1last_score//set top score to 0 at first and player to -1
    
for(new 0GetPlayerPoolSize(); <= ji++) //loop
    
{
        if(!
IsPlayerConnected(i) || IsPlayerNPC(i) || p_Deaths[i] <= last_score//if player not connected, npc or got same score as previous player or less (skip)
        
last_player i//set the last player with best score
    
}
    
//after we got the top player lets get his name and send message to all that he died the most
    
GetPlayerName(last_playernamesizeof(name));
    
format(strsizeof(str), "%s {FFFFFF}died the most this round {FF0000}%d {FFFFFF}deaths"namep_Deaths[last_player]);
    
SendClientMessageToAll(0xFFFF00FFstr);
    return 
1;

Reply


Messages In This Thread
How to get Highest deaths with player name in a Round - by TadePoleMG - 04.05.2018, 15:47
Re: How to get Highest deaths with player name in a Round - by Lokii - 04.05.2018, 16:27
Re: How to get Highest deaths with player name in a Round - by TadePoleMG - 04.05.2018, 16:42
Re: How to get Highest deaths with player name in a Round - by jlalt - 04.05.2018, 19:35

Forum Jump:


Users browsing this thread: 1 Guest(s)