My Stats is Bugged
#1

My stats is bugged it won't show the number of kills that the player's got in their /stats
}

public ShowStats(playerid,targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected( targetid))
{
new Premium[20];
if(PlayerInfo[targetid][pPremium] == 0) { Premium = "Bronze"; }
else if(PlayerInfo[targetid][pPremium] == 1) { Premium = "Silver"; }
else if(PlayerInfo[targetid][pPremium] == 2) { Premium = "Gold"; }
new nxtlevel = PlayerInfo[playerid][pRank]+1;
new costlevel = nxtlevel*rankcost;
new cash = GetPlayerMoney(targetid);
new deaths = PlayerInfo[targetid][pDeaths];
new Admin = PlayerInfo[targetid][pAdmin];
new kills = PlayerInfo[targetid][pKills];
new rank = PlayerInfo[targetid][pRank];
new exp = PlayerInfo[targetid][pExp];
new togo = nxtlevel*costlevel;
new name[MAX_PLAYER_NAME];
GetPlayerName(targetid, name, sizeof(name));
new Floatx,Floaty,Floatz;
GetPlayerPos(targetid, px, py, pz);
new coordsstring[256];
SendClientMessage(playerid, COLOR_RED,"_______________________________________ _");
format(coordsstring, sizeof(coordsstring),"*** %s ***",name);
SendClientMessage(playerid, COLOR_WHITE,coordsstring);
format(coordsstring, sizeof(coordsstring), "Rank:[%d] Experience:[%d] Exp_to_go:[%d] Kills:[%d] Deaths:[%d] Cash:[$%d] AdminLevel:[%d]",rank,exp,togo,kills,deaths,cash,Admin);
SendClientMessage(playerid, COLOR_GRAD5,coordsstring);
format(coordsstring, sizeof(coordsstring), "Premium_Position:[%s]",Premium);
SendClientMessage(playerid, COLOR_GRAD5,coordsstring);
SendClientMessage(playerid, COLOR_RED,"_______________________________________ _");
}
}

and that's what i have for my

Onplyaer Death:

public OnPlayerDeath(playerid, killerid, reason)
{
if (Eastteam[playerid] == 1 && reason == 54)
{
SendClientMessage(playerid, COLOR_RED, "You have lost 1000 Dollars for Suspected suicide, if ");
SendClientMessage(playerid, COLOR_RED, "this is a error in the Script, please report this to ");
SendClientMessage(playerid, COLOR_RED, "the forums (www.santos-gaming.net.tf) ");
GivePlayerMoney(playerid,-1000);
}

if (Eastteam[playerid] == 1 && Eastteam[killerid] == 1) // soldiers Team Kill
{
SendClientMessage(killerid, COLOR_RED, "Do not Team Kill (-1000 Money)");
GivePlayerMoney(killerid,-1000);
}
if (WestTeam[playerid] == 1 && WestTeam[killerid] == 1) // Zombies Team Kill
{
SendClientMessage(killerid, COLOR_RED, "Do not Team Kill");
GivePlayerMoney(killerid,-1000);
}
if (Eastteam[playerid] == 0 && WestTeam[killerid] == 1) //Zombie kill Soldier
{
PlayerInfo[killerid][pExp] += 10;
PlayerInfo[playerid][pDeaths] += 1;
PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills]+ 1;
SendClientMessage(killerid,COLOR_RED," You got 500$ for the kill and 10 EXP.");
GivePlayerMoney(killerid,500);
}
if (WestTeam[playerid] == 1 && Eastteam[killerid] == 0) // Soldier Kill Zombie
{
PlayerInfo[killerid][pExp] += 10;
PlayerInfo[playerid][pDeaths] += 1;
PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills] + 1;
SendClientMessage(killerid,COLOR_RED," You got 500$ for the kill and 10 EXP.");
GivePlayerMoney(killerid,500);

}
return 1;
Reply
#2

It looks okay

(1) Are you sure PlayerInfo[targetid][pKills] is where the kills are stored in?
(2) What does it say for Kills: when you use the command? 0?
(3) Try using %i for kills instead of %d, although it probably won't make a difference.
Reply
#3

try adding this in your onplayerdeath, PlayerInfo[killerid][pKills]++;
Reply
#4

Quote:
Originally Posted by Lavamike
It looks okay

(1) Are you sure PlayerInfo[targetid][pKills] is where the kills are stored in?
(2) What does it say for Kills: when you use the command? 0?
(3) Try using %i for kills instead of %d, although it probably won't make a difference.
Yeh when i kill someone it still says zero same witht he death and etc..
Reply
#5

Try using what Panda says

instead of PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills] + 1;

use:

PlayerInfo[killerid][pKills]++;


They both should do the same thing but maybe this will fix the problem, not sure
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)