SetTimerEx is causing crashes?
#1

So, I write script, that will send tips to players - it's based on textdraws.
Код:
forward ShowTipForPlayer(playerid,tipid,time);
public ShowTipForPlayer(playerid,tipid,time)
{
	print("debug");
	if(tipid == 2) print("debug 1");
 	if(ActTip[playerid] != 0)
	{
	    print("debug 2");
	    return 1;
	}
	print("debug 3");
	ActTip[playerid] = tipid;
//    SetPVarInt(playerid,"acttipstep",1);
	TiperOn[playerid]=1;
    TextDrawSetString(Tiper[playerid], TipText(tipid));
    TextDrawShowForPlayer(playerid, Tiper[playerid]);
    SetTimerEx("TiperOff",1000*time, false, "d", playerid);
    return 1;
}
This code displays textdraw with tip for a player, but - it has got three parameters.
I try to display textdraw with delay, using SetTimerEx, but - at the moment, when server is supposed to call above function, it crashes.

Server shows first textdraw (at the end of registration), but - second textdraw crashes. I tried to do it like this:
Код:
	SetTimerEx("ShowTipForPlayer",20*1000,false,"d d d",playerid,2,5);
and
	SetTimerEx("ShowTipForPlayer",20*1000,false,"ddd",playerid,2,5);
and
	SetTimerEx("ShowTipForPlayer",20*1000,false,"d,d,d",playerid,2,5);
But both lines crashes. (I think it crashes, because server crashes 20 seconds after setting timer.)
Can anybody help me? :/
(I'm using SetTimerEx first time for function with more than one argument :/)

RESOLVED:
When I've created cmd that called function ShowTipForPlayer (and I could set parameters in this cmd), server hasn't crashed. In my case, calling function without variables was causing crashes. Solution? Create variable, set that variable and use it to call function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)