TD not hiding with SetTimer function? -
wallen - 06.02.2018
OnPlayerDeath
PHP код:
Killed[killerid]++;
if(Killed[killerid] == 1)
{
format(iString, sizeof iString, "+ %d", Killed[killerid]);
TextDrawSetString(EARNS[killerid], iString);
SetTimer("HideTextdraw", 500, false);
}
PHP код:
forward HideTextdraw(playerid);
public HideTextdraw(playerid)
{
TextDrawHideForPlayer(playerid, EARNS[playerid]);
TextDrawHideForPlayer(playerid, KilledBy[playerid]);
}
Re: TD not hiding with SetTimer function? -
dani18 - 06.02.2018
Quote:
Originally Posted by wallen
OnPlayerDeath
PHP код:
Killed[killerid]++;
if(Killed[killerid] == 1)
{
format(iString, sizeof iString, "+ %d", Killed[killerid]);
TextDrawSetString(EARNS[killerid], iString);
SetTimer("HideTextdraw", 500, false);
}
PHP код:
forward HideTextdraw(playerid);
public HideTextdraw(playerid)
{
TextDrawHideForPlayer(playerid, EARNS[playerid]);
TextDrawHideForPlayer(playerid, KilledBy[playerid]);
}
|
Код:
new timer_in_death[MAX_PLAYERS];
PHP код:
Killed[killerid]++;
if(Killed[killerid] == 1)
{
format(iString, sizeof iString, "+ %d", Killed[killerid]);
TextDrawShowForPlayer(killerid, EARNS[killerid]);
TextDrawSetString(EARNS[killerid], iString);
timer_in_death[killerid] = SetTimerEx("HideTextdraw", 500, false, "d", killerid);
}
forward HideTextdraw(killerid);
public HideTextdraw(killerid)
{
TextDrawHideForPlayer(killerid, EARNS[killerid]);
KillTimer(timer_in_death[killerid]);
return 1;
}
You can tell if this works.
Re: TD not hiding with SetTimer function? -
wallen - 06.02.2018
No errors or warnings, but ig doesnt show it
Re: TD not hiding with SetTimer function? -
dani18 - 06.02.2018
Quote:
Originally Posted by wallen
No errors or warnings, but ig doesnt show it
|
The TD will be shown to the one who kills or dies?
Re: TD not hiding with SetTimer function? -
wallen - 06.02.2018
who kills, it's like points score +1 for 1 kill, +2 for 2 kills etc "if(Killed[killerid] == 1) " etcc
Re: TD not hiding with SetTimer function? -
Mugala - 06.02.2018
is this problem solved? dani18's code must be a good way.
Re: TD not hiding with SetTimer function? -
solstice_ - 06.02.2018
Quote:
Originally Posted by wallen
No errors or warnings, but ig doesnt show it
|
What doesn't it show?
Re: TD not hiding with SetTimer function? -
Private200 - 06.02.2018
Killed[killerid]++;
if(Killed[killerid] == 1)
What are you trying to achieve by that? You are incrementing Killed after every kill and only showing the textdraw after his first kill. This means that the textdraw WILL NOT show after the first kill.
Re: TD not hiding with SetTimer function? -
wallen - 06.02.2018
Quote:
Originally Posted by Private200
Killed[killerid]++;
if(Killed[killerid] == 1)
What are you trying to achieve by that? You are incrementing Killed after every kill and only showing the textdraw after his first kill. This means that the textdraw WILL NOT show after the first kill.
|
It was a killing spree, this code was meant to show at every kills the points he gets. Thats just not even half of the code i sent.
So he gets 1 kills, 1 points td showing up, 2 kills 2 point td showing up and go on, it works and the problem is that the timer looks like stuck or not called properly, just noticed the id 0 player hides the td, while id 1 still showing and thats with the timer i stated on the thread. Just a simple code with a variable stating it. I still didn't tested the new script (SetTimerEx) as my mate who works with me is inactive and anyway, the only one stuff that i'am confusing myself is i don't know when to call a TD as global (max players) and when not. For example for this kills point td, do you need to state it as a global?
Re: TD not hiding with SetTimer function? -
Private200 - 06.02.2018
Global textdraws will have values changed for everybody.
If a global textdraw showing my name,"Private", shows up in my screen, the moment you change it to "wallen", the text will also change to "wallen" in my screen.
This will not happen in player textdraws, however, hiding the textdraws should not differ between any of them.