15.08.2018, 07:53
This will work
PHP код:
CMD:setadmin(playerid, params[])
{
new playerID, parameter, adminastring[128];
if(!IsPlayerAdmin(playerid)) return SendErrorMessage(playerid, "Nincs jogosultsбgod a parancs hasznбlatбhoz.");
if(PlayerInfo[playerid][pAdmin] < 4) return SendErrorMessage(playerid, "Nincs jogosultsбgod a parancs hasznбlatбhoz.");
if(sscanf(params, "ui", playerID, parameter))
{
SendUsageMessage(playerid, "/setadmin [jбtйkos ID VAGY nйv] [szint]");
SendServerMessage(playerid, "1 = 1*Admin, 2 = 2*Admin, 3 = 3*Admin, 4 = 4*Admin");
return 1;
}
if(parameter < 0 || parameter > 5) return SendErrorMessage(playerid, "Helytelen paramйterek.");
if(!IsPlayerConnected(playerID)) return SendErrorMessage(playerid, "A megadott jбtйkos nem elйrhető.");
format(adminastring, sizeof(adminastring), "AdmCmd: (%s) megvбltoztatta (%s) admin szintjйt (%i)-re.", ReturnName(playerid), ReturnName(playerID), parameter);
SendClientMessageToAllEx(COLOR_RED, adminastring);
format(adminastring, sizeof(adminastring), "Admin szinted megvбltozott. Mostantуl a szinted (%i) (%s)-бttal.", parameter, ReturnName(playerid));
SendClientMessage(playerID, COLOR_GREEN, adminastring);
PlayerInfo[playerID][pAdmin] = parameter;
SaveCharacter(playerid);
return 1;
}