I need a kill counter.
#1

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

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

Fixed
Reply
#4

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

make sure u added the things which are under OnPlayerDeath
Reply
#6

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)