SA-MP Forums Archive
[Ajuda] Comando - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Comando (/showthread.php?tid=604477)



Comando - Vegassilva - 05.04.2016

Estou tentando fazer um cmd ele funciona assim, se um player digitar /verx1, ele irб ficar esperando atй outro player digitar /verx1, ou seja qnd 2 digitar o msm cmd, os 2 irгo teleportar para um local.

PHP код:
new bool:Player01[MAX_PLAYERS];
new 
Player02;
 
CMD:verx1(playerid)
{
    
Player01[playerid] = true;
   
    
Player02 ++;
   
    for(new 
0<= MAX_PLAYERS++)
    {
        if(
Player01[playerid] == true)
        {
            if(
Player01[i] == true)
            {
                if(
Player02 == 2)
                {
                    
SetPlayerInterior(playerid1);
                    
SetPlayerInterior(i1);
                    
SetPlayerPos(playerid1416.107000,0.268620,1000.926000);
                    
SetPlayerPos(i1416.107000,0.268620,1000.926000);
                }
            }
        }
    }
    return 
1;




Re: [Ajuda] Comando - F1N4L - 05.04.2016

@EDITED


PHP код:
new bool:Player01[MAX_PLAYERS]; 
new 
Player02
  
CMD:verx1(playerid

    
Player01[playerid] = true
    
    
Player02 ++; 
    
    for(new 
0<= MAX_PLAYERS++) 
    { 
        if(
Player01[playerid] == true && Player01[i] == true && Player02 == 2
        { 
             
SetPlayerInterior(i1); 
             
SetPlayerPos(i1416.107000,0.268620,1000.926000); 
             
Player02 0;
        } 
        else 
SendClientMessage(playerid, -1"Aguarde +1 player.");
        break;
    } 
    return 
1

Lembre-se que quando um x1 iniciar, automaticamente a var Player02 serб setada em 0 e outros 2 player poderгo iniciar um outro duelo!


Re: [Ajuda] Comando - Vegassilva - 05.04.2016

Esta fazendo um loop infinito de mensagem, veja no print, e tbm qnd eu digito novamente eu msm que estou teleportando.

http://i.imgur.com/tRgePd1.png


Re: [Ajuda] Comando - F1N4L - 05.04.2016

Quote:
Originally Posted by Vegassilva
Посмотреть сообщение
Esta fazendo um loop infinito de mensagem, veja no print, e tbm qnd eu digito novamente eu msm que estou teleportando.

http://i.imgur.com/tRgePd1.png
Estude loop. Post editado.


Re: [Ajuda] Comando - cicinho - 05.04.2016

@Vegassilva, funcional.

PHP код:
new bool:PlayerInX1[MAX_PLAYERS],
    
Players;

CMD:verx1(playerid)
{
    if(
PlayerInX1[playerid] == true)
        return 
SendClientMessage(playerid0xFF0000FF"[ERRO] Voce jб estб na fila de x1.");

    
Players++;
    
PlayerInX1[playerid] = true;
    
    if(
Players == 2)
    {
        for(new 
iMAX_PLAYERSi++)
        {
            if(
PlayerInX1[i] == true)
            {
                
SetPlayerPos(i0.00.00.0);
                
SetPlayerInterior(i0);
                
Players=0;
            }
        }
    }else 
SendClientMessage(playerid0xFFFFFFFF"[INFO X1] Aguarde outro jogador.");

    return 
true;




Re: [Ajuda] Comando - F1N4L - 05.04.2016

Quote:
Originally Posted by cicinho
Посмотреть сообщение
@Vegassilva, funcional.

PHP код:
new bool:PlayerInX1[MAX_PLAYERS],
    
Players;
CMD:verx1(playerid)
{
    if(
PlayerInX1[playerid] == true)
        return 
SendClientMessage(playerid0xFF0000FF"[ERRO] Voce jб estб na fila de x1.");
    
Players++;
    
PlayerInX1[playerid] = true;
    
    if(
Players == 2)
    {
        for(new 
iMAX_PLAYERSi++)
        {
            if(
PlayerInX1[i] == true)
            {
                
SetPlayerPos(i0.00.00.0);
                
SetPlayerInterior(i0);
                
Players=0;
            }
        }
    }else 
SendClientMessage(playerid0xFFFFFFFF"[INFO X1] Aguarde outro jogador.");
    return 
true;

O seu estб mais trabalhado, nгo faz do meu infuncional, pois o loop sу para depois da condicional. Ambos sгo funcionais.


Re: [Ajuda] Comando - cicinho - 05.04.2016

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
O seu estб mais trabalhado, nгo faz do meu infuncional, pois o loop sу para depois da condicional. Ambos sгo funcionais.
Ue kk, nгo falei nada em relaзгo ao seu script.


Re: [Ajuda] Comando - F1N4L - 05.04.2016

Quote:
Originally Posted by cicinho
Посмотреть сообщение
Ue kk, nгo falei nada em relaзгo ao seu script.
Desculpa o mal-entendido '--', foi sу uma observaзгo.