Raised This Month: $ Target: $400
 0% 

How can I turn on and off a function on the best way?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-20-2014 , 11:44   Re: How can I turn on and off a function on the best way?
Reply With Quote #1

you can do it with something like this:
PHP Code:
new bool:g_Noclip[33]

public 
client_connect(id)
{
    
g_Noclip[id] = false
}

public 
menu_show(id
{
    new 
menu menu_create("testmenu""handler")
    
    
menu_additem(menug_Noclip[id] ? "Noclip (Deactivate)" "Noclip (Activate)")
    
    
menu_display(id)
}

public 
handler(idmenuitem)
{
    if(
item == 0)
    {
        
g_Noclip[id] = !g_Noclip[id]
        
        
set_user_noclip(idg_Noclip[id] ? 0)
    }
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED

mottzi is offline
Send a message via MSN to mottzi
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:06.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode