Load admin level mysql +Rep
#1

I have a problem with my loading function...
It loads everything fine except the admin level.

When i make a player admin, I can use the admin commands... When I re-log I can still use the admin commands. Which works...

But when I restart the server, then suddenly it doesn't load the admin level anymore. In my database it still shows the correct admin level but if I type an admin command it says "You are not authorized to use that command."

Please can someone help me...
Will +Rep

Code:
Код:
stock LoadStats(playerid)
{
	new Query[1024];
	format(Query, sizeof(Query), "SELECT * FROM playerdata WHERE Name = '%s'", GetName(playerid));
	mysql_query(Query);
	mysql_store_result();
	mysql_fetch_row_format(Query, "|");
	sscanf(Query, "e<p<|>s[23]s[24]ddddfffdddddddddddd>",
	PlayerInfo[playerid][Name],
	PlayerInfo[playerid][Password],
	PlayerInfo[playerid][Cash],
	PlayerInfo[playerid][Bank],
	PlayerInfo[playerid][Level],
	PlayerInfo[playerid][Skin],
	PlayerInfo[playerid][PosX],
	PlayerInfo[playerid][PosY],
	PlayerInfo[playerid][PosZ],
	PlayerInfo[playerid][Int],
	PlayerInfo[playerid][VW],
	PlayerInfo[playerid][Job],
	PlayerInfo[playerid][Job2],
	PlayerInfo[playerid][Jail],
	PlayerInfo[playerid][Bail],
	PlayerInfo[playerid][Faction],
	PlayerInfo[playerid][FacRank],
	PlayerInfo[playerid][Phone],
	PlayerInfo[playerid][VIPLevel],
	PlayerInfo[playerid][Moderator],
	PlayerInfo[playerid][Admin]);

	mysql_free_result();
	return 1;
}
Код:
//Command I use to test it...
CMD:veh(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] < 4) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command-");
	if(carid2 > sizeof(AdminCars)-1) return SendClientMessage(playerid, COLOR_GRAD1, "You must use /vehdestroy because is now maximum Admin cars");
    new car, col1, col2, string[126];
    if(sscanf(params, "iii", car, col1, col2)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
    if(car < 400 || car > 611) return SendClientMessage(playerid, COLOR_GREY, "Vehicle number can't be below 400 or above 611!");
    if(col1 < 0 || col1 > 256) return SendClientMessage(playerid, COLOR_GREY, "Color number can't be below 0 or above 256!");
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X,Y,Z);
    AdminCars[carid2] = AddStaticVehicleEx(car, X+2,Y+2,Z+1, 0.0, col1, col2, 60000);
    format(string, sizeof(string), "Vehicle %d spawned.", AdminCars[carid2]);
    SendClientMessage(playerid, COLOR_GREY, string);
    ++carid2;
    return 1;
}

CMD:makeadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Stop!");
    new giveid, str[128], lvl, query[500];
	if(sscanf(params, "ud", giveid, lvl)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid/partofname] [Level]");
	PlayerInfo[giveid][Admin] = lvl;
	//format(str, sizeof(str), "%s has been promoted to %s by %s.", GetName(giveid), GetAdminName(giveid), GetName(playerid));
	//SendClientMessageToAdmins(COLOR_LIGHTRED, str, 1);
	SendClientMessage(playerid, -1, "Done");
	format(query, sizeof(query), "UPDATE playerdata SET AdminLevel=%d WHERE Name='%s'", lvl, GetName(playerid));
	mysql_query(query);
//	Log("logs/makeadmin.txt", str);
    return 1;
}
Reply
#2

pawn Код:
sscanf(Query, "e<p<|>s[23]s[24]ddddfffddddddddddddd>",
You're missing the last "d" for AdminLevel, I think, try this code.
Reply
#3

Nope, doesn't make a difference
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)