Hallo!
COMMAND:setlevel(playerid, params[])
{
new ID,
Level,
string1[128],
string2[128],
pName[MAX_PLAYER_NAME],
PlayerWhoseLevelGetsSet,
AdminWhoExecutesTheCommand[MAX_PLAYER_NAME];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR] Du bist kein Admin");
if(sscanf(params, "ui", ID, Level)) return SendClientMessage(playerid, COLOR_RED, "[ERROR] Gebrauch: /setlevel [ID] [Level]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_RED, "[ERROR] Dieser Spieler ist nicht online!");
if(Level < 0 || Level > 5) return SendClientMessage(playerid, COLOR_RED, "[ERROR] Ungueltiges Level.");
GetPlayerName(playerid, AdminWhoExecutesTheCommand, sizeof(AdminWhoExecutesTheCommand));
GetPlayerName(PlayerWhoseLevelGetsSet, pName, sizeof(pName));
new INI:file = INI_Open(Path(playerid));
INI_WriteInt(file, "AdminLevel", Level);
INI_Close(file);
if(pInfo[PlayerWhoseLevelGetsSet][AdminLevel] < Level)
{
format(string1, sizeof(string1), "[ADMININFO] Admin {%06x}%s "#COLOR_TURQUOISE_EMBED"hat {%06x}%s "#COLOR_TURQUOISE_EMBED"auf "#COLOR_GOLD_EMBED"Level %i "#COLOR_GREEN_EMBED"heraufgestuft!", GetPlayerColor(playerid) >>> 8, AdminWhoExecutesTheCommand, GetPlayerColor(PlayerWhoseLevelGetsSet) >>> 8, pName, Level);
SendClientMessageToAll(COLOR_TURQUOISE, string1);
pInfo[PlayerWhoseLevelGetsSet][AdminLevel] = Level;
return 1;
}
if(pInfo[PlayerWhoseLevelGetsSet][AdminLevel] > Level)
{
format(string2, sizeof(string2), "[ADMININFO] Admin {%06x}%s "#COLOR_TURQUOISE_EMBED"hat {%06x}%s "#COLOR_TURQUOISE_EMBED"auf "#COLOR_GOLD_EMBED"Level %i "#COLOR_RED_EMBED"herabgestuft!", GetPlayerColor(playerid) >>> 8, AdminWhoExecutesTheCommand, GetPlayerColor(PlayerWhoseLevelGetsSet) >>> 8, pName, Level);
SendClientMessageToAll(COLOR_TURQUOISE, string2);
Level = pInfo[PlayerWhoseLevelGetsSet][AdminLevel];
return 1;
}
return 1;
}
Problem: Ich habe nun einen Account auf Level 5 gestuft. Er lässt sich allerdings nicht mehr herabstufen. Die ClientMessage wird zwar ausgegeben, aber in der user datei bleibt immer die 5 stehen.
Hier noch die stock Funktion für Path.
stock Path(playerid)
{
new string[128],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),UserPath,name);
return string;
}
Danke!