Save kills problem..
#1

Hello i have a save money problem with a job filterscript. When i start the job and finish gives me money but when i save accounts and restart server the money is gone.. How to fix this?

Код:
public OnPlayerDataSave(playerid)
{
    if(IsPlayerConnected(playerid))
	{
		if(gPlayerLogged[playerid] && gPlayerSpawned[playerid])
		{
		    new string[256], playersip[64];
		    format(string, sizeof(string), "%s.ini", PlayerName(playerid));
		    GetPlayerIp(playerid, playersip, sizeof(playersip));
		    if(dini_Exists(string))
		    {
		        dini_Set(string, "Key", PlayerInfo[playerid][pKey]);
		        dini_Set(string, "IP", PlayerInfo[playerid][pIP]);
		        dini_IntSet(string, "AdminLevel", PlayerInfo[playerid][pAdmin]);
		        dini_IntSet(string, "aDuty", PlayerInfo[playerid][aDuty]);
		        dini_IntSet(string, "aTog", PlayerInfo[playerid][aTog]);
		        dini_IntSet(string, "pMember", PlayerInfo[playerid][pMember]);
		        dini_IntSet(string, "pRank", PlayerInfo[playerid][pRank]);
		        dini_IntSet(string, "Banned", PlayerInfo[playerid][pBanned]);
		        dini_IntSet(string, "DonateRank", PlayerInfo[playerid][pDonateRank]);
		        dini_IntSet(string, "Registered", PlayerInfo[playerid][pReg]);
		        dini_IntSet(string, "Warnings", PlayerInfo[playerid][pWarns]);
		        dini_IntSet(string, "Cash", PlayerInfo[playerid][pCash]);
		        dini_IntSet(string, "Kills", PlayerInfo[playerid][pKills]);
		        dini_IntSet(string, "Deaths", PlayerInfo[playerid][pDeaths]);
		        dini_IntSet(string, "Muted", PlayerInfo[playerid][pMuted]);
		        dini_IntSet(string, "TimeMuted", PlayerInfo[playerid][ptMuted]);
		        dini_IntSet(string, "VipMuted", PlayerInfo[playerid][pvMuted]);
		        dini_IntSet(string, "KillSpree", PlayerInfo[playerid][pSpree]);
		        dini_IntSet(string, "CWons", PlayerInfo[playerid][pCWons]);
		        dini_IntSet(string, "Hide", PlayerInfo[playerid][pHide]);
                dini_IntSet(string, "pJailed", PlayerInfo[playerid][pJailed]);
                dini_IntSet(string, "pArrested", PlayerInfo[playerid][pArrested]);
		        dini_IntSet(string, "pCrimes", PlayerInfo[playerid][pCrimes]);
		        dini_IntSet(string, "pJail", PlayerInfo[playerid][pJail]);
            	dini_IntSet(string, "pJailTime", PlayerInfo[playerid][pJailTime]);
            	dini_IntSet(string, "pWantedDeaths", PlayerInfo[playerid][pWantedDeaths]);
		    }
		}
	}
Reply
#2

Lets see..maybe its a float instead of an integer you need ?
so no intset but floatset or setfloat or something
Reply
#3

One guy give me this code to save my money and works but i cant transformed to save my kills..

Код:
The reason it is not "giving" You anything when You log-in is because the money is not saved.
It is not same to save money and deaths or kills, as You don't really automatically update the money.

You need to GetPlayerMoney(); on 'OnPlayerDateSave', THEN, it will save!

replace this: 

pawn Code:
dini_IntSet(string, "Cash", PlayerInfo[playerid][pCash]);

with this:

pawn Code:
dini_IntSet(string, "Cash", GetPlayerMoney(playerid));

And this is how You'll load it:

pawn Code:
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
Reply
#4

you need a new 'variable' for that
so now you have PlayerInfo[playerid][pCash]
make another one like
PlayerInfo[playerid][pKills];

Obviously you have to put pKills into the enum too.
Reply
#5

I dont understand..
Reply
#6

Please help?
Reply
#7

It is not the same to save money and kills, it is a complete different thing to do.

First of all, You need to save or "record" all the player kills that he/she earned while playing.

This is the most common way to record a kill:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInfo[killerid][pKills]++;
    return 1;
}
It will just add a '+1' kill to pKills (player kills).
I guess this is it, You have everything else scripted already.
Reply
#8

This should add to gamemode right?
Reply
#9

Yes. Add it to Your gamemode.
Reply
#10

Dont save.. Please help me..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)