ItsMods
Help uninitialised variable[SOLVED] - Printable Version

+- ItsMods (https://www.itsmods.com)
+-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html)
+--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html)
+--- Thread: Help uninitialised variable[SOLVED] (/Thread-Help-uninitialised-variable-SOLVED.html)

Pages: 1 2


uninitialised variable[SOLVED] - ddaavvee - 07-02-2011

Anyone know how to fix this problem?

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

here is the thread its in: http://pastebin.com/LndjjxuK


RE: uninitialised variable - iAegle - 07-02-2011

forwardbuttonpressed is undefined, I think you want to know if someone is walking forward .. which afaik is not possible without checking his coordinates.


RE: uninitialised variable - OrangePL - 07-02-2011

change it to if(usebuttonpressed())


RE: uninitialised variable - ddaavvee - 07-02-2011

(07-02-2011, 20:55)OrangePL Wrote: change it to if(usebuttonpressed())

thanks man


RE: uninitialised variable - ddaavvee - 07-03-2011

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"); } }



RE: uninitialised variable - Opel - 07-03-2011

You don't need the else if at start, only the if


RE: uninitialised variable - ddaavvee - 07-03-2011

(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.


RE: uninitialised variable - Opel - 07-03-2011

Well try removing the ! from the conditions as you are saying
Code:
if ( !self ButtonPressed( "+actionslot 1" ) ) if the actionslot button isnt pressed,
etc





RE: uninitialised variable - koil - 07-03-2011

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"); } }



RE: uninitialised variable - ddaavvee - 07-03-2011

(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?