[AJUDA] Comandos /kick e /ban
#8

Coloque isso no game mode pra nгo precisar ficar dando GetPlayerName em si mesmo:

pawn Код:
stock pNome(playerid)
{
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nome, sizeof(nome));
    return nome;
}
Agora:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext)
{
    new tmp[256];//ainda nao entendo mto quanto as celulas
    new idx;
    new string[256]//nao entendo mto quanto as celular
    if(strcmp(cmdtext,"/ban",true) == 0)
    {
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid,0xFFFFFFAA,"Use /Ban [ID/Nome][Motivo]");
            return 1;
        }
        new banido = strval(tmp);
        new banidoname[MAX_PLAYER_NAME];
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[256];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        if(!strlen(result))
        {
            SendClientMessage(playerid,BRANCO,"Use /Ban [ID/Nome][Motivo]");
            return 1;
        }
        GetPlayerName(banido,banidoname,sizeof(banidoname));
        format(string,sizeof(string),"%s Foi Banido Pelo Admin %s, Motivo: %s",banidoname,pNome(playerid),result);
        SendClientMessageToAll(0xFFFFFFAA,string);
        Ban(banido);
        return 1;
    }
    if(strcmp(cmdtext,"/kick",true) == 0)
    {
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid,0xFFFFFFAA,"Use /Kick [ID/Nome][Motivo]");
            return 1;
        }
        new kickado = strval(tmp);
        new kickadoname[MAX_PLAYER_NAME];
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[256];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        if(!strlen(result))
        {
            SendClientMessage(playerid,BRANCO,"Use /Kick[ID][Motivo]");
            return 1;
        }
        GetPlayerName(kickado,kickadoname,sizeof(kickadoname));
        format(string,sizeof(string),"%s Foi Kickado Pelo Admin %s, Motivo: %s",kickadoname,pNome(playerid),result);
        SendClientMessageToAll(0xFFFFFFAA,string);
        return 1;
    }
    return 0;
}
Tente Isso!
Reply


Messages In This Thread
[AJUDA] Comandos /kick e /ban - by Niko_Bellik - 29.09.2011, 16:38
Respuesta: [AJUDA] Comandos /kick e /ban - by ReDKiiL - 29.09.2011, 16:46
Re: Respuesta: [AJUDA] Comandos /kick e /ban - by Niko_Bellik - 29.09.2011, 17:12
Respuesta: [AJUDA] Comandos /kick e /ban - by ReDKiiL - 29.09.2011, 17:19
Re: [AJUDA] Comandos /kick e /ban - by CyNiC - 29.09.2011, 17:22
Re: Respuesta: [AJUDA] Comandos /kick e /ban - by Niko_Bellik - 29.09.2011, 17:57
Respuesta: [AJUDA] Comandos /kick e /ban - by ReDKiiL - 29.09.2011, 18:25
Re: [AJUDA] Comandos /kick e /ban - by Jason` - 29.09.2011, 18:29
Re: [AJUDA] Comandos /kick e /ban - by Niko_Bellik - 29.09.2011, 18:52
Re: [AJUDA] Comandos /kick e /ban - by Lipe_Stronda - 29.09.2011, 18:55

Forum Jump:


Users browsing this thread: 3 Guest(s)