Comandos Bбsicos de Administradores
#9

Jason voce pode fazer assim

pawn Код:
stock pNome(playerid)
{
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid,nome,sizeof(nome));
    return nome;
}
enum Info
{
    pAdmin
}
new PlayerInfo[MAX_PLAYERS][Info];
public OnPlayerCommandText(playerid,cmdtext)
{
    new tmp[256];
    new idx;
    if(strcmp(cmd,"/daradmin",true) == 0)
    if(strcmp(pNome(playerid),"Jason_King",true) == 0)//pra voce poder usar sem ser admin
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid,0xFFFFFFAA,"Use /DarAdmin [ID/Nome][AdminLevel]");
        new admin = strval(tmp);
        new adminame[MAX_PLAYER_NAME];
        GetPlayerName(admin,adminname,sizeof(adminame));
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid,0xFFFFFFAA,"Use /DarAdmin [ID/Nome][AdminLevel]");
        new adminlevel = strval(tmp);
        if(adminlevel < 0 || adminlevel > 1342) return SendClientMessage(playerid,0xFFFFFFAA,"Admin Mбximo 1342, Mнnimo 0");
        PlayerInfo[admin][pAdmin] = adminlevel;
        new string[256];
        format(string,sizeof(string),"Vocк promoveu %s para o nнvel %d de Admin",adminname,adminlevel);
        SendClientMessage(playerid,0xFFFFFFAA,string);
        format(string,sizeof(string),"Vocк foi promovido a nнvel %d de Admin por %s",adminlevel,pNome(playerid))
        SendClientMessage(admin,0xFFFFFFAA,string);
        return 1;
    }
    return 0;
}
Lembre-se de no fim do GM colocar

pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Ai pra ter o salvamento do Admin voce adiciona a linha Admin no seu sistema de registro com salvamento de contas e poe pra salvar o PlayerInfo[playerid][pAdmin].

Espero que te sirva
Reply


Messages In This Thread
Comandos Bбsicos de Administradores - by Jason` - 30.09.2011, 05:53
Re: Comandos Bбsicos de Administradores - by Lipe_Stronda - 30.09.2011, 12:31
Re: Comandos Bбsicos de Administradores - by Jason` - 30.09.2011, 16:01
Re: Comandos Bбsicos de Administradores - by Jason_King - 30.09.2011, 16:05
Re: Comandos Bбsicos de Administradores - by Leeo_Perez - 30.09.2011, 16:07
Re : Comandos Bбsicos de Administradores - by [NWD]Jim._.Carrey - 30.09.2011, 16:15
Re: Comandos Bбsicos de Administradores - by Bruno Pereira - 30.09.2011, 16:21
Re: Comandos Bбsicos de Administradores - by Vai_Besta - 30.09.2011, 16:51
Re: Comandos Bбsicos de Administradores - by Jason` - 30.09.2011, 17:10
Re: Comandos Bбsicos de Administradores - by Jason_King - 30.09.2011, 18:03

Forum Jump:


Users browsing this thread: 1 Guest(s)