14.04.2012, 23:20
Thats because you create the textdraw each time you call OnPlayerCommandText
The first time it creates and shows it
The second time it creates a new one and hides it (although it was already hidden)
In the end the first one is still beeing shown
Textdraws are generally generated in OnGameModeInit and they use global variables
The first time it creates and shows it
The second time it creates a new one and hides it (although it was already hidden)
In the end the first one is still beeing shown
Textdraws are generally generated in OnGameModeInit and they use global variables
pawn Код:
// Global
stock
Text: debugtext
;
pawn Код:
// OnGameModeInit
debugtext = TextDrawCreate(320.0, 320.0, "debug");
pawn Код:
// OnPlayerCommandText
if(!strcmp(cmdtext, "/debug", true)) {
static
bool: show
;
if((show = !show)) {
TextDrawShowForPlayer(playerid, debugtext);
SendClientMessage(playerid, 0xFFFFFFFF, "textdraw on");
} else {
TextDrawHideForPlayer(playerid, debugtext);
SendClientMessage(playerid, 0xFFFFFFFF, "textdraw off");
}
return true;
}