SA-MP Forums Archive
KD System ini? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: KD System ini? (/showthread.php?tid=277477)



KD System ini? - Admigo - 18.08.2011

heey guys,
I use ini for saving stats and i have kills and death to.
I made a textdraw with kills and deaths and i set the string at onplayerupdate.
If you join server the kd is good but if the player goes die or kill someone the kills and deaths goes not up
at the textdraw.
Codenplayerupdate
Код:
format(string3,sizeof(string3),"K:%d D:%d",pKills,pDeaths);
	TextDrawSetString(kd[playerid],string3);
Code:Loaduser
Код:
public LoadUser_AccountData(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Banned",PlayerInfo[playerid][banned]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Captures",PlayerInfo[playerid][pCaptures]);
    return 1;
}
I cant copy the code from load user because then i get error about vallae.
Pls help.


Re: KD System ini? - =WoR=Varth - 18.08.2011

Use OnPlayerDeath instead OnPlayerUpdate.


Re: KD System ini? - Admigo - 18.08.2011

Already have that:
Код:
PlayerInfo[killerid][pKills]++;
	PlayerInfo[playerid][pDeaths]++;



Re: KD System ini? - =WoR=Varth - 18.08.2011

pawn Код:
format(string3,sizeof(string3),"K:%d D:%d",PlayerInfo[playerid][pKills],PlayerInfo[playerid][pDeaths]);
TextDrawSetString(kd[playerid],string3);
format(string3,sizeof(string3),"K:%d D:%d",PlayerInfo[killerid][pKills],PlayerInfo[killerid][pDeaths]);
TextDrawSetString(kd[killerid],string3);



Re: KD System ini? - Admigo - 18.08.2011

Fixed! Added this at onplayerdeath
Код:
PlayerInfo[playerid][pDeaths]++;
	if(killerid != INVALID_PLAYER_ID && killerid != playerid)
 	{
           PlayerInfo[killerid][pKills]++;
  	}
Thanks for helping