07.12.2014, 22:21
Olб boa noite, criei um sistema de patentes se o player tiver tantas vitorias ele entrarб em um certo grupo mas nгo estб funcionando da forma correta, quando eu chego em um nъmero de vitorias a mensagem da callback nгo chega e no comando rank fica sem grupo.
Esse cуdigo eu criei sу para testes.
Esse cуdigo eu criei sу para testes.
pawn Код:
#include a_samp
#include zcmd
#define Azul 0xFFFFFFFF //Nгo liguem '-'
enum pInfo
{
pWins,
}
static PlayerInfo[MAX_PLAYERS][pInfo];
forward IsPlayerRankingInfo(playerid);
stock Ranking(playerid)
{
new rr[40];
if(PlayerInfo[playerid][pWins] == 0) rr = "New Driver";
else if(PlayerInfo[playerid][pWins] == 10) rr = "Little Driver";
else if(PlayerInfo[playerid][pWins] == 30) rr = "Young Driver";
else if(PlayerInfo[playerid][pWins] == 50) rr = "Huge Driver";
else if(PlayerInfo[playerid][pWins] == 80) rr = "Great Driver";
else if(PlayerInfo[playerid][pWins] == 150) rr = "Good Driver";
else if(PlayerInfo[playerid][pWins] == 200) rr = "Driver Master";
else if(PlayerInfo[playerid][pWins] == 300) rr = "Old Driver";
else if(PlayerInfo[playerid][pWins] == 500) rr = "High Driver";
return rr;
}
//Comando para ver o rank atual.
command(rank, playerid, params[])
{
static cmd[256], tmp[256];
format(cmd, sizeof(cmd), "{32CD32}•{FFFFFF} Rank: %s\n", Ranking(playerid));
strcat(tmp, cmd);
ShowPlayerDialog(playerid, 10000, DIALOG_STYLE_MSGBOX, "Rank", cmd, "Fechar", "");
return true;
}
//Comando para ver quantas vitorias tem.
command(wins, playerid, params[])
{
static cmd[256], tmp[256];
format(cmd, sizeof(cmd), "{32CD32}•{FFFFFF} Wins: %d\n", PlayerInfo[playerid][pWins]);
strcat(tmp, cmd);
ShowPlayerDialog(playerid, 10000, DIALOG_STYLE_MSGBOX, "Wins", cmd, "Fechar", "");
return true;
}
//Comando para aumentar as vitorias, apenas para testes.
CMD:w(playerid, params[])
{
PlayerInfo[playerid][pWins]++;
return true;
}
public IsPlayerRankingInfo(playerid)
{
if(PlayerInfo[playerid][pWins] == 10)
{
SendClientMessage(playerid, Azul, "[ {32CD32}UP{FFFFFF} ] Voce subiu de rank.");
SendClientMessage(playerid, Azul,"{32CD32}•{FFFFFF} Rank atual: Little Driver");
}
else if(PlayerInfo[playerid][pWins] == 30)
{
SendClientMessage(playerid, Azul, "[ {32CD32}UP{FFFFFF} ] Voce subiu de rank.");
SendClientMessage(playerid, Azul,"{32CD32}•{FFFFFF} Rank atual: Young Driver");
}
else if(PlayerInfo[playerid][pWins] == 50)
{
SendClientMessage(playerid, Azul, "[ {32CD32}UP{FFFFFF} ] Voce subiu de rank.");
SendClientMessage(playerid, Azul,"{32CD32}•{FFFFFF} Rank atual: Huge Driver");
}
else if(PlayerInfo[playerid][pWins] == 80)
{
SendClientMessage(playerid, Azul, "[ {32CD32}UP{FFFFFF} ] Voce subiu de rank.");
SendClientMessage(playerid, Azul,"{32CD32}•{FFFFFF} Rank atual: Great Driver");
}
else if(PlayerInfo[playerid][pWins] == 150)
{
SendClientMessage(playerid, Azul, "[ {32CD32}UP{FFFFFF} ] Voce subiu de rank.");
SendClientMessage(playerid, Azul,"{32CD32}•{FFFFFF} Rank atual: Good Driver");
}
else if(PlayerInfo[playerid][pWins] == 200)
{
SendClientMessage(playerid, Azul, "[ {32CD32}UP{FFFFFF} ] Voce subiu de rank.");
SendClientMessage(playerid, Azul,"{32CD32}•{FFFFFF} Rank atual: Driver Master");
}
else if(PlayerInfo[playerid][pWins] == 300)
{
SendClientMessage(playerid, Azul, "[ {32CD32}UP{FFFFFF} ] Voce subiu de rank.");
SendClientMessage(playerid, Azul,"{32CD32}•{FFFFFF} Rank atual: Old Driver");
}
else if(PlayerInfo[playerid][pWins] == 500)
{
SendClientMessage(playerid, Azul, "[ {32CD32}UP{FFFFFF} ] Voce subiu de rank.");
SendClientMessage(playerid, Azul,"{32CD32}•{FFFFFF} Rank atual: High Driver");
}
return 1;
}