[Ajuda] primeira colocaзao
#1

Tava criando um evento de corrida deu tudo certo so tem uma coisa errada queria que o ganhador fosse apenas o primeiro a chegar no ultimo checkpoint mas todos que tao chegando ganha.

pawn Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
   switch(Trocar[playerid])
    {
         case 1:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, CheckPoints[1][0], CheckPoints[1][1], CheckPoints[1][2], CheckPoints[2][0], CheckPoints[2][1], CheckPoints[2][2], 10);
              Trocar[playerid] = 2;
         }
         case 2:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, CheckPoints[2][0], CheckPoints[2][1], CheckPoints[2][2], CheckPoints[3][0], CheckPoints[3][1], CheckPoints[3][2], 10);
              Trocar[playerid] = 3;
         }
         case 3:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, CheckPoints[3][0], CheckPoints[3][1], CheckPoints[3][2], CheckPoints[4][0], CheckPoints[4][1], CheckPoints[4][2], 10);
              Trocar[playerid] = 4;
         }
         case 4:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, CheckPoints[4][0], CheckPoints[4][1], CheckPoints[4][2], CheckPoints[5][0], CheckPoints[5][1], CheckPoints[5][2], 10);
              Trocar[playerid] = 5;
         }
         case 5:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, CheckPoints[5][0], CheckPoints[5][1], CheckPoints[5][2], CheckPoints[6][0], CheckPoints[6][1], CheckPoints[6][2], 10);
              Trocar[playerid] = 6;
         }
         case 6:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, CheckPoints[6][0], CheckPoints[6][1], CheckPoints[6][2], CheckPoints[7][0], CheckPoints[7][1], CheckPoints[7][2], 10);
              Trocar[playerid] = 7;
         }
         case 7:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, CheckPoints[7][0], CheckPoints[7][1], CheckPoints[7][2], CheckPoints[8][0], CheckPoints[8][1], CheckPoints[8][2], 10);
              Trocar[playerid] = 8;
         }
         case 8:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, CheckPoints[8][0], CheckPoints[8][1], CheckPoints[8][2], CheckPoints[9][0], CheckPoints[9][1], CheckPoints[9][2], 10);
              Trocar[playerid] = 9;
         }
         case 9:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, CheckPoints[9][0], CheckPoints[9][1], CheckPoints[9][2], CheckPoints[10][0], CheckPoints[10][1], CheckPoints[10][2], 10);
              Trocar[playerid] = 10;
         }
         case 10:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, CheckPoints[10][0], CheckPoints[10][1], CheckPoints[10][2], END , END, END,10);
              Trocar[playerid] = 11;
              primeiro = 1;
         }
         case 11:
         {
            if(primeiro == 1)
            {
               new string[128];
               GetPlayerName(playerid, sendername, sizeof(sendername));
               format(string, sizeof(string), "Player %s Ganhou a corrida de Kart e recebeu R$80000!", sendername);
               SendClientMessageToAll(COLOR_LIGHTBLUE, string);
               SendClientMessage(playerid,0xFFFFFFAA," Vocк ganhou a corrida parabйns");
               GivePlayerMoney(playerid, 80000);
               DisablePlayerRaceCheckpoint(playerid);
               primeiro = 0;
               }
         }}
   return 1;
}
Reply
#2

use no ъltimo check
pawn Код:
primeiro++
e retire o
pawn Код:
primeiro = 0;
do final do code.

Nгo garanto que funcione... vou descansar e se nгo funcionar amanhг te ajudo.
Reply
#3

fico do mesmo geito mano :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)