Kill/deaths not writing
#1

Hi everyone!

I'm having an issue where my gamemode is not writing to the INI file and stored there. I have been trying to figure it out for the better half of two days.

Any help would be much appreciated! Im using y_ini,sscanf2,zcmd,foreach,whirlpool and y_hooks

Kind Regards,
MrSns

My code is as follows:


OnPlayerDeath:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	print("on player death");
    INI_ParseFile(Path(playerid),"loadaccount_user",.bExtra = true, .extra = playerid);
	print("playerfile updated");
    //VIEWING
    if(IsBeingSpeced[playerid] == 1)
    {
		print("Is player being speced");
	    foreach(Player,i)
        {
            if(spectatorid[i] == playerid)
            {
                TogglePlayerSpectating(i,false);
            }
        }
        print("end of spectate");
    }
    print("end of being spectated");
    SendDeathMessage(killerid, playerid, reason);
    print("DeathMessage: Sent");
    if(killerid != INVALID_PLAYER_ID)
    {
		print("If Killerid");
		pInfo[killerid][Kills]++;
    	printf("Killer kills: %d",pInfo[playerid][Kills]);
    	pInfo[killerid][XP]++;
    	printf("XP Added %d",pInfo[killerid][XP]++);
	}
   	pInfo[playerid][Deaths]++;
   	printf("Playerid deaths: %d", pInfo[playerid][Deaths]);
   	pInfo[playerid][Money] -= 100;
   	print("Money Minused");
    return 1;
}
enums:
Код:
enum PlayerInfo
{
	Pass[129],
	AdminLevel,
	VIPlevel,
	Money,
	Level,
	XP,
	Kills,
	Deaths,
	Banned,
	GarageOwner,
	GarageKey1
}

new pInfo[MAX_PLAYERS][PlayerInfo];
OnPlayerDisconenct:
Код:
public OnPlayerDisconnect(playerid, reason)
{
    INI_ParseFile(Path(playerid),"loadaccount_user",.bExtra = true, .extra = playerid);
	new string1[128], name[MAX_PLAYER_NAME];
	//PLAYER HAS LEFT THE SERVER
	GetPlayerName(playerid, name, MAX_PLAYER_NAME);
	switch(reason)
	{
		case 0: format(string1,sizeof(string1), "* "COL_AJoinLeave"%s has left the server(Timeout)", name);
		case 1: format(string1,sizeof(string1), "* "COL_AJoinLeave"%s has left the server(Leaving)", name);
		case 2: format(string1,sizeof(string1), "* "COL_AJoinLeave"%s has left the server(Kicked)", name);
	}
	SendClientMessageToAll(0xFFFFFFFF, string1);
	
	//AOD
	aDuty[playerid] = 0;
	
	//VIEWING PLAYER
	if(IsBeingSpeced[playerid] == 1)
	{
	    foreach(Player, i)
	    {
	        if(spectatorid[i] == playerid)
	        {
	            TogglePlayerSpectating(i,false);
	        }
	    }
	}
	
    if(fexist(Path(playerid)))
    {

        new INI:file = INI_Open(Path(playerid));
        INI_SetTag(file,"Player's Data");
		print("SETTAG Write - End");
        INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
        print("Vip Write - End");
        INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
        print("Money Write - End");
        INI_WriteInt(file,"Level",GetPlayerScore(playerid));
        print("Level Write - End");
        INI_WriteInt(file,"XP",pInfo[playerid][XP]);
        print("XP write - end");
        INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
        print("Kills Write - end");
        INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
        print("Deaths Write End");
        INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
        print("Banned Write - End");
        INI_WriteInt(file,"GarageOwner",pInfo[playerid][GarageOwner]);
        //INI_WriteInt(file,"GarageKey1",pInfo[playerid][GarageKey1]);
        INI_Close(file);
        print("File closed");
        return 1;
    }
    return 1;
}
Below are my console logs from my printf's:

Код:
[16:57:29] on player death
[16:57:29] playerfile updated
[16:57:29] end of being spectated
[16:57:29] DeathMessage: Sent
[16:57:29] If Killerid
[16:57:29] Killer kills: 0
[16:57:29] XP Added 33554432
[16:57:29] Playerid deaths: 1
[16:57:29] Money Minused
[16:57:29] [kill] Vidal_Castro killed MrSns 
[16:57:50] SETTAG Write - End
[16:57:50] Vip Write - End
[16:57:50] Money Write - End
[16:57:50] Level Write - End
[16:57:50] XP write - end
[16:57:50] Kills Write - end
[16:57:50] Deaths Write End
[16:57:50] Banned Write - End
[16:57:50] File closed
[16:57:50] [part] MrSns has left the server (0:1)
[16:58:40] SETTAG Write - End
[16:58:40] Vip Write - End
[16:58:40] Money Write - End
[16:58:40] Level Write - End
[16:58:40] XP write - end
[16:58:40] Kills Write - end
[16:58:40] Deaths Write End
[16:58:40] Banned Write - End
[16:58:40] File closed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)