Save kills problem.. -
dundolina - 29.11.2014
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]);
}
}
}
Re: Save kills problem.. -
AIped - 29.11.2014
Lets see..maybe its a float instead of an integer you need ?
so no intset but floatset or setfloat or something
Re: Save kills problem.. -
dundolina - 29.11.2014
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]);
Re: Save kills problem.. -
AIped - 29.11.2014
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.
Re: Save kills problem.. -
dundolina - 29.11.2014
I dont understand..
Re: Save kills problem.. -
dundolina - 29.11.2014
Please help?
Re: Save kills problem.. -
Wan - 29.11.2014
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.
Re: Save kills problem.. -
dundolina - 29.11.2014
This should add to gamemode right?
Re: Save kills problem.. -
Wan - 29.11.2014
Yes. Add it to Your gamemode.
Re: Save kills problem.. -
dundolina - 29.11.2014
Dont save.. Please help me..