AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Changing bool value. (https://forums.alliedmods.net/showthread.php?t=99789)

lolzin123 08-09-2009 11:36

Changing bool value.
 
How i change te value of the bool...

PHP Code:

if (g_bool[plr])
    {
        
g_bool[plr] = false 
    


the changing is like that or there is another way? THANX

xPaw 08-09-2009 11:47

Re: Changing bool value.
 
Whats the problem?

fysiks 08-09-2009 11:48

Re: Changing bool value.
 
PHP Code:

g_bool[plr] = !g_bool[plr


lolzin123 08-09-2009 15:36

Re: Changing bool value.
 
the question is... the way i use it's correct?

biscuit628 08-09-2009 15:44

Re: Changing bool value.
 
Quote:

Originally Posted by lolzin123 (Post 894571)
the question is... the way i use it's correct?

if (g_bool[plr] == true)
{
//change the bool to false
g_bool[plr] = false
}


it is correct.

Arkshine 08-09-2009 15:51

Re: Changing bool value.
 
It's correct, but if you want to reverse the value, do like fysiks.

lolzin123 08-09-2009 18:39

Re: Changing bool value.
 
How i make a bool to block and unblock the value of the honey block... like in a menu ... turn on the honey at the player and turn off.

The Code:
PHP Code:

actionHoney(id)
{
    new 
taskid TASK_HONEY id;
    
    
//make player feel like they're stuck in honey by lowering their maxspeed
    
set_user_maxspeed(id50.0);
    
    
//remove any existing 'in honey' task
    
if (task_exists(taskid))
    {
        
remove_task(taskid);
    }
    else
    {
        
//half the players velocity the first time they touch it
        
new Float:vVelocity[3];
        
entity_get_vector(idEV_VEC_velocityvVelocity);
        
vVelocity[0] = vVelocity[0] / 2.0;
        
vVelocity[1] = vVelocity[1] / 2.0;
        
entity_set_vector(idEV_VEC_velocityvVelocity);
    }
    
    
//set task to remove 'in honey' effect very soon (task replaced if player is still in honey before task time reached)
    
set_task(0.1"taskNotInHoney"taskid);



Bugsy 08-09-2009 18:53

Re: Changing bool value.
 
PHP Code:

#include <amxmodx>
#include <engine>
#include <fun>

new const Floatg_fMaxSpeed[] = 
{
    
250.0//no weapon
    
250.0//p228
    
0.0,   //shield
    
260.0//scout
    
250.0//hegrenade
    
240.0//xm1014
    
250.0//c4
    
250.0//mac10
    
240.0//aug
    
250.0//smoke
    
250.0//elite
    
250.0//fiveseven
    
250.0//ump45
    
210.0//sg550
    
240.0//galil
    
240.0//famas
    
250.0//usp
    
250.0//glock
    
210.0//awp
    
250.0//mp5navy
    
220.0//m249
    
230.0//m3
    
230.0//m4a1
    
250.0//tmp
    
210.0//g3sg1
    
250.0//flash
    
250.0//deagle
    
235.0//sg552
    
221.0//ak47
    
250.0//knife
    
245.0  //p90
};

new 
boolg_bHoney33 ];
new 
g_iCurWeapon33 ];

public 
plugin_init() 
{
    
register_plugin"honey" "1.0" "bugsy" );
    
    
register_event"CurWeapon" "fw_CurWeapon" "be" "1=1" );
    
    
register_clcmd"say /honey" "DoHoney" );
    
register_clcmd"say /removehoney" "RemoveHoney" );
}

public 
fw_CurWeaponid )
{
    static 
iWeaponiWeapon read_data);
    
    if ( 
g_bHoneyid ] && ( g_iCurWeaponid ] != iWeapon ) )
    {
        
set_user_maxspeedid 50.0 );
        
        
g_iCurWeaponid ] = iWeapon;
    }
}

public 
DoHoneyid )
{
    static 
Float:vVelocity];
    
    if ( !
g_bHoneyid ] )
    {
        
entity_get_vectorid EV_VEC_velocity vVelocity );
        
vVelocity[0] = vVelocity[0] / 2.0;
        
vVelocity[1] = vVelocity[1] / 2.0;
        
entity_set_vectorid EV_VEC_velocity vVelocity );
        
        
set_user_maxspeedid 50.0 );
        
        
g_bHoneyid ] = true;
    }
}

public 
RemoveHoneyid )
{
    if ( 
g_bHoneyid ] )
    {
        
g_bHoneyid ] = false;
        
        
set_user_maxspeedid g_fMaxSpeedget_user_weaponid ) ] );
    }



lolzin123 08-09-2009 19:09

Re: Changing bool value.
 
NOO :D I'm try to make a menu, when you turn on the player can walk on honey block and nothing happens... when turn off the action honey is true...
I'm tryng to do this with bool... like the godmode of bm...


All times are GMT -4. The time now is 18:26.

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