Question Magic Box Zombies !

amand

Known Member
Messages
12
Points
118
Hello cabconmodding.com, Today, I need help on a script, I'll explain myself.

I would like to do a magic box but hey I'm bad coder.
I tried to make a magic box but when I take Mule Kick and I suicide and I redo a box bah the box always gives me three guns so every time bah her withdraws me all points and removes all my weaponshere I can tell you it's been a few weeks since I'm working on this code thanks for your understanding.

Here is My Code:

Code:
Secret_Room_Magic_Box()[/CENTER]
{
        level thread LowerMessage( "Magic_Box", "Hold [{+usereload}] For Mystery Box [Cost: 950]" );
        level.MagicWeapons = spawn( "script_model", (-3078.46, -624.872, 1494.13));
        level.MagicBox = spawn( "script_model", (-3078.46, -624.872, 1494.13));
        level.MagicBox setModel("p6_anim_zm_magic_box");
        level.Blockers = spawn( "script_model", (-3078.46, -612.872, 1530.13));
        level.Blockers setModel("collision_clip_sphere_64");
        level.MagicBox2 = spawn( "trigger_radius", (-3078.46, -624.872, 1494.13), 1, 50, 10 );
        level.MagicBox2 SetCursorHint( "HINT_NOICON" );
        level.MagicBox2 UseTriggerRequireLookAt();
        level.MagicBox2 setLowerMessage( level.MagicBox2, "Magic_Box" );
        level.MagicBox rotateTo((0, 0, 0), .1);
        level.MagicBox2 rotateTo((0, 0, 0), .1);
        level.MagicWeapons rotateTo((0, 0, 0), .1);
        for(;;)
        {
                level.MagicBox2 waittill( "trigger", i );
                if( i UseButtonPressed() && i.score >= 950 && level.MagicBoxOpended == false )
                {
                        i.WeaponsList = [];
                        i.WeaponsList[0] = "galil_zm";
                        i.WeaponsList[1] = "m1911_zm";
                        i.WeaponsList[2] = "fivesevendw_zm";
                        i.WeaponsList[3] = "fiveseven_zm";
                        i.WeaponsList[4] = "ak74u_zm";
                        i.WeaponsList[5] = "mp5k_zm";
                        i.WeaponsList[6] = "pdw57_zm";
                        i.WeaponsList[7] = "kard_zm";
                        i.WeaponsList[8] = "870mcs_zm";
                        i.WeaponsList[9] = "rottweil72_zm";
                        i.WeaponsList[10] = "saiga12_zm";
                        i.WeaponsList[11] = "srm1216_zm";
                        i.WeaponsList[12] = "m14_zm";
                        i.WeaponsList[13] = "saritch_zm";
                        i.WeaponsList[14] = "m16_zm";
                        i.WeaponsList[15] = "fnfal_zm";
                        i.WeaponsList[16] = "dsr50_zm";
                        i.WeaponsList[17] = "barretm82_zm";
                        i.WeaponsList[18] = "svu_zm";
                        i.WeaponsList[19] = "lsat_zm";
                        i.WeaponsList[20] = "hamr_zm";
                        i.WeaponsList[21] = "usrpg_zm";
                        i.WeaponsList[22] = "m32_zm";
                        i.WeaponsList[23] = "an94_zm";
                        i.WeaponsList[24] = "ray_gun_zm";
                        i.WeaponsList[25] = "slowgun_zm";
                        i.WeaponsList[26] = "raygun_mark2_zm";
                        i.WeaponsList[27] = "knife_ballistic_zm";
                        i.WeaponsList[28] = "tar21_zm";
                        i.WeaponsList[29] = "rnma_zm";
                        i.WeaponsList[30] = "beretta93r_zm";
                        i.WeaponsSelected = RandomInt( i.WeaponsList.size );
                        level.MagicBoxOpended = true;
                        level.MagicBox2 hide();
                        play_sound_at_pos( "open_chest", (-3078.46, -612.872, 1530.13));
                        play_sound_at_pos( "music_chest", (-3078.46, -612.872, 1530.13));
                        i.score -= 950;
                        MyWeapon = i getCurrentWeapon();
                        self DisableOffhandWeapons();
                        self DisableWeaponCycling();
                        self AllowLean( false );
                        self AllowAds( false );
                        self AllowSprint( false );
                        self AllowProne( false );
                        self AllowMelee( false );
                        wait( 0.05 );
                        if ( self GetStance() == "prone" )
                        {
                        self SetStance( "crouch" );
                        }
                        i giveWeapon( "zombie_knuckle_crack" );
                        i switchToWeapon( "zombie_knuckle_crack" );
                        level.MagicWeapons setModel(getWeaponModel(i.WeaponsList[i.WeaponsSelected]));
                        level.MagicWeapons MoveTo(level.MagicBox.origin + (0,0,55),2.3);
                        self waittill( "weapon_change_complete" );
                        i takeWeapon( "zombie_knuckle_crack" );
                        self EnableOffhandWeapons();
                        self EnableWeaponCycling();
                        self AllowLean( true );
                        self AllowAds( true );
                        self AllowSprint( true );
                        self AllowProne( true );
                        self AllowMelee( true );
                        w = i GetWeaponsListPrimaries();
                        if( IsDefined( w ) && w.size > 2 && level.Mule_Kick == true)
                        {
                            i takeWeapon( MyWeapon );
                        }
                        else if( IsDefined( w ) && w.size > 1 && level.Mule_Kick == false)
                        {
                            i takeWeapon( MyWeapon );
                        }
                        i giveweapon( "knife_zm" );
                        i weapon_give( i.WeaponsList[i.WeaponsSelected] );
                        i givemaxammo( i.WeaponsList[i.WeaponsSelected] );
                        i switchToWeapon( i.WeaponsList[i.WeaponsSelected] );
                        i play_weapon_vo( i.WeaponsList[i.WeaponsSelected] );
                        level.MagicWeapons MoveTo(level.MagicBox.origin,2.3);
                        wait 2.8;
                        level.MagicBoxOpended = false;
                        level.MagicBox2 show();
                }
                wait .1;
        }
[CENTER]}
Excuse Me For My Bad English I'm French.​
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,299
Points
548
Code:
Secret_Room_Magic_Box()
{
        level thread LowerMessage( "Magic_Box", "Hold [{+usereload}] For Mystery Box [Cost: 950]" );
        level.MagicWeapons = spawn( "script_model", (-3078.46, -624.872, 1494.13));
        level.MagicBox = spawn( "script_model", (-3078.46, -624.872, 1494.13));
        level.MagicBox setModel("p6_anim_zm_magic_box");
        level.Blockers = spawn( "script_model", (-3078.46, -612.872, 1530.13));
        level.Blockers setModel("collision_clip_sphere_64");
        level.MagicBox2 = spawn( "trigger_radius", (-3078.46, -624.872, 1494.13), 1, 50, 10 );
        level.MagicBox2 SetCursorHint( "HINT_NOICON" );
        level.MagicBox2 UseTriggerRequireLookAt();
        level.MagicBox2 setLowerMessage( level.MagicBox2, "Magic_Box" );
        level.MagicBox rotateTo((0, 0, 0), .1);
        level.MagicBox2 rotateTo((0, 0, 0), .1);
        level.MagicWeapons rotateTo((0, 0, 0), .1);
        for(;;)
        {
                level.MagicBox2 waittill( "trigger", i );
                if( i UseButtonPressed() && i.score >= 950 && level.MagicBoxOpended == false )
                {
                        i.WeaponsList = [];
                        i.WeaponsList[0] = "galil_zm";
                        i.WeaponsList[1] = "m1911_zm";
                        i.WeaponsList[2] = "fivesevendw_zm";
                        i.WeaponsList[3] = "fiveseven_zm";
                        i.WeaponsList[4] = "ak74u_zm";
                        i.WeaponsList[5] = "mp5k_zm";
                        i.WeaponsList[6] = "pdw57_zm";
                        i.WeaponsList[7] = "kard_zm";
                        i.WeaponsList[8] = "870mcs_zm";
                        i.WeaponsList[9] = "rottweil72_zm";
                        i.WeaponsList[10] = "saiga12_zm";
                        i.WeaponsList[11] = "srm1216_zm";
                        i.WeaponsList[12] = "m14_zm";
                        i.WeaponsList[13] = "saritch_zm";
                        i.WeaponsList[14] = "m16_zm";
                        i.WeaponsList[15] = "fnfal_zm";
                        i.WeaponsList[16] = "dsr50_zm";
                        i.WeaponsList[17] = "barretm82_zm";
                        i.WeaponsList[18] = "svu_zm";
                        i.WeaponsList[19] = "lsat_zm";
                        i.WeaponsList[20] = "hamr_zm";
                        i.WeaponsList[21] = "usrpg_zm";
                        i.WeaponsList[22] = "m32_zm";
                        i.WeaponsList[23] = "an94_zm";
                        i.WeaponsList[24] = "ray_gun_zm";
                        i.WeaponsList[25] = "slowgun_zm";
                        i.WeaponsList[26] = "raygun_mark2_zm";
                        i.WeaponsList[27] = "knife_ballistic_zm";
                        i.WeaponsList[28] = "tar21_zm";
                        i.WeaponsList[29] = "rnma_zm";
                        i.WeaponsList[30] = "beretta93r_zm";
                        i.WeaponsSelected = RandomInt( i.WeaponsList.size );
                        level.MagicBoxOpended = true;
                        level.MagicBox2 hide();
                        play_sound_at_pos( "open_chest", (-3078.46, -612.872, 1530.13));
                        play_sound_at_pos( "music_chest", (-3078.46, -612.872, 1530.13));
                        i.score -= 950;
                        MyWeapon = i getCurrentWeapon();
                        self DisableOffhandWeapons();
                        self DisableWeaponCycling();
                        self AllowLean( false );
                        self AllowAds( false );
                        self AllowSprint( false );
                        self AllowProne( false );
                        self AllowMelee( false );
                        wait( 0.05 );
                        if ( self GetStance() == "prone" )
                        {
                        self SetStance( "crouch" );
                        }
                        i giveWeapon( "zombie_knuckle_crack" );
                        i switchToWeapon( "zombie_knuckle_crack" );
                        level.MagicWeapons setModel(getWeaponModel(i.WeaponsList[i.WeaponsSelected]));
                        level.MagicWeapons MoveTo(level.MagicBox.origin + (0,0,55),2.3);
                        self waittill( "weapon_change_complete" );
                        i takeWeapon( "zombie_knuckle_crack" );
                        self EnableOffhandWeapons();
                        self EnableWeaponCycling();
                        self AllowLean( true );
                        self AllowAds( true );
                        self AllowSprint( true );
                        self AllowProne( true );
                        self AllowMelee( true );
                        w = i GetWeaponsListPrimaries();
                        if( IsDefined( w ) && w.size > 2 && self hasPerk("specialty_additionalprimaryweapon"))
                        {
                            i takeWeapon( MyWeapon );
                        }
                        else if( IsDefined( w ) && w.size > 1 && !self hasPerk("specialty_additionalprimaryweapon"))
                        {
                            i takeWeapon( MyWeapon );
                        }
                        i giveweapon( "knife_zm" );
                        i weapon_give( i.WeaponsList[i.WeaponsSelected] );
                        i givemaxammo( i.WeaponsList[i.WeaponsSelected] );
                        i switchToWeapon( i.WeaponsList[i.WeaponsSelected] );
                        i play_weapon_vo( i.WeaponsList[i.WeaponsSelected] );
                        level.MagicWeapons MoveTo(level.MagicBox.origin,2.3);
                        wait 2.8;
                        level.MagicBoxOpended = false;
                        level.MagicBox2 show();
                }
                wait .1;
        }
}
Only thing you'll need todo is make a check for when a player goes down, and take away one of their weapons.
 

amand

Known Member
Messages
12
Points
118
OK I understood Thank you so much for helping me !!!
 
Last edited:
Top