ajuda Comando
#1

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.
Reply
#2

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;
    }
Reply
#3

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.
Reply
#4

Vlw galera <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)