INI_Close (INI:file=-1)
#10

Same INI_Close -1 error but here are new errors when i use /saveplayer id

pawn Код:
googamalugafoo[1] has joined the server - 1 255.255.255.25
//this is after i used /saveplayer
[03:54:06] [debug] Run time error 4: "Array index out of bounds"
[03:54:06] [debug] Accessing element at negative index -1
[03:54:06] [debug] AMX backtrace:
[03:54:06] [debug] #0 0001a720 in INI_Close (INI:file=-1) at pawno\include\YSI\y_ini.inc:746
[03:54:06] [debug] #1 00151338 in SavePlayer (playerid=1) at gamemodes\sabp.pwn:18991
[03:54:06] [debug] #2 000fac0c in public cmd_saveplayer (playerid=1, params[]=@012e8f88 "1") at SABP Beta 0.3\SABP Beta 0.3\gamemodes\sabp.pwn:12917
[03:54:06] [debug] #3 native CallLocalFunction () from samp03svr
[03:54:06] [debug] #4 00000b20 in public OnPlayerCommandText (playerid=1, cmdtext[]=@012e8f50 "/saveplayer 1") at pawno\include\zcmd.inc:108
CMDaveplayer
pawn Код:
CMD:saveplayer(playerid, params[])
{
    if(!IsAdmin(playerid, 1)) return ErrorMsg(playerid);
    new target;
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected");
    if(sscanf(params, "u", target)) return Usage(playerid, "/saveplayer [Player]");

    new string[148];
    format(string,sizeof(string), "** STATS: An admin has manually saved your stats. %s",Name(target));
    SendClientMessage(target,COLOR_GREEN,string);
    SavePlayer(target);
    return 1;
}
SavePlayer Stock
pawn Код:
stock SavePlayer(playerid)
{
    new pstring[16];
    format(pstring, sizeof(pstring),"%s",GetPlayerIp(playerid, pstring, sizeof(pstring)));
    new INI:File = INI_Open(userpath(playerid));
    INI_WriteInt(File,"Admin",Info[playerid][aLevel]);
    INI_WriteInt(File,"VIP",Info[playerid][vLevel]);
    INI_WriteInt(File,"CitySpawn",Info[playerid][CitySpawn]);
    INI_WriteInt(File,"SpawnInHouse",Info[playerid][SpawnInHouse]);
    INI_WriteInt(File,"Seconds",Info[playerid][Seconds]);
    INI_WriteInt(File,"Minutes",Info[playerid][Minutes]);
    INI_WriteInt(File,"Hours",Info[playerid][Hours]);
    INI_WriteInt(File,"Money",GetPlayerCash(playerid));
    INI_WriteInt(File,"BankCash",Info[playerid][BankCash]);
    INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    INI_WriteInt(File,"Seeds",Info[playerid][Seeds]);
    INI_WriteInt(File,"Grams",Info[playerid][Grams]);
    INI_WriteInt(File,"Kills",Info[playerid][Kills]);
    INI_WriteInt(File,"Deaths",Info[playerid][Deaths]);
    INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
    INI_WriteInt(File,"Team",Info[playerid][Team]);
    INI_WriteString(File,"IP",pstring);
    INI_WriteInt(File,"TruckMCompleted",Info[playerid][TruckMCompleted]);
    INI_WriteInt(File,"LastVehicle",Info[playerid][LastVehicle]);
    INI_WriteInt(File,"Wanted_Level",GetPlayerWantedLevel(playerid));
    for(new i=0; i < 6; i++)
    {
        GetPlayerWeaponData(playerid, i, Info[playerid][WeaponSlot][i], Info[playerid][WeaponSlot_Ammo][i]);
    }
    INI_WriteInt(File,"WeaponSlot1",Info[playerid][WeaponSlot][0]);
    INI_WriteInt(File,"WeaponSlot1_Ammo",Info[playerid][WeaponSlot_Ammo][0]);
    INI_WriteInt(File,"WeaponSlot2",Info[playerid][WeaponSlot][1]);
    INI_WriteInt(File,"WeaponSlot2_Ammo",Info[playerid][WeaponSlot_Ammo][1]);
    INI_WriteInt(File,"WeaponSlot3",Info[playerid][WeaponSlot][2]);
    INI_WriteInt(File,"WeaponSlot3_Ammo",Info[playerid][WeaponSlot_Ammo][2]);
    INI_WriteInt(File,"WeaponSlot4",Info[playerid][WeaponSlot][3]);
    INI_WriteInt(File,"WeaponSlot4_Ammo",Info[playerid][WeaponSlot_Ammo][3]);
    INI_WriteInt(File,"WeaponSlot5",Info[playerid][WeaponSlot][4]);
    INI_WriteInt(File,"WeaponSlot5_Ammo",Info[playerid][WeaponSlot_Ammo][4]);
    INI_WriteInt(File,"WeaponSlot6",Info[playerid][WeaponSlot][5]);
    INI_WriteInt(File,"WeaponSlot6_Ammo",Info[playerid][WeaponSlot_Ammo][5]);
    INI_Close(File);
}
Reply


Messages In This Thread
INI_Close (INI:file=-1) - by SnG.Scot_MisCuDI - 04.02.2015, 08:47
Re: INI_Close (INI:file=-1) - by PaulDinam - 04.02.2015, 09:49
Re: INI_Close (INI:file=-1) - by SnG.Scot_MisCuDI - 04.02.2015, 18:59
Re: INI_Close (INI:file=-1) - by Sime30 - 04.02.2015, 19:40
Re: INI_Close (INI:file=-1) - by SnG.Scot_MisCuDI - 04.02.2015, 19:59
Re: INI_Close (INI:file=-1) - by Sime30 - 04.02.2015, 20:51
Re: INI_Close (INI:file=-1) - by SnG.Scot_MisCuDI - 04.02.2015, 20:56
Re: INI_Close (INI:file=-1) - by Sime30 - 04.02.2015, 21:05
Re: INI_Close (INI:file=-1) - by SnG.Scot_MisCuDI - 04.02.2015, 21:13
Re: INI_Close (INI:file=-1) - by SnG.Scot_MisCuDI - 05.02.2015, 08:09

Forum Jump:


Users browsing this thread: 1 Guest(s)