KD System ini?
#1

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.
Reply
#2

Use OnPlayerDeath instead OnPlayerUpdate.
Reply
#3

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

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);
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)