TD not hiding with SetTimer function?
#1

OnPlayerDeath

PHP код:
    Killed[killerid]++;
    if(
Killed[killerid] == 1)
    {
    
format(iStringsizeof iString"+ %d"Killed[killerid]);
    
TextDrawSetString(EARNS[killerid], iString);
    
SetTimer("HideTextdraw"500false);
    } 
PHP код:
forward HideTextdraw(playerid);
public 
HideTextdraw(playerid)
{
    
TextDrawHideForPlayer(playeridEARNS[playerid]);
    
TextDrawHideForPlayer(playeridKilledBy[playerid]);

Reply
#2

Quote:
Originally Posted by wallen
Посмотреть сообщение
OnPlayerDeath

PHP код:
    Killed[killerid]++;
    if(
Killed[killerid] == 1)
    {
    
format(iStringsizeof iString"+ %d"Killed[killerid]);
    
TextDrawSetString(EARNS[killerid], iString);
    
SetTimer("HideTextdraw"500false);
    } 
PHP код:
forward HideTextdraw(playerid);
public 
HideTextdraw(playerid)
{
    
TextDrawHideForPlayer(playeridEARNS[playerid]);
    
TextDrawHideForPlayer(playeridKilledBy[playerid]);

Код:
new timer_in_death[MAX_PLAYERS];
PHP код:

    Killed
[killerid]++; 
    if(
Killed[killerid] == 1
    { 
    
format(iStringsizeof iString"+ %d"Killed[killerid]); 
    
TextDrawShowForPlayer(killeridEARNS[killerid]);  
    
TextDrawSetString(EARNS[killerid], iString);
    
timer_in_death[killerid] = SetTimerEx("HideTextdraw"500false"d"killerid);
    }
forward HideTextdraw(killerid);
public 
HideTextdraw(killerid)
{
    
TextDrawHideForPlayer(killeridEARNS[killerid]);
        
KillTimer(timer_in_death[killerid]);
        return 
1;

You can tell if this works.
Reply
#3

No errors or warnings, but ig doesnt show it
Reply
#4

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?
Reply
#5

who kills, it's like points score +1 for 1 kill, +2 for 2 kills etc "if(Killed[killerid] == 1) " etcc
Reply
#6

is this problem solved? dani18's code must be a good way.
Reply
#7

Quote:
Originally Posted by wallen
Посмотреть сообщение
No errors or warnings, but ig doesnt show it
What doesn't it show?
Reply
#8

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

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?
Reply
#10

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


Forum Jump:


Users browsing this thread: 2 Guest(s)