18.01.2018, 14:11
Quote:
Otimizaзгo, jovem.
Code:
CMD:setadmin(playerid, params[]) { new id, level, string[200], pname[20], iname[20], file[50]; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Comando invбlido."); if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Use: /setadmin [id] [level 0-4]"); if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Esse ID nгo conectado."); if(level > 4 || level < 0) return SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Apenas leveis de 0 a 4."); format(file, sizeof(file), "Contas/%s.ini", iname); GetPlayerName(playerid, pname, 20); GetPlayerName(id, iname, 20); if(level > 0) { format(string, sizeof(string), "| Admin | Vocк promoveu o(a) jogador(a) %s(%d) a Administrador(a).", iname, id); SendClientMessage(playerid, 0xFF0000AA, string); format(string, sizeof(string), "| Admin | Vocк foi promovido(a) a Administrador(a) pelo(a) Dono(a) %s(%d)", pname, playerid); SendClientMessage(id, 0xFF0000AA, string); } else { format(string, sizeof(string), "| Admin | Vocк removeu o(a) jogador(a) %s(%d) da Staff.", iname, id); SendClientMessage(playerid, 0xFF0000AA, string); format(string, sizeof(string), "| Admin | Vocк foi removido(a) da Staff pelo(a) Dono(a) %s(%d).", pname, playerid); SendClientMessage(id, 0xFF0000AA, string); } DOF2_SetInt(file, "CargoAdm", level); DOF2_SaveFile(); pAdmin[id] = level; return 1; } |