pawn Код:
//No topo!
enum Info
{
AdminLevel,
}
new PlayerInfo[MAX_PLAYERS][Info];
//No comando
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/daradmin", true) == 0)
{
new string[128];
new tmp[256];
new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
new giveplayerid;
if (IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "Use: /daradmin <ID> <Level>");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
new level = strval(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, player, sizeof(player));
PlayerInfo[giveplayerid][AdminLevel] = level;
printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
format(string, sizeof(string), "Vocк agora й admin level %d agradeзa ao %s.", level, player);
SendClientMessage(giveplayerid, 0x00C2ECFF, string);
format(string, sizeof(string), "Vocк deu a %s level %d de admin.", giveplayer,PlayerInfo[giveplayerid][AdminLevel]);
SendClientMessage(playerid, 0x00C2ECFF, string);
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%i nгo esta ativo!.", giveplayerid);
SendClientMessage(playerid, 0xE60000FF, string);
}
}
else
{
SendClientMessage(playerid, 0xE60000FF, "Vocк nгo esta logado na Rcon!");
}
return 1;
}
Nesse comando, vocк poderб adcionar um certo player a um certo level, porйm й necessбrio esta logado na rcon!
Agora para nunca mais na vida vocк usar a Rcon, usa o Dini pra salvar, desse jeito!
pawn Код:
#include <Dini>
//OnGameModeInit
if(!fexist("admins.dll")) dini_Create("admins.dll");
//OnPlayerDisconnect
dini_IntSet("admins.dll",PlayerName(playerid),AdminLevel[playerid]);
//OnPlayerConect
if(dini_Isset("admins.dll",PlayerName(playerid))) AdminLevel[playerid] = (playerid,dini_Int("admins.dll",PlayerName(playerid)));
//No final do GM
stock PlayerName(playerid)
{
new PlayerNameLevel[MAX_PLAYERS];
GetPlayerName(playerid, PlayerNameLevel, MAX_PLAYERS);
return PlayerNameLevel;
}
Se nгo funfa falar, porque sou iniciante!
Credito:
WikiSamp:Comando!
Drakon:Tutorial Dini!