Posted By: TheShooter
Turn Panels of and on - depending on a variable - 10/05/12 09:05
Hi,
I'm trying to hide my ammopanel, when the variable armed = 0. And I want also to show panels for different weapontypes depending on the value of armed.
E.g.
armed = 1 - pistolammo
armed = 2 - rifleammo
I also tried to work with INVISIBLE and TRANSLUCENT, but both don't work for me. Since I noticed that INVISIBLE is only for Level-Entitys, I worked with TRANSLUCENT from this point.
Here's my code so far:
The ammo and armed variables are global.
Am I doing something wrong? I did this a year ago the same way, and it worked just fine. (unfortunately I don't have the code any more)
Would be really thankful for help,
Shooter
I'm trying to hide my ammopanel, when the variable armed = 0. And I want also to show panels for different weapontypes depending on the value of armed.
E.g.
armed = 1 - pistolammo
armed = 2 - rifleammo
I also tried to work with INVISIBLE and TRANSLUCENT, but both don't work for me. Since I noticed that INVISIBLE is only for Level-Entitys, I worked with TRANSLUCENT from this point.
Here's my code so far:
The ammo and armed variables are global.
Code:
function hud() { //armed = 0 - unarmed //armed = 1 - Pistol //armed = 2 - Rifle //armed = 3 - Shotgun PANEL* pistol_muni_pan = { digits(1450,925,3,"Arial#150b",1,ammo_pistol); flags = TRANSLUCENT; } pistol_muni_pan.alpha = 0; PANEL* rifle_muni_pan = { digits(1450,925,3,"Arial#150b",1,ammo_rifle); flags = TRANSLUCENT; } rifle_muni_pan.alpha = 0; while(armed > 0) { switch(armed) { case 1: pistol_muni_pan.alpha = 100; case 2: rifle_muni_pan.alpha = 100; } wait(1); } pistol_muni_pan.alpha = 0; rifle_muni_pan.alpha = 0; }
Am I doing something wrong? I did this a year ago the same way, and it worked just fine. (unfortunately I don't have the code any more)
Would be really thankful for help,
Shooter