[AJUDA] /desafio
#1

O Objetivo do comando й que quando um player desse /desafio apareзesse uma mensagem pra membros das orgs de corrida pra irem ao estacionamento , e quando chegassem lб , esses membros dariam /participar , e ai depois de tipo 3 minutos a corrida comeзaria e iria atй um dos pontos determinados por mim .

Dъvida de como adicionar os pontos e faze-los serem sorteados , e como fazer o comando pegar .

Eu tentei fazer aqui algo mas nгo deu muito certo

pawn Code:
// Inicio GM
new donoestacionamento;
new GZCorredores;
new DESAFIO[MAX_PLAYERS];
new PARTICIPANDOCORRIDA[MAX_PLAYERS];
new TempoIniciarCorrida;
forward Corrida(playerid);

//OnGamemodeinit

GZCorredores = GangZoneCreate(2648.871582, -1867.313110, 2824.871582, -1675.313110);
donoestacionamento = 0;


//OnPlayerConnect

if(donoestacionamento == 0)
{
GangZoneShowForPlayer(playerid, GZCorredores, 0xC0C0C0AA);
}
if(donoestacionamento == 1)
{
GangZoneShowForPlayer(playerid, GZCorredores, -16777017);
}
if(donoestacionamento == 2)
{
GangZoneShowForPlayer(playerid, GZCorredores, -8388424);
}
// OnPlayerCommandText

if(strcmp(cmd, "/desafio", true) == 0)
{
if(PlayerToPoint(5.0 , playerid , 2740.2791,-1862.6315,9.2958))
    {
        if(PlayerInfo[playerid][pRank] >= 4 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pLeader] == 16)
        {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        DESAFIO[playerid] = 1;
        format(string, sizeof(string), "%s lanзou um desafio.",sendername);
        Mensagemcorredores(COLOR_LIGHTBLUE,string);
        }
                    }
    return 0;
    }
if(strcmp(cmd,"/participar",true) == 0)
{
if(PlayerInfo[playerid][pRank] >= 4 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pLeader] == 16)
{
if(PlayerToPoint(5.0 , playerid , 2740.2791,-1862.6315,9.2958))
{
if(DESAFIO[playerid] == 1)
{
PARTICIPANDOCORRIDA[playerid] = 1;
TempoIniciarCorrida = SetTimerEx("Corrida", 300000, 0 , "i", playerid);
SendClientMessage(playerid, COLOR_WHITE , "Vocк irб participar da corrida aguarde atй comeзar");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "Nenhum desafio foi lanзado");
}
return 1;
}

public Corrida(playerid)
{
SetPlayerCheckpoint(playerid,-1027.4022,-672.5286,31.6657 , 5 );
SendClientMessage(playerid,COLOR_YELLOW, " A Corrida comeзou vб atй o ponto vermelho para ganhar !" );
}
if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10)
{
 if(PARTICIPANDOCORRIDA[playerid] == 1)
{
 if(IsPlayerInCorrida1(playerid))
 {
   new string[56];
      format(string, sizeof(string), "[TERRITУRIO]%s e os fast and furious dominaram o estacionamento.");
      SendClientMessageToAll(COLOR_YELLOW, string);
      GangZoneShowForPlayer(playerid, GZCorredores, -16777017);
      donoestacionamento = 1;
      DisablePlayerCheckPoint(playerid);
      DESAFIO[playerid] = 0;
      PARTICIPANDOCORRIDA[playerid] = 0;
      KillTimer(Corrida);
}
}
}
if(PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
{
 if(PARTICIPANDOCORRIDA[playerid] == 1)
{
 if(IsPlayerInCorrida1(playerid))
 {
   new string[56];
      format(string, sizeof(string), "[TERRITУRIO]%s e os asphalt kings dominaram o estacionamento.");
      SendClientMessageToAll(COLOR_YELLOW, string);
      GangZoneShowForPlayer(playerid, GZCorredores, -8388424);
      donoestacionamento = 2;
      DisablePlayerCheckPoint(playerid);
      DESAFIO[playerid] = 0;
      PARTICIPANDOCORRIDA[playerid] = 0;
      KillTimer(Corrida);
}
}




//Fim do gm

stock IsPlayerInCorrida1(playerid)
{
if(PlayerToPoint(3.0 , -1027.4022,-672.5286,31.6657); return 1;
else return 0;
}
Reply
#2

Usa Random.
Reply
#3

Pode explicar melhor o que quer?
Reply
#4

Se o erro for por eles nгo conseguirem participar..
Vocк colocou /dominar, assim o cara comeзa a dominar SУ ELE pode /participar!
Por que? Porque vocк definiu DESAFIO[playerid] Entгo sу aquele PLAYERID pode ir no desafio.
Nгo use [MAX_PLAYERS]; use apenas um new! :>)
Reply
#5

Quote:
Originally Posted by Diogo_Bras
View Post
Pode explicar melhor o que quer?
Eu queria por exemplo , o cara da org de corrida tб no estacionamento que й uma gz , ele dб /desafio , e aparece uma mensagem pra os membros das orgs de corrida irem pra o estacionamento , entгo os membros dгo /participar , e comeзa uma corrida atй um ponto determinado por mim , sу que determinado de modo random , e quando chegasse no checkpoint dominaria a gz .

@Carl

Nem chega a compilar '-'
Reply
#6

Poderia fazer o sistema, mas, penso que vocк aprende melhor se ler e tentar interpretar.
https://sampforum.blast.hk/showthread.php?tid=214572 (nгo й bem um tuto nem um sistema avanзado, mas dб para perceber)
Reply
#7

Quote:
Originally Posted by Diogo_Bras
View Post
Poderia fazer o sistema, mas, penso que vocк aprende melhor se ler e tentar interpretar.
https://sampforum.blast.hk/showthread.php?tid=214572 (nгo й bem um tuto nem um sistema avanзado, mas dб para perceber)
Eu tentei , deu nisso aqui , mas nгo compila @_@

pawn Code:
// Inicio GM
new donoestacionamento;
new GZCorredores;
new DESAFIO[MAX_PLAYERS];
new PARTICIPANDOCORRIDA[MAX_PLAYERS];
new TempoIniciarCorrida[MAX_PLAYERS];
forward Corrida(playerid);

new Float:Checkpoints[17][3]= {//17=quantidades de checks | 3= as floats(x,y,z)
{2021.9279,851.2713,6.4387},
{1806.2888,851.1154,10.3762},
{1597.7745,850.9503,6.4374},
{1315.8704,886.0849,6.5154},
{1227.3850,1170.5470,6.5219},
{1228.7192,1804.4149,6.4378},
{1229.5260,2301.2026,6.4387},
{1447.5416,2452.2988,6.4377},
{1849.4731,2497.6997,6.5153},
{2287.5569,2607.9063,6.4585},
{2609.7202,2514.3423,5.8201},
{2706.6592,2158.3931,6.4492},
{2705.5173,1674.4374,6.4448},
{2706.8931,1278.5399,6.4373},
{2624.1135,932.2136,6.4433},
{2312.5583,854.1749,6.4375},
{2049.3154,853.4050,6.4387}
};  

//OnGamemodeinit

GZCorredores = GangZoneCreate(2648.871582, -1867.313110, 2824.871582, -1675.313110);
donoestacionamento = 0;


//OnPlayerConnect

if(donoestacionamento == 0)
{
GangZoneShowForPlayer(playerid, GZCorredores, 0xC0C0C0AA);
}
if(donoestacionamento == 1)
{
GangZoneShowForPlayer(playerid, GZCorredores, -16777017);
}
if(donoestacionamento == 2)
{
GangZoneShowForPlayer(playerid, GZCorredores, -8388424);
}
// OnPlayerCommandText

if(strcmp(cmd, "/desafio", true) == 0)
{
if(PlayerToPoint(5.0 , playerid , 2740.2791,-1862.6315,9.2958))
    {
        if(PlayerInfo[playerid][pRank] >= 4 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pLeader] == 16)
        {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        DESAFIO[playerid] = 1;
        format(string, sizeof(string), "%s lanзou um desafio.",sendername);
        Mensagemcorredores(COLOR_LIGHTBLUE,string);
        }
                    }
    return 0;
    }
if(strcmp(cmd,"/participar",true) == 0)
{
if(PlayerInfo[playerid][pRank] >= 4 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pLeader] == 16)
{
if(PlayerToPoint(5.0 , playerid , 2740.2791,-1862.6315,9.2958))
{
if(DESAFIO[playerid] == 1)
{
PARTICIPANDOCORRIDA[playerid] = 1;
TempoIniciarCorrida = SetTimerEx("Corrida", 300000, 0 , "i", playerid);
SendClientMessage(playerid, COLOR_WHITE , "Vocк irб participar da corrida aguarde atй comeзar");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "Nenhum desafio foi lanзado");
}
return 1;
}
public Corrida(playerid)
{
SetPlayerRaceCheckpoint(i, 0, Checkpoints[1][0], Checkpoints[1][1], Checkpoints[1][2], Checkpoints[2][0], Checkpoints[2][1], Checkpoints[2][2], 10);//mostra o primeiro checkpoint para o player
SendClientMessage(playerid,COLOR_YELLOW, " A Corrida comeзou vб atй o ponto vermelho para ganhar !" );
}
OnPlayerEnterCheckPoint
{
    for(new i = 0; i < GetMaxPlayers(); i++)
         {
              if(IsPlayerConnected(i))
              {
     switch(DESAFIO[playerid])
     {

         case 0:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[0][0], Checkpoints[0][1], Checkpoints[0][2], Checkpoints[1][0], Checkpoints[1][1], Checkpoints[1][2], 10);
              DESAFIO[i] = 0;
              return 1;
         }
         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);
              DESAFIO[i] = 1;
              return 1;
         }
         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);
              DESAFIO[i] = 2;
              return 1;
         }
         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);
              DESAFIO[i] = 3;
              return 1;
         }
         case 4:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[4][0], Checkpoints[4][1], Checkpoints[4][2], Checkpoints[4][0], Checkpoints[4][1], Checkpoints[4][2], 10);
              DESAFIO[i] = 4;
              return 1;
         }
         case 5:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[5][0], Checkpoints[5][1], Checkpoints[5][2], Checkpoints[5][0], Checkpoints[5][1], Checkpoints[5][2], 10);
              DESAFIO[i] = 5;
              return 1;
         }
         case 6:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[6][0], Checkpoints[6][1], Checkpoints[6][2], Checkpoints[6][0], Checkpoints[6][1], Checkpoints[6][2], 10);
              DESAFIO[i] = 6;
              return 1;
         }
         case 7:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[7][0], Checkpoints[7][1], Checkpoints[7][2], Checkpoints[7][0], Checkpoints[7][1], Checkpoints[7][2], 10);
              DESAFIO[i] = 7;
              return 1;
         }
         case 8:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[8][0], Checkpoints[8][1], Checkpoints[8][2], Checkpoints[8][0], Checkpoints[8][1], Checkpoints[8][2], 10);
              DESAFIO[i] = 8;
              return 1;
         }
         case 9:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[9][0], Checkpoints[9][1], Checkpoints[9][2], Checkpoints[9][0], Checkpoints[9][1], Checkpoints[9][2], 10);
              DESAFIO[i] = 9;
              return 1;
         }
         case 10:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[10][0], Checkpoints[10][1], Checkpoints[10][2], Checkpoints[10][0], Checkpoints[10][1], Checkpoints[10][2], 10);
              DESAFIO[i] = 10;
              return 1;
         }
         case 11:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[11][0], Checkpoints[11][1], Checkpoints[11][2], Checkpoints[11][0], Checkpoints[11][1], Checkpoints[11][2], 10);
              DESAFIO[i] = 11;
              return 1;
         }
         case 12:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[12][0], Checkpoints[12][1], Checkpoints[12][2], Checkpoints[12][0], Checkpoints[12][1], Checkpoints[12][2], 10);
              DESAFIO[i] = 12;
              return 1;
         }
         case 13:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[13][0], Checkpoints[13][1], Checkpoints[13][2], Checkpoints[13][0], Checkpoints[13][1], Checkpoints[13][2], 10);
              DESAFIO[i] = 13;
              return 1;
         }
         case 14:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[14][0], Checkpoints[14][1], Checkpoints[14][2], Checkpoints[14][0], Checkpoints[14][1], Checkpoints[14][2], 10);
              DESAFIO[i] = 14;
              return 1;
         }
         case 15:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[15][0], Checkpoints[15][1], Checkpoints[15][2], Checkpoints[15][0], Checkpoints[15][1], Checkpoints[15][2], 10);
              DESAFIO[i] = 15;
              return 1;
         }
         case 17:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SetPlayerRaceCheckpoint(playerid, 1, Checkpoints[16][0], Checkpoints[16][1], Checkpoints[16][2], Checkpoints[16][0], Checkpoints[16][1], Checkpoints[16][0], 10);
              DESAFIO[i] = 15;
              return 1;
         }
         case 16:
         {
if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10)
{
 if(PARTICIPANDOCORRIDA[playerid] == 1)
{
      new string[56];
      format(string, sizeof(string), "[TERRITУRIO]%s e os fast and furious dominaram o estacionamento.");
      SendClientMessageToAll(COLOR_YELLOW, string);
      GangZoneShowForPlayer(playerid, GZCorredores, -16777017);
      donoestacionamento = 1;
      DisablePlayerCheckPoint(playerid);
      DESAFIO[playerid] = 0;
      PARTICIPANDOCORRIDA[playerid] = 0;
      KillTimer(Corrida);
}
}
}
if(PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
{
 if(PARTICIPANDOCORRIDA[playerid] == 1)
{
   new string[56];
      format(string, sizeof(string), "[TERRITУRIO]%s e os asphalt kings dominaram o estacionamento.");
      SendClientMessageToAll(COLOR_YELLOW, string);
      GangZoneShowForPlayer(playerid, GZCorredores, -8388424);
      donoestacionamento = 2;
      DisablePlayerCheckPoint(playerid);
      DESAFIO[playerid] = 0;
      PARTICIPANDOCORRIDA[playerid] = 0;
      KillTimer(Corrida);
}
}
         } 
              return 1;
         }
     }
     }
     }
    return 0;
}
Reply
#8

Se o problema for de o pawn ficar fechando, deve ser algum " " com sendclientmessage ou algo parecido.
Este OnPlayerEnterCheckPoint nгo devia ter algum parametro
pawn Code:
(......)
Reply
#9

Eu usei o parametro (playerid) no onplayerentercheckpoint , mas o caso й que tб dando um monte de erro e warn
Reply
#10

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
   if(strcmp(cmd, "/desafio", true) == 0)
   {
        if(!IsPlayerInRangeOfPoint(playerid, 5.0 ,2740.2791,-1862.6315,9.2958)) return  SendClientMessage(playerid,0xFF0000AA," Vocк Nгo Esta No Local.");
        if(PlayerInfo[playerid][pRank] >= 4 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pLeader] == 16)
        {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        DESAFIO[playerid] = 1;
        format(string, sizeof(string), "%s lanзou um desafio.",sendername);
        Mensagemcorredores(COLOR_LIGHTBLUE,string);}
        return 1;
        }
        return 0;
}
Mano Organize Seu Cуdigo.

Lembre-se Que Toda Chave Que Abre Fecha. Por Isso da Vбrios Erros.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)