SA-MP Forums Archive
I need a kill counter. - 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: I need a kill counter. (/showthread.php?tid=140241)



I need a kill counter. - [MWR]Blood - 08.04.2010

I need a kill counter.When a players joins a DM, it shows him a textdraw with his kills count.Example: Kills: 5
You can make the textdraw only, I will make the other
Thanks in advance!


Re: I need a kill counter. - aircombat - 08.04.2010

Try This (Not Tested) :

Top Of Script :
Код:
new Text:Kills;
new kills[MAX_PLAYERS];
OnPlayerSpawn:
Код:
TextDrawShowForPlayer(playerid,Kills);
Код:
OnPlayerDeath(playerid,kilerid,reason)
{
kills[killerid]++;
format(killcounter,sizeof(killcounter),"Kills :%d",kills);
TextDrawSetString(Kills,killcounter);
return 1;
}
OnGameModeInit :
Код:
Kills = TextDrawCreate(11.000000,273.000000,"Kills :");
TextDrawAlignment(Kills,0);
TextDrawBackgroundColor(Kills,0x000000ff);
TextDrawFont(Kills,1);
TextDrawLetterSize(Kills,0.699999,1.600000);
TextDrawColor(Kills,0x00ff0099);
TextDrawSetOutline(Kills,1);
TextDrawSetProportional(Kills,1);
TextDrawSetShadow(Kills,1);



Re: I need a kill counter. - [MWR]Blood - 08.04.2010

Fixed


Re: I need a kill counter. - [MWR]Blood - 08.04.2010

It shows me only "Kills :" and when I kill a player nothing changes..


Re: I need a kill counter. - aircombat - 08.04.2010

make sure u added the things which are under OnPlayerDeath


Re: I need a kill counter. - biltong - 08.04.2010

Try changing
Код:
TextDrawSetString(Kills, killscounter);
to
Код:
TextDrawSetString(Text:Kills, killscounter);



Re: I need a kill counter. - aircombat - 08.04.2010

Won't work biltong , idk why it doesnt work with him , it works fine with me


Re: I need a kill counter. - Simon - 08.04.2010

Quote:
Originally Posted by Etch ❽ H
Try This (Not Tested) :

Top Of Script :
Код:
new Text:txtKills[MAX_PLAYERS];
new kills[MAX_PLAYERS];
OnPlayerSpawn:
Код:
TextDrawShowForPlayer(playerid,txtKills[playerid]);
Код:
OnPlayerDeath(playerid,kilerid,reason)
{
  new szString[128];
  kills[killerid]++;
  format(szString,sizeof(szString),"Kills :%d",kills[killerid]);
  TextDrawSetString(txtKills[killerid],szString);
  return 1;
}
OnGameModeInit :
Код:
for(new i=0;i<MAX_PLAYERS;i++)
{
  txtKills[i] = TextDrawCreate(11.000000,273.000000,"Kills :0");
  TextDrawAlignment(txtKills[i],0);
  TextDrawBackgroundColor(txtKills[i],0x000000ff);
  TextDrawFont(txtKills[i],1);
  TextDrawLetterSize(txtKills[i],0.699999,1.600000);
  TextDrawColor(txtKills[i],0x00ff0099);
  TextDrawSetOutline(txtKills[i],1);
  TextDrawSetProportional(txtKills[i],1);
  TextDrawSetShadow(txtKills[i],1);
}
Now fixed. You weren't accessing array indexes and it would have only showed one players kills.