Need help Round Deaths/Kills!!!!!!
#1

hi,

i want to show a board with all the players that are online and their kills and deaths they've made in the last round on round end.
But its bugy! Also if threre are 2 players online it only shows only 1 textdraw. (but the player counter works i also use it in other functions.)
Also it seems that the kills in a round and deaths in a round are not counted right.
Would be so happy about some help!!

pawn Код:
//defininig
new killedinround[MAX_PLAYERS];
new diedinround[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
//counting deaths and kill in a round
     
     diedinround[playerid]++;
     if(killerid!=INVALID_PLAYER_ID)
     {
        killedinround[killerid]++;
     }
return 1;
}

//resetting deaths and kill after a new round starts

for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
killedinround[i] = 0;
diedinround[i] = 0;
}
}

//This is the function comparing the players round kills
stock TopOnEndShowTextDraw()
{

new TotalScoresEnd[21];//21 because it shows 20 players statistic on end
new TotalPlayersEnd[21];
new PlayerScore[2];
new PlayerID[2];
for(new i; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        PlayerScore[0] = killedinround[i]; //kills per round
        PlayerID[0] = i;
        for(new place; place < sizeof(TotalScoresEnd); place++)
        {
            if(PlayerScore[0] > TotalScoresEnd[place])
            {
                strins(TotalScoresEnd, PlayerScore, place);
                strins(TotalPlayersEnd, PlayerID, place);
                place = sizeof(TotalScoresEnd);
            }
        }
    }
}

new string[1024];

switch(PlayerOnline)//this checks how many players are online
{
case 1://it shows only 1 textdraw if only 1 player is online
{
TextDrawShowForAll(RoundEndStats);
TextDrawShowForAll(RoundEndStats0);
GetPlayerName(TotalPlayersEnd[0], string, sizeof(string));
format(string, sizeof(string), "~r~1.  ~w~%s              \t~r~%d           \t~b~%d", string,TotalScoresEnd[0],diedinround[TotalPlayersEnd[0]]);
TextDrawShowForAll(RoundEndStats1);
TextDrawSetString(Text:RoundEndStats1, string);
}
case 2:
{
TextDrawShowForAll(RoundEndStats);
TextDrawShowForAll(RoundEndStats0);
GetPlayerName(TotalPlayersEnd[0], string, sizeof(string));
format(string, sizeof(string), "~r~1.  ~w~%s              \t~r~%d           \t~b~%d", string,TotalScoresEnd[0],diedinround[TotalPlayersEnd[0]]);
TextDrawShowForAll(RoundEndStats1);
TextDrawSetString(Text:RoundEndStats1, string);

GetPlayerName(TotalPlayersEnd[1], string, sizeof(string));
format(string, sizeof(string), "~r~2.  ~w~%s              \t~r~%d           \t~b~%d", string,TotalScoresEnd[1],diedinround[TotalPlayersEnd[1]]);
TextDrawShowForAll(RoundEndStats1);
TextDrawSetString(Text:RoundEndStats1, string);
}
//and so on....
regards...
Reply
#2

pls, someone?
Reply
#3

pls. at least tell me if im counting the round kills/deaths right.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)