ItsMods

Full Version: uninitialised variable[SOLVED]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Anyone know how to fix this problem?

[Image: 2011-07-02_00001.jpg]

here is the thread its in: http://pastebin.com/LndjjxuK
forwardbuttonpressed is undefined, I think you want to know if someone is walking forward .. which afaik is not possible without checking his coordinates.
change it to if(usebuttonpressed())
(07-02-2011, 20:55)OrangePL Wrote: [ -> ]change it to if(usebuttonpressed())

thanks man
Sorry guys i got another problem

Black Ops sais there is a syntax error, everytime i have those 4 options "else if", if you know what i mean.
The 4 options proberly can't start with "else if"
You guys have any idea how to fix this and still have only 1 choice per spawn?

Code:
classmenu()

{
        else if ( !self ButtonPressed( "+actionslot 1" ) )
        {
            self takeAllWeapons();
                        self giveWeapon("tesla_gun_zm");
                        self giveWeapon("stg44_sp");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("tabun_gas_mp");
                        self giveWeapon("knife_mp");
                        self setPerk("specialty_movefaster");  
                        self setPerk("specialty_fallheight");
                        self setPerk("specialty_longersprint");  
                        self setPerk("specialty_unlimitedsprint");
                }

                else if ( !self ButtonPressed( "+actionslot 2" ) )
                {
            self takeAllWeapons();
                        self giveWeapon("thundergun_zm");
                        self giveWeapon("ppsh_sp");
            self setPerk("specialty_twogrenades");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("tabun_gas_mp");
                        self giveweapon("knife_mp");
                        self setPerk("specialty_movefaster");  
                        self setPerk("specialty_fallheight");
                        self setPerk("specialty_longersprint");  
                        self setPerk("specialty_unlimitedsprint");
                }

                else if ( !self ButtonPressed( "+actionslot 3" ) )
                {
            self takeAllWeapons();
                        self giveWeapon("ray_gun_zm");
                        self giveWeapon("sten_sp");
            self setPerk("specialty_twogrenades");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("tabun_gas_mp");
                        self giveweapon("knife_mp");
                        self setPerk("specialty_movefaster");  
                        self setPerk("specialty_fallheight");
                        self setPerk("specialty_longersprint");  
                        self setPerk("specialty_unlimitedsprint");
                }

                else if ( !self ButtonPressed( "+actionslot 4" ) )
                {
            self takeAllWeapons();
                        self giveWeapon("m16_acog_gl_extclip_mp");
                        self giveWeapon("commando_ir_mk_dualclip_silencer_mp");
                        self giveWeapon("l96a1_vzoom_extclip_mp");
                        self giveWeapon("cz75_upgradesight_extclip_silencer_mp");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("concussion_grenade_mp");
                        self giveWeapon("satchel_charge_mp");
                        self giveWeapon("knife_mp");
                        self setPerk("specialty_scavenger");  
                        self setPerk("specialty_extraammo");
                        self setPerk("specialty_fastreload");  
                        self setPerk("specialty_fastads");
                        self setPerk("specialty_gas_mask");  
                        self setPerk("specialty_showonradar");  
                        self setPerk("specialty_stunprotection");
                }
}
You don't need the else if at start, only the if
(07-03-2011, 11:09)Opel Wrote: [ -> ]You don't need the else if at start, only the if

that gets rid of the bad syntax,
but then it automaticly gives me the last class.

And i want to be able to choose one at spawn.
Well try removing the ! from the conditions as you are saying
Code:
if ( !self ButtonPressed( "+actionslot 1" ) )
if the actionslot button isnt pressed,
etc


Code:
classmenu()

{
        if ( self ButtonPressed( "+actionslot 1" ) )
        {
            self takeAllWeapons();
                        self giveWeapon("tesla_gun_zm");
                        self giveWeapon("stg44_sp");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("tabun_gas_mp");
                        self giveWeapon("knife_mp");
                        self setPerk("specialty_movefaster");  
                        self setPerk("specialty_fallheight");
                        self setPerk("specialty_longersprint");  
                        self setPerk("specialty_unlimitedsprint");
                }

                else if ( self ButtonPressed( "+actionslot 2" ) )
                {
            self takeAllWeapons();
                        self giveWeapon("thundergun_zm");
                        self giveWeapon("ppsh_sp");
            self setPerk("specialty_twogrenades");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("tabun_gas_mp");
                        self giveweapon("knife_mp");
                        self setPerk("specialty_movefaster");  
                        self setPerk("specialty_fallheight");
                        self setPerk("specialty_longersprint");  
                        self setPerk("specialty_unlimitedsprint");
                }

                else if ( self ButtonPressed( "+actionslot 3" ) )
                {
            self takeAllWeapons();
                        self giveWeapon("ray_gun_zm");
                        self giveWeapon("sten_sp");
            self setPerk("specialty_twogrenades");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("tabun_gas_mp");
                        self giveweapon("knife_mp");
                        self setPerk("specialty_movefaster");  
                        self setPerk("specialty_fallheight");
                        self setPerk("specialty_longersprint");  
                        self setPerk("specialty_unlimitedsprint");
                }

                else if ( self ButtonPressed( "+actionslot 4" ) )
                {
            self takeAllWeapons();
                        self giveWeapon("m16_acog_gl_extclip_mp");
                        self giveWeapon("commando_ir_mk_dualclip_silencer_mp");
                        self giveWeapon("l96a1_vzoom_extclip_mp");
                        self giveWeapon("cz75_upgradesight_extclip_silencer_mp");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("concussion_grenade_mp");
                        self giveWeapon("satchel_charge_mp");
                        self giveWeapon("knife_mp");
                        self setPerk("specialty_scavenger");  
                        self setPerk("specialty_extraammo");
                        self setPerk("specialty_fastreload");  
                        self setPerk("specialty_fastads");
                        self setPerk("specialty_gas_mask");  
                        self setPerk("specialty_showonradar");  
                        self setPerk("specialty_stunprotection");
                }
}
(07-03-2011, 15:36)koil Wrote: [ -> ]
Code:
classmenu()

{
        if ( self ButtonPressed( "+actionslot 1" ) )
        {
            self takeAllWeapons();
                        self giveWeapon("tesla_gun_zm");
                        self giveWeapon("stg44_sp");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("tabun_gas_mp");
                        self giveWeapon("knife_mp");
                        self setPerk("specialty_movefaster");  
                        self setPerk("specialty_fallheight");
                        self setPerk("specialty_longersprint");  
                        self setPerk("specialty_unlimitedsprint");
                }

                else if ( self ButtonPressed( "+actionslot 2" ) )
                {
            self takeAllWeapons();
                        self giveWeapon("thundergun_zm");
                        self giveWeapon("ppsh_sp");
            self setPerk("specialty_twogrenades");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("tabun_gas_mp");
                        self giveweapon("knife_mp");
                        self setPerk("specialty_movefaster");  
                        self setPerk("specialty_fallheight");
                        self setPerk("specialty_longersprint");  
                        self setPerk("specialty_unlimitedsprint");
                }

                else if ( self ButtonPressed( "+actionslot 3" ) )
                {
            self takeAllWeapons();
                        self giveWeapon("ray_gun_zm");
                        self giveWeapon("sten_sp");
            self setPerk("specialty_twogrenades");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("tabun_gas_mp");
                        self giveweapon("knife_mp");
                        self setPerk("specialty_movefaster");  
                        self setPerk("specialty_fallheight");
                        self setPerk("specialty_longersprint");  
                        self setPerk("specialty_unlimitedsprint");
                }

                else if ( self ButtonPressed( "+actionslot 4" ) )
                {
            self takeAllWeapons();
                        self giveWeapon("m16_acog_gl_extclip_mp");
                        self giveWeapon("commando_ir_mk_dualclip_silencer_mp");
                        self giveWeapon("l96a1_vzoom_extclip_mp");
                        self giveWeapon("cz75_upgradesight_extclip_silencer_mp");
                        self giveWeapon("sticky_grenade_mp");
                        self giveWeapon("concussion_grenade_mp");
                        self giveWeapon("satchel_charge_mp");
                        self giveWeapon("knife_mp");
                        self setPerk("specialty_scavenger");  
                        self setPerk("specialty_extraammo");
                        self setPerk("specialty_fastreload");  
                        self setPerk("specialty_fastads");
                        self setPerk("specialty_gas_mask");  
                        self setPerk("specialty_showonradar");  
                        self setPerk("specialty_stunprotection");
                }
}

Ok that gets rid of the bad syntax, thanks.
but when i press one of those buttons nothing happens.
any idea?
Pages: 1 2