08.08.2015, 14:26
salva ao desconectar
dб o admin
PHP код:
public OnPlayerDisconnect(playerid)
{
// admin
new arquiva[34], playernome[MAX_PLAYER_NAME];
GetPlayerName(playerid, playernome, sizeof(playernome));
format(arquiva, sizeof(arquiva), "Admins/%s.ini", playernome);
if(DOF2_FileExists(arquiva))
{
DOF2_SetInt(arquiva, "Level", pAdmin[playerid][Level]);
DOF2_SaveFile();
}
else
{
DOF2_CreateFile(arquiva);
DOF2_SetInt(arquiva, "Level", pAdmin[playerid][Level]);
DOF2_SaveFile();
}
// admin
return 1;
}
PHP код:
CMD:setadmin(playerid, params[])
{
new id, level, string[256], string2[256], ganhou[MAX_PLAYER_NAME], deu[MAX_PLAYER_NAME];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xAD0000AA, "{00E5FF}Vocк nгo estб autorizado.");
if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, 0xAD0000AA, "Use /daradmin [ID] [LEVEL]");
if (level < 0 || level > 6) return SendClientMessage(playerid, 0xFF0000FF, "Level invбlido. Use de 1 б 6 .");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xAD0000AA, "Este jogador nгo estб online.");
GetPlayerName(id, ganhou, sizeof(ganhou));
GetPlayerName(playerid, deu, sizeof(deu));
format(string, sizeof(string), "Vocк deu admin level %s para o %s", GetLevelAdmin(level), ganhou);
SendClientMessage(playerid, 0x00F6F6AA, string);
format(string2, sizeof(string2), "O admin %s deu admin level %s para vocк.", deu , GetLevelAdmin(level));
SendClientMessage(id, VERDE, string2);
pAdmin[id][Level] = level;
return 1;
}