SA-MP Forums Archive
[HELP]: YINI doesn't save Admin Level! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]: YINI doesn't save Admin Level! (/showthread.php?tid=462710)



[HELP]: YINI doesn't save Admin Level! - Areax - 08.09.2013

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;
}



Re: [HELP]: YINI doesn't save Admin Level! - xganyx - 08.09.2013

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...


Re: [HELP]: YINI doesn't save Admin Level! - Areax - 08.09.2013

Oh.. Thanks