[Ajuda] Como criar um simples sistema de admin em DOF2
#1

Eu Vi essa : https://sampforum.blast.hk/showthread.php?tid=230868
Mais e em ZCMD & Dini , sу que eu uso DOF2 & STRCMP.
Preciso para min criar os comandos exemplo : "if(PlayerInfo[playerid][pAdmin] == 0) " "[pAdmin]" usar o comando
se alguem poder fazer uma base para min.
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=230868
https://sampforum.blast.hk/showthread.php?tid=405993

Quando aos comandos:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) {

    new comando[20], parametros[50];
    sscanf(cmdtext, "s[20]s[50]", comando, parametros);

    if(!strcmp(comando, "/seucomando", true)) {
   
        return 1;
    }
    return 0;
}
Reply
#3

Quote:
Originally Posted by iCasTiel
Посмотреть сообщение
https://sampforum.blast.hk/showthread.php?tid=230868
https://sampforum.blast.hk/showthread.php?tid=405993

Quando aos comandos:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) {

    new comando[20], parametros[50];
    sscanf(cmdtext, "s[20]s[50]", comando, parametros);

    if(!strcmp(comando, "/seucomando", true)) {
   
        return 1;
    }
    return 0;
}
Uso DOF2 para salvar....
Reply
#4

Quote:
Originally Posted by LE4NDrO
Посмотреть сообщение
Uso DOF2 para salvar....
pawn Код:
//Funзгo em dini:               A mesma funзгo em DOF2

dini_Exists                 DOF2_FileExists
dini_Remove                 DOF2_RemoveFile
dini_Create                 DOF2_CreateFile
dini_Set                    DOF2_SetString
dini_Get                    DOF2_GetString
dini_IntSet                 DOF2_SetInt
dini_Int                    DOF2_GetInt
dini_BoolSet                DOF2_SetBool
dini_Bool                   DOF2_GetBool
dini_FloatSet               DOF2_SetFloat
dini_Float                  DOF2_GetFloat
dini_Unset                  DOF2_Unset
dini_Isset                  DOF2_IsSet
Reply
#5

No topo do Gm:
pawn Код:
enum pDados {
   pAdmin
//Se quizer adiciona mais infos
};

new ArrayDados[MAX_PLAYERS][pDados];
Ai no comando, vc coloca os codigos dentro desse if:
pawn Код:
if(ArrayDados[playerid][pAdmin] > 0)//Se o lvl de adm for no minimo 1
{
   //coloque o comando aki
}
Reply
#6

Quote:
Originally Posted by Foodinha
Посмотреть сообщение
No topo do Gm:
pawn Код:
enum pDados {
   pAdmin
//Se quizer adiciona mais infos
};

new ArrayDados[MAX_PLAYERS][pDados];
Ai no comando, vc coloca os codigos dentro desse if:
pawn Код:
if(ArrayDados[playerid][pAdmin] > 0)//Se o lvl de adm for no minimo 1
{
   //coloque o comando aki
}
preciso que salve o level de admin.
Reply
#7

pawn Код:
public OnPlayerConnect(playerid) {

    new nome[24];
    GetPlayerName(playerid, nome, 24);
   
    new local_conta[35];
    format (local_conta, 35, "Contas/%s.ini", nome);
   
    if ( fexist(local_conta) )
        SetPVarInt(playerid, "nivel_admin", DOF2_GetInt(local_conta, "nivel_admin"));

    return 1;
}

public OnPlayerDisconnect(playerid, reason) {

    new nome[24];
    GetPlayerName(playerid, nome, 24);

    new local_conta[35];
    format (local_conta, 35, "Contas/%s.ini", nome);

    if ( !fexist(local_conta) )
        DOF2_CreateFile(local_conta);
       
    DOF2_SetInt(local_conta, "nivel_admin", GetPVarInt(playerid, "nivel_admin"));
    DOF2_SaveFile();
   
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[]) {

    new comando[20], parametros[50];
    sscanf(cmdtext, "s[20]s[50]", comando, parametros);

    if(!strcmp(comando, "/souadmin", true)) {

        if ( GetPVarInt(playerid, "nivel_admin") == 0 )
            SendClientMessage(playerid, -1, "Nгo!");
        else
            SendClientMessage(playerid, -1, "Sim!");
           
        return 1;
    }
    if(!strcmp(comando, "/pegaradmin", true)) {
   
        SetPVarInt(playerid, "nivel_admin", 1);
        SendClientMessage(playerid, -1, "Agora vocк й admin!");
        return 1;
    }
    return 0;
}

public OnGameModeExit() {

    DOF2_Exit();
    return 1;
}
Reply
#8

Quote:
Originally Posted by iCasTiel
Посмотреть сообщение
pawn Код:
public OnPlayerConnect(playerid) {

    new nome[24];
    GetPlayerName(playerid, nome, 24);
   
    new local_conta[35];
    format (local_conta, 35, "Contas/%s.ini", nome);
   
    if ( fexist(local_conta) )
        SetPVarInt(playerid, "nivel_admin", DOF2_GetInt(local_conta, "nivel_admin"));

    return 1;
}

public OnPlayerDisconnect(playerid, reason) {

    new nome[24];
    GetPlayerName(playerid, nome, 24);

    new local_conta[35];
    format (local_conta, 35, "Contas/%s.ini", nome);

    if ( !fexist(local_conta) )
        DOF2_CreateFile(local_conta);
       
    DOF2_SetInt(local_conta, "nivel_admin", GetPVarInt(playerid, "nivel_admin"));
    DOF2_SaveFile();
   
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[]) {

    new comando[20], parametros[50];
    sscanf(cmdtext, "s[20]s[50]", comando, parametros);

    if(!strcmp(comando, "/souadmin", true)) {

        if ( GetPVarInt(playerid, "nivel_admin") == 0 )
            SendClientMessage(playerid, -1, "Nгo!");
        else
            SendClientMessage(playerid, -1, "Sim!");
           
        return 1;
    }
    if(!strcmp(comando, "/pegaradmin", true)) {
   
        SetPVarInt(playerid, "nivel_admin", 1);
        SendClientMessage(playerid, -1, "Agora vocк й admin!");
        return 1;
    }
    return 0;
}

public OnGameModeExit() {

    DOF2_Exit();
    return 1;
}
[COLOR="rgb(139, 0, 0)"]Nгo aprendi ainda tem como juntar tudo o que eu tenho que fazer e por ? em DOF2 & STRCMP por favor
[/COLOR]
Reply
#9

Caramba.. Deram a soluзгo para vocк.. Oque custa estudar um pouco?

Conversгo DINI ~ DOF2:
pawn Код:
dini_Exists                 DOF2_FileExists
dini_Remove                 DOF2_RemoveFile
dini_Create                 DOF2_CreateFile
dini_Set                    DOF2_SetString
dini_Get                    DOF2_GetString
dini_IntSet                 DOF2_SetInt
dini_Int                    DOF2_GetInt
dini_BoolSet                DOF2_SetBool
dini_Bool                   DOF2_GetBool
dini_FloatSet               DOF2_SetFloat
dini_Float                  DOF2_GetFloat
dini_Unset                  DOF2_Unset
dini_Isset                  DOF2_IsSet
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)