Kills and Death not registering -
HydraX - 17.08.2012
Kills and deaths register at 0 even when a player dies or I kill a player.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
new AccType[128],
AdmRank[128];
if(PlayerInfo[playerid][pVip] == 0) { AccType = "Regular Account"; }
else if(PlayerInfo[clickedplayerid][pVip] == 1) { AccType = "Silver Account"; }
else if(PlayerInfo[clickedplayerid][pVip] == 2) { AccType = "Premium Account"; }
else if(PlayerInfo[playerid][pVip] == 3) { AccType = "Gold Account"; }
if(PlayerInfo[clickedplayerid][pAdmin] == 0) { AdmRank = "Regular Member"; }
else if(PlayerInfo[clickedplayerid][pAdmin] == 1) { AdmRank = "Moderator"; }
else if(PlayerInfo[clickedplayerid][pAdmin] == 2) { AdmRank = "Professional Moderator"; }
else if(PlayerInfo[clickedplayerid][pAdmin] == 3) { AdmRank = "Administrator"; }
else if(PlayerInfo[clickedplayerid][pAdmin] == 4) { AdmRank = "Professional Administrator"; }
else if(PlayerInfo[clickedplayerid][pAdmin] > 5) { AdmRank = "Owner"; }
new kills = PlayerInfo[clickedplayerid][pKills],
deaths = PlayerInfo[clickedplayerid][pDeaths],
score = PlayerInfo[clickedplayerid][pScore],
cash = PlayerInfo[clickedplayerid][pCash],
string[256],
string1[40];
format(string1,sizeof(string1),"%s stats",GetName(clickedplayerid));
format(string,sizeof(string),"%s currently has %i Kills and %i Deaths\n%s is currently a %s with a %s\n%s currently has $%d in his pocket\nHe also has a total of %d points\nHis internet connection is currently registered at %d ms",GetName(clickedplayerid),kills,deaths, GetName(clickedplayerid),AdmRank,AccType,GetName(clickedplayerid), cash, score, GetPlayerPing(clickedplayerid));
ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, string1, string, "Close", ""); //Shows dialog with admins, one button "Close"
return 1;
}
Re: Kills and Death not registering -
leonardo1434 - 17.08.2012
do you care to be more specific?
Respuesta: Re: Kills and Death not registering -
HydraX - 17.08.2012
Sorry, I'm a bit tired.
Here, maybe I'll explain it a bit more..
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}
Means that it should increase the value of kills or death correct?
However, it's not displaying on the stats dialog, it returns a 0, like as if it never happened. To test whether it was a code error, I went to my file on scriptfiles and added a value to
E.g.
Death: 24
Kills: 23
I saved it, restarted the server, checked my stats and it displayed 0.
Re: Kills and Death not registering -
Dan. - 17.08.2012
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{
PlayerInfo[killerid][pKills]++;
}
PlayerInfo[playerid][pDeaths]++;
return 1;
}
E:// Show us where it's saving the player stats, and loading them also.
Re: Kills and Death not registering -
leonardo1434 - 17.08.2012
Hm.. weird. most probably in some place you're reseting the variables to 0, Try find out for it.
Just a little thing, post here how you have done to assign the value from the files to the variable.
@Dan., this has nothing with that problem, this, just check if it was a player who killed him.
Respuesta: Kills and Death not registering -
HydraX - 17.08.2012
Once the player connects..
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
return 1;
}
OnPlayerDisconnect...
pawn Код:
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
Respuesta: Kills and Death not registering -
HydraX - 17.08.2012
pawn Код:
new kills = PlayerInfo[clickedplayerid][pKills],
deaths = PlayerInfo[clickedplayerid][pDeaths];
//then the dialog here