20.06.2012, 02:16
I use sqlite, and I've been spending a lot of time trying to figure out why the admin level will not update. I am level 5 admin IG (set from DB) and I am make admining myself to 0 which works fine, but when I disconnect and reconnect I am back to being a level 5 admin. Any ideas why this isn't updating?
Quote:
public OnPlayerDisconnect(playerid, reason) { new query[400], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(query, sizeof(query), "UPDATE `USERS` SET SCORE = '%d', ADMIN = '%d' WHERE `NAME` = '%s'", PlayerInfo[playerid][pScore], PlayerInfo[playerid][pAdmin]); db_query(Database, query); return 1; } |
Quote:
CMD:makeadmin(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, COLOR_CMDHELP,"ErRor: You are not authorized to use this"); new id, level; if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, COLOR_CMDHELP, "Usage: /makeadmin [PlayerID/PartOfName] [Level]"); else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_CMDHELP, "ERor: Invalid [PlayerID/PartOfName]"); else if(level > 5) return SendClientMessage(playerid, COLOR_CMDHELP, "ErrOr: An admin level cannot be higher then 5!"); else { PlayerInfo[id][pAdmin] = level; } return 1; } |