Textdraw problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Textdraw problem (
/showthread.php?tid=278346)
Textdraw problem -
Jack Shred - 21.08.2011
I made it so when a player spawns a textdraw with the number of the player his/her deaths appears.
It should dissapear when the player dies and it should re-appear when the player spawns again ( so it updates )
However, the textdraw does not dissapear and it'll just create a new one over the old one.
OnPlayerSpawn
Code:
new deathstring[30];
format(deathstring, sizeof(deathstring), "Deaths: %d", PlayerInfo[playerid][pDeaths]);
Textdraw7[playerid] = TextDrawCreate(500.000000, 142.000000, deathstring);
TextDrawBackgroundColor(Textdraw7[playerid], 255);
TextDrawFont(Textdraw7[playerid], 1);
TextDrawLetterSize(Textdraw7[playerid], 0.490000, 2.000000);
TextDrawColor(Textdraw7[playerid], -16776961);
TextDrawSetOutline(Textdraw7[playerid], 0);
TextDrawSetProportional(Textdraw7[playerid], 1);
TextDrawSetShadow(Textdraw7[playerid], 1);
TextDrawShowForPlayer(playerid, Textdraw7[playerid]);
Works fine
OnPlayerDeath
Code:
TextDrawHideForPlayer(playerid, Textdraw7[playerid]);
TextDrawDestroy(Textdraw7[playerid]);
Nothing happens when this gets called.
I hope somebody can help me ;d
Thanks,
Shred.
Re: Textdraw problem -
Wesley221 - 21.08.2011
You can just use the function
TextDrawSetString
No need to hide, destroy, re-create it. Just change the string, and you're done
Re: Textdraw problem -
Jack Shred - 21.08.2011
It worked! Thanks alot