04.03.2014, 09:44
pawn Код:
if (!strcmp("/settaadmin", cmdtext, true, 11))
{
new id;
if (pInfo[playerid][Admin] < 5 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "ERROR: You are not a level 5 admin!");
if (sscanf(cmdtext[12], "ui", id, level))
{
SendClientMessage(playerid, LBLUE, "Usage: /setlevel (playerid) (level)") &&
return SendClientMessage(playerid, GREEN, "Function: Set a person a admin");
}
if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "ERROR: That is a invalid player ID");
new str[100];
format(str, sizeof (str), "UPDATE `playerinfo` SET `Admin` = %d WHERE `User` = '%s'", level, pName(id));
// ??? Execute query
format(str, sizeof (str), "|- Administrator %s has made %s (%d) admin level %d -|", pName(playerid), pName(id), id, level);
PlayerInfo[id][Admin] = level; // setting the level of the "id", not "playerid" as you wrote.
return 1;
}