12.02.2014, 17:42
tenta se basear nesse cmd
pawn Код:
dcmd_unbanacc(playerid, params[])
{
if (PlayerInfo[playerid][Level] < 4) return SendClientMessage(playerid, red, "[ERRO]: Vocк nгo tem permissгo para isso");
if (strlen(params) < 3) return SendClientMessage(playerid, red, "USO: /unbanacc [NICK]");
if (IsIllegalName(params)) return SendClientMessage(playerid, red, "[ERRO]: Nick ilegal");
if (!udb_Exists(params)) return SendClientMessage(playerid, red, "[ERRO]: A conta nгo existe");
if (PlayerInfo[playerid][Level] < 5)
{
if (dUserINT(params).("level") >= 1) return SendClientMessage(playerid, red, "[ERRO]: A conta pertence a um ADMIN");
}
if (dUserINT(params).("banned") == 0 && dUserINT(params).("tmpb") == 0) return SendClientMessage(playerid, red, "[ERRO]: A conta nгo estб banida");
dUserSetINT(params).("banned", 0);
if (dUserINT(params).("tmpb") == 1)
{
dUserSetINT(params).("tmpb", 0);
dUserSetINT(params).("tmpbs", 0);
dUserSetINT(params).("tmpbh", 0);
}
new SampDotBan[128], file[255];
format(file, sizeof(file), "/ladmin/users/%s.sav", udb_encode(params));
new tmp2[256];
tmp2 = dini_Get(file, "ip");
format(SampDotBan, sizeof(SampDotBan), "unbanip %s", tmp2);
SendRconCommand(SampDotBan);
SendRconCommand("reloadbans");
if (dUserINT(params).("banned") == 0)
{
CMDMessageToAdmins(playerid, "UNBANACC");
//--------------- LOGAR
new ADMNAME[MAX_PLAYER_NAME];
GetPlayerName(playerid, ADMNAME, MAX_PLAYER_NAME);
new logstring[128];
format(logstring, sizeof(logstring), "%s desbaniu a conta + IP de %s", ADMNAME, params);
SaveToFile("UnbannedAccs", logstring);
//---------------
SendClientMessage(playerid, blue, "A conta e o IP associado foram desbanidos com sucesso!");
}
else
{
SendClientMessage(playerid, blue, "Erro ao desbanir a conta");
}
return 1;
}