textdraw hide show command
#1

hello i am trying to do a command which will hide and show the textdraw whenever the player wants

PHP код:
CMD:tdoption(playeridparams[])
{
    if(
textdraw[playerid] >= 0)
    {
        
TextDrawHideForPlayer(playeridMain);
        
TextDrawHideForPlayer(playeridWebsite);
        
textdraw[playerid] = 1;
    }
    else if(
textdraw[playerid] >= 1)
    {
        
TextDrawShowForPlayer(playeridMain);
        
TextDrawShowForPlayer(playeridWebsite);
        
textdraw[playerid] = 0;
    }
    return 
1;

when i enter it first time it hide it but when i enter it second time it will not show the textdraws

thanks in advance
Reply
#2

You can use a variable like new IsWatchingTD[MAX_PLAYERS] = 0; in your OnPlayerConnect section or stuff ... .
And you can use like below :
PHP код:
CMD:tdoption(playeridparams[]) 

    if(
IsWatchingTD[playerid] == 1
    { 
        
TextDrawHideForPlayer(playeridMain); 
        
TextDrawHideForPlayer(playeridWebsite); 
        
IsWatchingTD[playerid] = 0
        
SendClientMessage(playeridCOLOR_WHITE"Textdraws got hidden!");
    } 
    else if(
IsWatchingTD[playerid] == 0
    { 
        
TextDrawShowForPlayer(playeridMain); 
        
TextDrawShowForPlayer(playeridWebsite); 
        
IsWatchingTD[playerid] = 1
        
SendClientMessage(playeridCOLOR_WHITE"Textdraws got shown!");
    } 
    return 
1

* It's just an example!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)