#1

I made this '/setlevel' command and when I set my level in game and check the .ini file I got two AdminLevel =
One at the top above [Player's Data] and one below [Player's Data] could somebody help me ?

Here's the command
pawn Код:
CMD:setlevel(playerid,params[])
{
    new target, level, targetName[MAX_PLAYER_NAME], adminName[MAX_PLAYER_NAME], string[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"ERROR: You must be a RCON to use this command");
    if(sscanf(params,"ud",target,level)) return SendClientMessage(playerid,COLOR_GREEN,"Usage: /setlevel [playerid] [level]");
    if(level > 6) return SendClientMessage(playerid,COLOR_PINK,"Levels are between 1-6!");
    new INI:file = INI_Open(Path(target));
    INI_WriteInt(file,"AdminLevel",pInfo[playerid][AdminLevel]);
    INI_Close(file);
    GetPlayerName(target, targetName, sizeof(targetName));
    GetPlayerName(playerid, adminName, sizeof(adminName));
    format(string,sizeof(string),"You have set %s's level to %d", targetName, level);
    SendClientMessage(playerid,COLOR_GREEN,string);
    format(string,sizeof(string),"%s has set your level to %d", adminName, level);
    SendClientMessage(playerid,COLOR_PINK,string);
    return 1;
}
The .ini file
Код:
AdminLevel = 0
[Player's Data]
Password = :D private
AdminLevel = 0
Money = 0
Scores = 0
Kills = 0
Deaths = 0
I'm also using this Login/Register system > http://forum.sa-mp.com/showthread.ph...15#post3271515
Reply
#2

Try putting
pawn Код:
INI_SetTag(file, "Player's Data");
Above the
pawn Код:
INI_WriteInt(file,"AdminLevel",pInfo[playerid][AdminLevel]);
Reply
#3

Without using 'INI_SetTag', the variable will just be placed into the file. However, you were originally setting the variable to be placed under the 'Player's Data' tag.

Simply add:
pawn Код:
INI_SetTag(file, "Player's Data");
just before the INI_WriteInt line.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)