Gang Leaderboard
#1

Hi there, I am working on a a small gang system with 3 teams which all have an overall score.
The problem I have is that my gang leaderboard is conflicting (sometimes one team shows up twice or scores don't update on the board but do under OnPlayerDeath) alot and it's because of my if statements.

The link below shows all the code I use under OnPlayerUpdate.
http://pastebin.com/rMJHPgBS

pawn Код:
// Some info you may need to know.
GangTextBody1 = Top position on leader board.
GangTextBody2 = Middle position on leader board.
GangTextBody3 = Bottom position on leader board.
Also an image of the leaderboard incase that helps you see what i'm trying to do here.


If anyone can tell me where I have gone wrong or offer some advice on how to improve the checks then please do tell me.
Reply
#2

Kinda useless use it inside onplayerupdate, normally i make a new public and call it by using calllocalfunction, which is better calling it when it really requires.

i recommend you post the fully code, instead of post a piece. so i would be able to help you instead.
Reply
#3

Well that is all the code really other than the score being increased under OnPlayerDeath.

pawn Код:
// My enum
enum ServerData
{
    Mafia_Score,
    Triads_Score,
    Aztecas_Score
};
new ServerInfo[ServerData];

// OnPlayerDeath
if(gTeam[playerid] == TEAM_MAFIA && gTeam[killerid] == TEAM_TRIADS)
    {
        ServerInfo[Triads_Score] += 1;
        SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
        GivePlayerMoney(killerid, 10000);
    }
    else if(gTeam[playerid] == TEAM_MAFIA && gTeam[killerid] == TEAM_AZTECAS)
    {
        ServerInfo[Aztecas_Score] += 1;
        SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
        GivePlayerMoney(killerid, 10000);
    }
   
    if(gTeam[playerid] == TEAM_TRIADS && gTeam[killerid] == TEAM_MAFIA)
    {
        ServerInfo[Mafia_Score] += 1;
        SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
        GivePlayerMoney(killerid, 10000);
    }
    else if(gTeam[playerid] == TEAM_TRIADS && gTeam[killerid] == TEAM_AZTECAS)
    {
        ServerInfo[Aztecas_Score] += 1;
        SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
        GivePlayerMoney(killerid, 10000);
    }
   
    if(gTeam[playerid] == TEAM_AZTECAS && gTeam[killerid] == TEAM_MAFIA)
    {
        ServerInfo[Mafia_Score] += 1;
        SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
        GivePlayerMoney(killerid, 10000);
    }
    else if(gTeam[playerid] == TEAM_TRIADS && gTeam[killerid] == TEAM_TRIADS)
    {
        ServerInfo[Triads_Score] += 1;
        SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
        GivePlayerMoney(killerid, 10000);
    }
I hope that helps you see what i'm doing.
Reply
#4

Well, i couldn't see any problem under onplayerdeath, about the pastebin, it's too messed.
Reply
#5

I don't suppose anyone else woul be able to see where I've gone wrong?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)