[Tutorial] Iniciantes: Criando Comandos Simples
#10

Quote:
Originally Posted by Dr_Pawno
Посмотреть сообщение
Exemplo:
pawn Код:
new pLevel[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/MeuComando", cmdtext, true) == 0)
    {
        if(pLevel == 1)
        {
            SendClientMessage(playerid, -1, "Vocк й level 1!");
        }
        else
        {
            SendClientMessage(playerid, -1, "Vocк nгo й level 1 para usar este comando.");
        }
        return true;
    }
    return false;
}
ou
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/MeuComando", cmdtext, true) == 0)
    {
        SendClientMessage(playerid, -1, "Vocк usou o comando: /MeuComando!");
        return true;
    }
    return false;
}
a variбvel pNivel nгo estб indexada a nenhuma array.
assim darб erro, aconselho fazer:
pawn Код:
new pLevel[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/MeuComando", cmdtext, true) == 0)
    {
        if(pLevel[playerid] == 1)
        {
            SendClientMessage(playerid, -1, "Vocк й level 1!");
        }
        else
        {
            SendClientMessage(playerid, -1, "Vocк nгo й level 1 para usar este comando.");
        }
        return true;
    }
    return false;
}
Continuando ...

esta й uma correзгo sem prestar a atenзгo.
tutorial ele EXPLICA COMO FAZ e nгo explica PRA QUE SERVE A FUNЗГO.

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
-1 indica a cor que a mensagem terб ao ser enviada ao jogador. Neste caso, ela serб branca.

#TOPIC

Bom tutorial.

OBS: Nгo existe sу o for para fazer loop. Tem tambйm o while e outras formas.
existe vбrias formas de fazer-se um loop., mais a mais rбpida й o loop comum.
pawn Код:
new i;
do
{
      printf(i);
      ++i;
}
while(i <= GetMaxPlayers());
loop com do while.

pawn Код:
new i;
public OnPlayerUpdate(playerid)
{
     if(!strcmp(i,GetMaxPlayers())) return 0;    
     return ++i, OnPlayerUpdate(playerid), true;
}
/\ esta eu nгo recomendo usar, pois lagaria seu sever -troll
Reply


Messages In This Thread
Iniciantes: Criando Comandos Simples - by Dr_Pawno - 02.07.2011, 02:34
Re: Iniciantes: Criando Comandos Simples - by Transferencia - 02.07.2011, 02:42
Re: Iniciantes: Criando Comandos Simples - by Shadoww5 - 02.07.2011, 02:47
Re: Iniciantes: Criando Comandos Simples - by Dr_Pawno - 02.07.2011, 02:51
Re: Iniciantes: Criando Comandos Simples - by demonneni - 02.07.2011, 02:54
Re: Iniciantes: Criando Comandos Simples - by Transferencia - 02.07.2011, 02:57
Re: Iniciantes: Criando Comandos Simples - by Andrew_Guiga - 02.07.2011, 03:09
Re: Iniciantes: Criando Comandos Simples - by Macintosh - 02.07.2011, 03:27
Re: Iniciantes: Criando Comandos Simples - by Dr_Pawno - 02.07.2011, 04:05
Re: Iniciantes: Criando Comandos Simples - by TheGarfield - 02.07.2011, 04:06

Forum Jump:


Users browsing this thread: 3 Guest(s)