Raised This Month: $12 Target: $400
 3% 

bool ???


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InsanityKARAI
Member
Join Date: Jul 2014
Old 09-28-2014 , 18:52   bool ???
Reply With Quote #1

What is the function I use to be able to change states of such a function?
For example:

Noclip (Enabled) - Noclip (Disabled)



and how can I make a function like below: (not my work, do not understand scripter: P)
PHP Code:
if(get_user_noclip(id) == 1)
{
    
set_user_noclip(id 0)
    
Noclip Desactivated
}
else if (
get_user_noclip(id) == 0)
{
    
set_user_noclip(id 1)
    
Noclip Activated

ajuar thank me if you can

Note: Tell me what function should I use to create the two functions mentioned above.

InsanityKARAI is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 09-29-2014 , 05:22   Re: bool ???
Reply With Quote #2

Have a look at the !-operator. You can also search, there have been shown the best ways to do that already.
mottzi is offline
Send a message via MSN to mottzi
bat
Veteran Member
Join Date: Jul 2012
Old 09-30-2014 , 05:23   Re: bool ???
Reply With Quote #3

PHP Code:
#include amxmodx
#include fun

public plugin_init(){
    
register_clcmd("say test""tset")

}

public 
tset(id)
{
     
client_print(idprint_chat"Event: %s"get_user_noclip(id) ? "on" "off")

__________________
bat is offline
Send a message via Skype™ to bat
Kuma77
Senior Member
Join Date: Sep 2014
Location: Behind PC
Old 10-02-2014 , 10:13   Re: bool ???
Reply With Quote #4

You can try this

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

public plugin_init()
{    
    
register_plugin("Noclip ON / OFF""1.0""Kuma");
    
register_clcmd("say /nocON""NoclipON")
    
register_clcmd("say /nocOFF""NoclipOFF")
}

public 
NoclipON(id)
{

        if (
get_user_noclip(id))
         
set_user_noclip(id)
        else
        
set_user_noclip(id1)
    return 
PLUGIN_HANDLED 
}

public 
NoclipOFF(id)
{

        
set_user_noclip(id0)

__________________
SPACE TIME
Kuma77 is offline
Decak
Senior Member
Join Date: Sep 2012
Old 10-03-2014 , 08:37   Re: bool ???
Reply With Quote #5

Why is the title 'bool' ? If you want bool(This is just an example not make anything if you are not finishing):

Code:
#include <amxmodx>

new bool:imbool[33];

public plugin_init() {
  register_clcmd("say /bool", "OnOffBool")
}

public OnOffBool(id) {
  imbool[id] = !imbool[id]
}
What plugin do? Plugin is set 'imbool' to true if bool false.If bool false, plugin sets bool true.Ofc, you can do someone like this:

Code:
#include <amxmodx>
#include <fun>

new bool:imbool[33];

public plugin_init() {
  register_clcmd("say /bool", "OnOffBool")
  register_clcmd("say /mynoclip", "Noclip")
}

public OnOffBool(id) {
  imbool[id] = !imbool[id]
}

public Noclip(id) {
  if(imbool[id]) {
  set_user_noclip(id, 1)
}
  if(!imbool[id]) { // this isn't necessarily, if you want to set user noclip 0, it's necessarily!
  set_user_noclip(id, 0)
}
}

Last edited by Decak; 10-03-2014 at 08:44.
Decak is offline
Strick3n
Member
Join Date: Apr 2013
Old 10-03-2014 , 16:40   Re: bool ???
Reply With Quote #6

You can use bool variable to do it.

here example:
PHP Code:
#include < amxmodx >

new bool:g_bDisabled33 ];

public 
menu_example() 
{
    
// menu code goes here.. 
    
    
new szItem64 ];
    
    
formatexszItemcharsmaxszItem ), "My Option [ %sabled ]"g_bDisabledid ] ? "Dis" "En" );
    
    
menu_additemmenuidszItem );
    
    
// crap ..
}

public 
sub_menuidmenuitem )
{
    if( 
item == /*item id*/ )
        
g_bDisabledid ] = !g_bDisabledid ];

__________________

Last edited by Strick3n; 10-03-2014 at 16:40.
Strick3n is offline
Reply


Thread Tools
Display Modes

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 21:25.


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