SA-MP Forums Archive
TextdrawDestroy 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)
+--- Thread: TextdrawDestroy problem (/showthread.php?tid=469972)



TextdrawDestroy problem - Voxel - 15.10.2013

Hello guys im having a problem with destroying my problem;

error:
pawn Код:
(1885) : error 028: invalid subscript (not an array or too many subscripts): "Textdraw0"
(1885) : warning 215: expression has no effect
(1885) : error 001: expected token: ";", but found "]"
(1885) : error 029: invalid expression, assumed zero
(1885) : fatal error 107: too many error messages on one line
code:
pawn Код:
new Text:Textdraw0;

public OnPlayerDisconnect(playerid, reason)
{
    //TEXTDRAW DESTROYS
    TextDrawDestroy(Textdraw0[playerid]); //line 1885
    return 1;
}
thanks


Re: TextdrawDestroy problem - Konstantinos - 15.10.2013

It's declared as:
pawn Код:
new Text: Textdraw0;
and you used array
pawn Код:
TextDrawDestroy(Textdraw0[playerid]);
I don't know what it is for, but if it's about per player screen, you need to use Textdraw:Per-Player Textdraw.

If it's a global variable for all the players such as showing the website/IP etc. then you need to either use:
pawn Код:
TextDrawDestroy(Textdraw0);
unless you want more textdraws to store in Textdraw0 and then you'll need to make it an array.

pawn Код:
new
    Text: Textdraw0[ 3 ]
;

// Textdraw0[ 0 ] is for the textdraw at the bottom
// Textdraw0[ 1 ] is for the textdraw at the top
// Textdraw0[ 2 ] is for the textdraw at the left
// some examples..



Re: TextdrawDestroy problem - Patrick - 15.10.2013

pawn Код:
TextDrawDestroy(Textdraw0); //removed [playerid] which isn't needed.
Quote:

This forum requires that you wait 240 seconds between posts. Please try again in 147 seconds.
** Fuck, too long.

EDIT: *Read Above for more details, this timer pisses me off


Re: TextdrawDestroy problem - Voxel - 15.10.2013

But will that just estroy it for the player that is leaving?


Re: TextdrawDestroy problem - Patrick - 15.10.2013

When the player leaves the server the textdraw is automatically destroyed, you could put that below the callback OnGamModeExit


Re: TextdrawDestroy problem - Konstantinos - 15.10.2013

Actually whatever you do is unnecessary.

• Per-player Textdraws are destroyed automatically when a player disconnects.

• Global Textdraws are used for the server in general, not about player's screen. So destroying the textdraw when a player disconnects makes the rest of the players not to see the textdraw.


Re: TextdrawDestroy problem - Pottus - 15.10.2013

I just wanted to point out to you if your textdraws are in player arrays you should be using https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw instead then you wouldn't have to worry about destroying any textdraws when a player disconnects player textdraws delete automatically.