11.04.2019, 21:29
Freaksken solved the issue with me through Discord. If anyone else faces this problem, you need to make a player textdraw. I suggest following Freaksken's guide which you can find here. https://sampforum.blast.hk/showthread.php?tid=625685
This is the code I have now, that fixed it.
This is the code I have now, that fixed it.
PHP код:
new PlayerText:InfoText[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...}, DisplayingText[MAX_PLAYERS], TextTiming[MAX_PLAYERS], AnimTiming[MAX_PLAYERS];
stock CreateInfoTextDraw(playerid)
{
InfoText[playerid] = CreatePlayerTextDraw(playerid, 319.000000, 380.000000, "");
PlayerTextDrawAlignment(playerid, InfoText[playerid], 2);
PlayerTextDrawBackgroundColor(playerid, InfoText[playerid], 255);
PlayerTextDrawFont(playerid, InfoText[playerid], 1);
PlayerTextDrawLetterSize(playerid, InfoText[playerid], 0.320000, 1.500000);
PlayerTextDrawSetProportional(playerid, InfoText[playerid], 1);
PlayerTextDrawSetShadow(playerid, InfoText[playerid], 1);
}
stock DisplayInfoTextDraw(playerid, str[], duration)
{
if(DisplayingText[playerid])
{
KillTimer(TextTiming[playerid]);
}
PlayerTextDrawSetString(playerid, InfoText[playerid], str);
PlayerTextDrawShow(playerid, InfoText[playerid]);
TextTiming[playerid] = SetTimerEx("HideInfoTextDraw", duration *1000, 0, "i", playerid);
AnimTiming[playerid] = SetTimerEx("AnimTimer", 2000, false, "i", playerid);
DisplayingText[playerid] = 1;
return 1;
}
forward HideInfoTextDraw(playerid);
public HideInfoTextDraw(playerid)
{
PlayerTextDrawHide(playerid, InfoText[playerid]);
DisplayingText[playerid] = 0;
return 1;
}
public OnPlayerConnect(playerid)
{
CreateInfoTextDraw(playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
DisplayingText[playerid] = 0;
InfoText[playerid] = PlayerText:INVALID_TEXT_DRAW;
return 1;
}