[HELP]: YINI doesn't save Admin Level!
#1

Hello!

I have a problem... My admin level doesn't save. But my score saves.. There is a problem in /makeadmin command i guess, because i made a /setscore command and scores save.

/Makeadmin:

pawn Код:
CMD:makeadmin(playerid, params[])
{
    new level, targetid, string[200], str[200];
    if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, -1, "[SERVER]: This player is {FF0000}NOT {FFFFFF}Connected!");
    if(sscanf(params, "ui", targetid, level))return SendClientMessage(playerid, -1, "[USAGE]: /makeadmin {FF0000}[Playerid] [Level]");
    if(level < 0 || level > 5)return SendClientMessage(playerid, -1, "[SERVER]: {FF0000}Invalid Admin Level (0-5)!");
    if(pInfo[targetid][Adminlevel] < level)
    {
    format(string, sizeof(string), "[ADMIN]: Administrator %s(ID:%d) has promoted %s(ID:%d) to Admin level %d!", GetName(playerid), playerid, GetName(targetid), targetid, level);
    SendClientMessageToAll(-1, string);
    pInfo[targetid][Adminlevel] = level;
    new INI:file = INI_Open(Path(playerid));
    INI_SetTag(file, "Player's Data");
    INI_WriteInt(file, "AdminLevel", pInfo[targetid][Adminlevel]);
    }
    if(pInfo[targetid][Adminlevel] > level)
    {
    format(str, sizeof(str), "[ADMIN]: Administrator %s(ID:%d) has demoted %s(ID:%d) to Admin level %d!", GetName(playerid), playerid, GetName(targetid), targetid, level);
    SendClientMessageToAll(-1, str);
    pInfo[targetid][Adminlevel] = level;
    new INI:file = INI_Open(Path(playerid));
    INI_SetTag(file, "Player's Data");
    INI_WriteInt(file, "AdminLevel", pInfo[targetid][Adminlevel]);
    }
    return 1;
}
Reply
#2

pawn Код:
CMD:makeadmin(playerid, params[])
{
    new level, targetid, string[200], str[200];
    if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, -1, "[SERVER]: This player is {FF0000}NOT {FFFFFF}Connected!");
    if(sscanf(params, "ui", targetid, level))return SendClientMessage(playerid, -1, "[USAGE]: /makeadmin {FF0000}[Playerid] [Level]");
    if(level < 0 || level > 5)return SendClientMessage(playerid, -1, "[SERVER]: {FF0000}Invalid Admin Level (0-5)!");
    if(pInfo[targetid][Adminlevel] < level)
    {
    format(string, sizeof(string), "[ADMIN]: Administrator %s(ID:%d) has promoted %s(ID:%d) to Admin level %d!", GetName(playerid), playerid, GetName(targetid), targetid, level);
    SendClientMessageToAll(-1, string);
    pInfo[targetid][Adminlevel] = level;
    new INI:file = INI_Open(Path(playerid));
    INI_SetTag(file, "Player's Data");
    INI_WriteInt(file, "AdminLevel", pInfo[targetid][Adminlevel]);
    INI_Close(file);
    }
    if(pInfo[targetid][Adminlevel] > level)
    {
    format(str, sizeof(str), "[ADMIN]: Administrator %s(ID:%d) has demoted %s(ID:%d) to Admin level %d!", GetName(playerid), playerid, GetName(targetid), targetid, level);
    SendClientMessageToAll(-1, str);
    pInfo[targetid][Adminlevel] = level;
    new INI:file = INI_Open(Path(playerid));
    INI_SetTag(file, "Player's Data");
    INI_WriteInt(file, "AdminLevel", pInfo[targetid][Adminlevel]);
    INI_Close(file);
    }
    return 1;
}
You din't close it...
Reply
#3

Oh.. Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)