TextdrawDestroy problem
#1

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
Reply
#2

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..
Reply
#3

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
Reply
#4

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

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

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.
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)