Textdraw reset/count
#1

Hello! I just started learning textdraw, so i tried makeing a Death Streak, Kills, and Kill Streak, textdraw.
But i have some minor problems.

The kill counter works perfect, but i need a way to reset "kill Streaks" so i'd like to know that.

and the Death streak, first of all it dosen't count upwards when you die, and it has to be resetted too, but i can prob do that myself if i learn it on the kill streaks :b

So here is my codes:

Top:
Код:
new Text:Kill_Streak[MAX_PLAYERS];
new Text:Kill[MAX_PLAYERS];
new Text:Deaths[MAX_PLAYERS];
new Death[MAX_PLAYERS];
new kills[MAX_PLAYERS];
new killstreak[MAX_PLAYERS];
OnGameModeInnit:
Код:
	for(new i=0;i<MAX_PLAYERS;i++)
	{
  Kill_Streak[i] = TextDrawCreate(11.000000,288.000000,"Kill Streak: 0");
  TextDrawAlignment(Kill_Streak[i],0);
  TextDrawBackgroundColor(Kill_Streak[i],0x000000ff);
  TextDrawFont(Kill_Streak[i],1);
  TextDrawLetterSize(Kill_Streak[i],0.699999,1.600000);
  TextDrawColor(Kill_Streak[i],0x00ff0099);
  TextDrawSetOutline(Kill_Streak[i],1);
  TextDrawSetProportional(Kill_Streak[i],1);
  TextDrawSetShadow(Kill_Streak[i],1);
  }
  	for(new i=0;i<MAX_PLAYERS;i++)
	{
  Kill[i] = TextDrawCreate(11.000000,273.000000,"Kills: 0"); // 273 normalt
  TextDrawAlignment(Kill[i],0);
  TextDrawBackgroundColor(Kill[i],0x000000ff);
  TextDrawFont(Kill[i],1);
  TextDrawLetterSize(Kill[i],0.699999,1.600000);
  TextDrawColor(Kill[i],0x00ff0099);
  TextDrawSetOutline(Kill[i],1);
  TextDrawSetProportional(Kill[i],1);
  TextDrawSetShadow(Kill[i],1);
  }
  	for(new i=0;i<MAX_PLAYERS;i++)
	{
  Deaths[i] = TextDrawCreate(11.000000,258.000000,"Deaths: 0"); // 273 normalt
  TextDrawAlignment(Deaths[i],0);
  TextDrawBackgroundColor(Deaths[i],0x000000ff);
  TextDrawFont(Deaths[i],1);
  TextDrawLetterSize(Deaths[i],0.699999,1.600000);
  TextDrawColor(Deaths[i],0x00ff0099);
  TextDrawSetOutline(Deaths[i],1);
  TextDrawSetProportional(Deaths[i],1);
  TextDrawSetShadow(Deaths[i],1);
OnPlayerSpawn:
Код:
  TextDrawShowForPlayer(playerid,Kill_Streak[playerid]);
  TextDrawShowForPlayer(playerid,Kill[playerid]);
  TextDrawShowForPlayer(playerid,Deaths[playerid]);
OnPlayerDeath:
Код:
  new szString[128];
  killstreak[killerid]++;
  format(szString,sizeof(szString),"Kill Streak: %d",killstreak[killerid]);
  TextDrawSetString(Kill_Streak[killerid],szString);
  new szxString[128];
  kills[killerid]++;
  format(szxString,sizeof(szxString),"Kills: %d",kills[killerid]);
  TextDrawSetString(Kill[killerid],szxString);
  new DString[128];
  Death[playerid]++;
  format(DString,sizeof(DString),"Deaths: %d",Death[playerid]);
  TextDrawSetString(Deaths[playerid],DString);
Can any1 help me how to "reset" a textdraw to 0 on death and than it begins to count up again.
And does any1 see the problem with deaths, since it wont count when you die?

-Best Regards Naxix
Reply
#2

If I understood correct, use TextDrawSetString
Reply
#3

Ye, i can understand you have to use that, but i already used it one time OnPlayerDeath, so how am i gonna use it on the same textdraw again?
Reply
#4

Quote:
Originally Posted by Naxix
Ye, i can understand you have to use that, but i already used it one time OnPlayerDeath, so how am i gonna use it on the same textdraw again?
You can destroy your textdraw using TextDrawDestroy & setting a new text for it with TextDrawSetString.

By the way, you played in AOF some time ago?
Reply
#5

Yup, hai Jakku

But, you mean like this:
Код:
  new szString[128];
  killstreak[killerid]++;
  format(szString,sizeof(szString),"Kill Streak: %d",killstreak[killerid]);
  TextDrawSetString(Kill_Streak[killerid],szString);
  {
   TextDrawDestroy(kill_streak);
  }
  new szString[128];
  killstreak[killerid]++;
  format(szString,sizeof(szString),"Kill Streak: %d",killstreak[killerid]);
  TextDrawSetString(Kill_Streak[killerid],szString);
?
Reply
#6

Goooood tnx
Reply
#7

Well, if you use "TextDrawDestroy(kill_streak);" will it destroy it only for the player who dies, or also for the killerid? or eveyone?
Reply
#8

Bump.

I need it to only reset the Textdraw for only playerid, is that possible?
Reply
#9

reset your variable and if necessary kill everyone!

Код:
killstreak[killerid]++;
i assume this is your variable to add kills

create a command to run a loop

Код:
for(new i=0; i<MAX_PLAYERS; i++){
killstreak[i] = 0;
}
this will set all kills to 0
Reply
#10

Ye i know i can do that, but i need it only reset the player who dies, not everyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)