12.03.2009, 15:42
Passing strings in SetTimerEx doesn't work, and sometimes even causes server crashes.
P.S: the [pawn] tags cause unpredicatable results in terms of indention. It isn't my fault if the indention is slightly wrong.
Update:
It's actually the Textdraw that is causing the server crash because it's trying to display an empty string.
pawn Code:
public CreatePlayerMessage(iPlayerID, szMessage[], iSeconds, iOffset)
{
if(IsPlayerMessageShowing(iPlayerID) && iOffset == 0)
{
DestroyPlayerMessage(iPlayerID);
}
if(iOffset > 0)
{
SetTimerEx("CreatePlayerMessage", iOffset * 1000, false, "isii", iPlayerID, szMessage, iSeconds, 0);
}
else
{
// If the offset param is more than 0 and the timer has ran, the server will crash here:
iPlayerMessage[iPlayerID] = TextDrawCreate(191,372,szMessage);
// rest of code
TextDrawUseBox(iPlayerMessage[iPlayerID],1);
TextDrawBoxColor(iPlayerMessage[iPlayerID],0x00000000);
TextDrawTextSize(iPlayerMessage[iPlayerID],542,23);
TextDrawBackgroundColor(iPlayerMessage[iPlayerID],0x000000ff);
TextDrawFont(iPlayerMessage[iPlayerID],1);
TextDrawLetterSize(iPlayerMessage[iPlayerID],0.499999,2.000000);
TextDrawColor(iPlayerMessage[iPlayerID],0xffffffcc);
TextDrawSetProportional(iPlayerMessage[iPlayerID],1);
TextDrawSetShadow(iPlayerMessage[iPlayerID],1);
TextDrawShowForPlayer(iPlayerID,iPlayerMessage[iPlayerID]);
iTextTime[iPlayerID][0] = iSeconds;
iTextTime[iPlayerID][1] = GetTickCount();
}
}
Update:
It's actually the Textdraw that is causing the server crash because it's trying to display an empty string.