SA-MP Forums Archive
Press n to close this box - 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: Press n to close this box (/showthread.php?tid=610206)



Press n to close this box - CarRamper - 21.06.2016

hello guys i haven made a textdraw for my server and i want that when a please press n in keyboad the textdraw hide/destroy please tell me how i can do that.


Re: Press n to close this box - luke49 - 21.06.2016

PHP код:
#define PRESSED(%0) \
        
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 
PHP код:
 new bool:showingTD    [MAX_PLAYERS] = {false, ...}; 
PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
PRESSED(KEY_NO)) { 
        if(
showingTD[playerid] == true) { 
            
//hide textdraw 
            
showingTD[playerid] = false
        }     
    }    
    
/* 
    if(PRESSED(KEY_NO)) { 
        //hide textdraw 
    } 
    */  

P.S: Do not forget to set showingTD[playerid] = true; when you show your texdraw(s).