SetTimerEx overwrites the last timer on that function?
#1

Title really explains everything, I have a money textdraw that indicates your money has increased, i'm player 1, if player 2 gets the textdraw after me, he gets a timer set which seems to kill my timer before it gets called, leaving the textdraw on my screen indefinitely.

pawn Код:
SetTimerEx("HideMoneyTXD",3000,0,"d",playerid);
Reply
#2

Try this:
Код:
SetTimerEx("HideMoneyTXD", 3000, false,"i",playerid);
and make your "forward" code return with an "1".
Reply
#3

The problem is it's calling for both players individually and works as such individually, but if they both get money at a similar time of each other it seems the last SetTimerEx is the only one to make it to being called.
Reply
#4

you have "forward HideMoneyTXD(playerid)"?
Reply
#5

Is the textdraw a player defined variable?

The problem might reside in the fact that the there's only one textdraw for multiple players.

How does the HideMoneyTXD function work?
Reply
#6

It's so simple I don't understand why it doesn't work, here.

pawn Код:
new Text:TXD_MoneyChange[MAX_PLAYERS];

forward HUDCreate(playerid);
public HUDCreate(playerid)
{
    TXD_MoneyChange[playerid] = TextDrawCreate(606.000000, 96.000000, "-$1337");
    TextDrawAlignment(TXD_MoneyChange[playerid], 3);
    TextDrawBackgroundColor(TXD_MoneyChange[playerid], 255);
    TextDrawFont(TXD_MoneyChange[playerid], 2);
    TextDrawLetterSize(TXD_MoneyChange[playerid], 0.329999, 1.300000);
    TextDrawColor(TXD_MoneyChange[playerid], -16776961);
    TextDrawSetOutline(TXD_MoneyChange[playerid], 1);
    TextDrawSetProportional(TXD_MoneyChange[playerid], 1);
    TextDrawSetSelectable(TXD_MoneyChange[playerid], 0);
   
    // just other textdraws being created here
   
    return 1;
}

forward HideMoneyTXD(playerid);
public HideMoneyTXD(playerid)
{
    TextDrawHideForPlayer(playerid,TXD_MoneyChange[playerid]);
    return 1;
}

OnPlayerDialogResp

when login/reg
            HUDCreate(playerid);
Reply
#7

Quote:
Originally Posted by Hoborific
Посмотреть сообщение
It's so simple I don't understand why it doesn't work, here.
While it might not be the solution (and defenitely not suggested) to your code a work around could be defining a variable to store the timer ID per player?

new hidetimer[MAX_PLAYERS char];
hidetimer[playerid] = SetTimerEx(...);

I don't understand how the timer could overlay the other, if they are both called at different times for different parameters.

Also consider using player textdraws for such things? They wont eat up your global textdraw limit and they get automatically destroyed when a player leaves the server.
Reply
#8

Because there's a hardcoded limit of 256 player textdraws, I have about 10 textdraws that could be displayed at any one time, so it's really limiting my max player limit, considering i've peaked over 50 before I would rather not limit to below that.
Reply
#9

Quote:
Originally Posted by Hoborific
Посмотреть сообщение
Because there's a hardcoded limit of 256 player textdraws, I have about 10 textdraws that could be displayed at any one time, so it's really limiting my max player limit, considering i've peaked over 50 before I would rather not limit to below that.
Created Serverwise (Global) 2048
Created Serverwise (Per-Player) 256

https://sampwiki.blast.hk/wiki/Limits

That says 256 player textdraws per player. My interpretation could be wrong though :P
Reply
#10

oh wow, I didn't notice it was per player, I just checked from a_samp, Thank you I didn't realize that. it wont fix my problem but it certainly is a good discovery.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)