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=206967)



ajuda Comando - [GET]Vidaloka - 04.01.2011

O que hб de errado neste comando:

pawn Код:
if(strcmp(cmdtext,"/evida",true)==0)
{
new tmp2[256];
if(EventoCriado == 1)
{
tmp2 = strtok(cmdtext, idx);
new vida = strval(tmp2);
if(!strlen(tmp2))
{
SendClientMessage(playerid, 0x3321FFFF, "|INFO| Digite a quantidade de Vida.");
return 1;
}
for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(SistemaEvento[playerid][Entrar] == true)
{
SetPlayerHealth(possiveis,vida);
}
new AdminNome[256],
Admin[MAX_PLAYER_NAME];
GetPlayerName(playerid,Admin,sizeof Admin);
format(AdminNome, 128, "~ [Evento] > O Administrador %s setou a vida de todos que estгo no evento para %d.", Admin,vida);
SendClientMessageToAll(0xfffe009b, AdminNome);
}
else
{
SendClientMessage(playerid,0x3321FFFF,"[ERRO]: Nenhum evento aberto.");
}
return 1;
}
quando eu coloco /evida 50 por exemplo fala que o comando nгo existe,e quando eu coloco apenas /evida pede pra eu digitar a quantidade de vida. Se alguйm poder me ajudar agradeзo muito.


Re: ajuda Comando - [NWD]Jim._.Carrey - 05.01.2011

Tenta assim:

pawn Код:
if(strcmp(cmd, "/evida", true) ==0)
    {
        new tmp2[256];
        if(EventoCriado == 1)
        {
            SendClientMessage(playerid,0x3321FFFF,"[ERRO]: Nenhum evento aberto.");
            return 1;
        }
        tmp2 = strtok(cmdtext, idx);
        new vida = strval(tmp2);
        if(!strlen(tmp2))
        {
            SendClientMessage(playerid, 0x3321FFFF, "|INFO| Digite a quantidade de Vida.");
            return 1;
        }
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(SistemaEvento[playerid][Entrar] == true)
            {
                SetPlayerHealth(i, vida);
            }
        }
        new AdminNome[256],
        Admin[MAX_PLAYER_NAME];
        GetPlayerName(playerid,Admin,sizeof Admin);
        format(AdminNome, 128, "~ [Evento] > O Administrador %s setou a vida de todos que estгo no evento para %d.", Admin,vida);
        SendClientMessageToAll(0xfffe009b, AdminNome);
        return 1;
    }



Re: ajuda Comando - ManoLexuS - 05.01.2011

Se vocк ainda nao tiver isso em OnPlayerCommandText, coloque:
Код:
new cmd[256];
cmd = strtok(cmdtext, idx);
Depois, onde vc quiser, em onplayercommandtext, vc coloca seu comando, mas com o seguinte cabeзalho:
Ao invйs de:
Код:
if(strcmp(cmdtext,"/evida",true)==0)
Coloque:
Код:
if(strcmp(cmd, "/evida", true) == 0)
Ahh, que eu saiba, o "for(new...." precisa abrir "{" e depois fechar "}", no seu caso ficaria assim:
Код:
for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) 
{
if(SistemaEvento[playerid][Entrar] == true)
{
SetPlayerHealth(possiveis,vida);
}
}
Acho que й isso. Espero ter ajudado. Nгo testei, mas acho que tб certo.


Re: ajuda Comando - [GET]Vidaloka - 05.01.2011

Vlw galera <3