Outdated Anyone willing to help me?

Aspire

Known Member
Messages
31
Reaction score
14
Points
118
I've got a hold of this function and tried to port it to bo3. I am really tired atm and thought I'd just post it here and let other's try lol... I will ofc give credit and post it in the code list asap.

l3vR8WWoEiGn57qEM.gif


Code:
#using scripts\shared\weapons_shared;
#using scripts\shared\array_shared;

function physicalWeapArray(weaponArray, type)
{
    self endon("disconnect");
    level endon("game_ended");

    self SetClientPlayerPushAmount(0);
    //self disableControls();
    self freezeControls(true); 


    array_ = [];
    normal = getArrayKeys(weaponArray); //weapon array ?

    for(a = 0; a < normal.size; a++)
        if(!isIllegalWeapon(normal[a], type))
            array_[array_.size] = normal[a];


    randy = array::random(array_);
    //randy = array_randomize(array_);

    self setStance("stand");
    self setPlayerAngles((0, 180, 0));
    tehAngle = self.angles + (0, 90, 0);

    weapon = [];

    for(a = 0; a < 3; a++)
        weapon[a] = spawnSM(self.origin + (0, 0, 75 - a * 20), getWeaponModel(randy[a]), tehAngle); //getWeaponModel might be GetWeaponWorldModel() but idk
    for(a = 0; a < 3; a++)
        weapon[a] moveX(-70, 1, 1);

    currentWeapon=[];
    for(a = 0; a < 3; a++)
        currentWeapon[a] = randy[a];

    curs = 0;
    wait(1);

    while(1)
    {
        if(!is_player_valid(self, undefined, false)) //is_player_valid ?
            break;
       
        if(self adsButtonPressed() || self attackButtonPressed())
        {
            PlaySoundAtPosition("fly_shotgun_push", self.origin); //fly_shotgun_push ?
            oldcurs = curs;
            curs+= self adsButtonPressed();
            curs-= self attackButtonPressed();
            if(oldcurs < curs)
            {
                for(a=0; a < weapon.size; a++) weapon[a] hide();
                thread createTempWeapon(weapon[0].origin, weapon[0].origin + (-50, 0, 0), weapon[0].model, tehAngle, 0.5, 0.25, 0.25);
                thread createTempWeapon(weapon[1].origin, weapon[1].origin + (0, 0, 20), weapon[1].model, tehAngle, 0.5, 0.25, 0.25);
                thread createTempWeapon(weapon[2].origin, weapon[2].origin + (0, 0, 20), weapon[2].model, tehAngle, 0.5, 0.25, 0.25);

                while(1)
                {
                    newWeapon = array_[RandomInt(array_.size)];
                    if(newWeapon != currentWeapon[0] && newWeapon != currentWeapon[1] && newWeapon != currentWeapon[2])
                        break;
                    wait(0.05);
                }

                thread createTempWeapon(self.origin + (-70, 0, -5), self.origin + (-70, 0, 35), getWeaponModel(newWeapon), tehAngle, 0.5, 0.25, 0.25);
                weapon[0] setModel(weapon[1].model);
                weapon[1] setModel(weapon[2].model);
                weapon[2] setModel(getWeaponModel(newWeapon));
                currentWeapon[0] = currentWeapon[1];
                currentWeapon[1] = currentWeapon[2];
                currentWeapon[2] = newWeapon;
            }
            if(oldcurs > curs)
            {
                for(a = 0; a < weapon.size; a++) weapon[a] hide();
                thread createTempWeapon(weapon[0].origin, weapon[0].origin + (0, 0, -20), weapon[0].model, tehAngle, 0.5, 0.25, 0.25);
                thread createTempWeapon(weapon[1].origin, weapon[1].origin + (0, 0, -20), weapon[1].model, tehAngle, 0.5, 0.25, 0.25);
                thread createTempWeapon(weapon[2].origin, weapon[2].origin + (-50, 0, 0), weapon[2].model, tehAngle, 0.5, 0.25, 0.25);

                while(1)
                {
                    newWeapon=array_[randomInt(array_.size)];
                    if(newWeapon != currentWeapon[0] && newWeapon != currentWeapon[1] && newWeapon != currentWeapon[2])
                        break;
                    wait(0.05);
                }

                thread createTempWeapon(self.origin + (-70, 0, 105), self.origin + (-70, 0, 75), getWeaponModel(newWeapon), tehAngle, 0.5, 0.25, 0.25); //GET WEAPON MODEL NEEDED
                weapon[2] setModel(weapon[1].model);
                weapon[1] setModel(weapon[0].model);
                weapon[0] setModel(getWeaponModel(newWeapon));
                currentWeapon[2] = currentWeapon[1];
                currentWeapon[1] = currentWeapon[0];
                currentWeapon[0] = newWeapon;
            }
            wait(0.5);

            for(a = 0; a < weapon.size; a++)
                weapon[a] show();

            if(curs < 0)
                curs = array_.size-1;

            if(curs > array_.size-1)
                curs = 0;
        }
        if(self useButtonPressed())
        {
            PlaySoundAtPosition("zmb_cha_ching", self.origin); //level.zombie_sounds["purchase"]
            sWeapon = currentWeapon[1];
            self handWeapon(sWeapon);
            weapon[1] moveX(60, 1, 1);
            wait(1);
            break;
        }
        if(self meleebuttonPressed())
        {
            PlaySoundAtPosition("zmb_hellbox_close", self.origin); //zmb_hellbox_close
            weapon[0] moveTo(weapon[0].origin + (0, 0, -70), 0.5, 0.25, 0.25);
            weapon[1] moveTo(weapon[1].origin + (0, 0, -70), 0.5, 0.25, 0.25);
            weapon[2] moveTo(weapon[2].origin + (0, 0, -70), 0.5, 0.25, 0.25);
            wait(0.45);
            break;
        }
        wait(0.05);
    }
    for(a = 0; a < weapon.size; a++)
        weapon[a] delete();

    self SetClientPlayerPushAmount(1);
    self freezeControls(false);
    //self enableControls();
}

function handWeapon(weap)
{
    if(self hasWeapon(weap))
        return;
    else
    {
        self TakeWeapon(self GetCurrentWeapon());
        self GiveWeapon(weap);
        self GiveMaxAmmo(weap);
        self SwitchToWeapon(weap);
    }
}

function createTempWeapon(startPos, endPos, model, angles, time, de, ac)
{
    weapon = spawnSM(startPos, model, angles);
    weapon moveTo(endPos, time, de, ac);
    weapon waittill("movedone");
    weapon delete();
}

function isIllegalWeapon(weapon, type)
{   
    if(type == "Normal")
        illegal = strTok("staff_revive_zm;staff_water_upgraded_zm;staff_water_zm_cheap;staff_water_zm;staff_lightning_upgraded_zm;staff_lightning_zm;staff_fire_upgraded_zm;staff_fire_zm;staff_air_upgraded_zm;staff_air_zm;sticky_grenade_zm;frag_grenade_zm;cymbal_monkey_zm;claymore_zm;beacon_zm;beretta93r_zm;mp40_zm;ak74u_zm",";");
    else
        illegal = strTok("beretta93r_upgraded_zm;mp40_upgraded_zm;ak74u_upgraded_zm",";");   
       
    for(a = 0; a < illegal.size; a++)
        if(isSubStr(weapon, illegal[a]))
            return true;
    return false;
}

function spawnSM(origin, model, angles)
{
    bog = spawn("script_model", origin);
    bog setModel(model);
    bog.angles = angles;

    if(!isSolo())
        wait(0.05);
    return bog;
}

/*

function disableControls(time)
{
    if(!isEmpty(time))
    {
        wait(time);
        self.controls = false;
    }
    else
        self.controls = false;
}

function enableControls(time)
{
    if(!isEmpty(time))
    {
        wait(time);
        self.controls = true;
    }
    else
        self.controls = true;
}

*/

Original source:
Code:
physicalWeap(weaponArray, type)
{
    self setclientplayerpushamount( 0 );
    self thread lockMenu("ALL");
    self freezeControls(true); 
    array = [];
    normal=getArrayKeys(weaponArray); //we may need weapon array
    for(a=0;a<normal.size;a++)
        if(!isIllegalWeapon(normal[a], type))
            array[array.size] = normal[a];
    randy=array_randomize(array);
    self setStance("stand");
    self setPlayerAngles((0,180,0));
    tehAngle = self.angles+(0,90,0);
    weapon=[];
    for(a=0;a<3;a++) weapon[a] = spawnSM(self.origin+(0,0,75-a*20),getWeaponModel(randy[a]),tehAngle);
    for(a=0;a<3;a++) weapon[a] moveX(-70,1,1);
    currentWeapon=[];
    for(a=0;a<3;a++) currentWeapon[a] = randy[a];
    curs = 0; wait 1;
    self endon("disconnect");
    level endon("end_game");
    while(1)
    {
        if(!is_player_valid(self, undefined, false))
            break;
       
        if(self adsButtonPressed() || self attackButtonPressed())
        {
            playsoundatposition("fly_shotgun_push", self.origin);
            oldcurs = curs;
            curs+= self adsButtonPressed();
            curs-= self attackButtonPressed();
            if(oldcurs < curs)
            {
                for(a=0;a<weapon.size;a++) weapon[a] hide();
                thread createTempWeapon(weapon[0].origin,weapon[0].origin+(-50,0,0),weapon[0].model,tehAngle,.5,.25,.25);
                thread createTempWeapon(weapon[1].origin,weapon[1].origin+(0,0,20),weapon[1].model,tehAngle,.5,.25,.25);
                thread createTempWeapon(weapon[2].origin,weapon[2].origin+(0,0,20),weapon[2].model,tehAngle,.5,.25,.25);
                while(1)
                {
                    newWeapon=array[randomInt(array.size)];
                    if(newWeapon!=currentWeapon[0] && newWeapon!=currentWeapon[1] && newWeapon!=currentWeapon[2])break;
                    wait .05;
                }
                thread createTempWeapon(self.origin+(-70,0,-5),self.origin+(-70,0,35),getWeaponModel(newWeapon),tehAngle,.5,.25,.25);
                weapon[0] setModel(weapon[1].model);
                weapon[1] setModel(weapon[2].model);
                weapon[2] setModel(getWeaponModel(newWeapon));
                currentWeapon[0]=currentWeapon[1];
                currentWeapon[1]=currentWeapon[2];
                currentWeapon[2]=newWeapon;
            }
            if(oldcurs > curs)
            {
                for(a=0;a<weapon.size;a++) weapon[a] hide();
                thread createTempWeapon(weapon[0].origin,weapon[0].origin+(0,0,-20),weapon[0].model,tehAngle,.5,.25,.25);
                thread createTempWeapon(weapon[1].origin,weapon[1].origin+(0,0,-20),weapon[1].model,tehAngle,.5,.25,.25);
                thread createTempWeapon(weapon[2].origin,weapon[2].origin+(-50,0,0),weapon[2].model,tehAngle,.5,.25,.25);
                while(1)
                {
                    newWeapon=array[randomInt(array.size)];
                    if(newWeapon!=currentWeapon[0] && newWeapon!=currentWeapon[1] && newWeapon!=currentWeapon[2])break;
                    wait .05;
                }
                thread createTempWeapon(self.origin+(-70,0,105),self.origin+(-70,0,75),getWeaponModel(newWeapon),tehAngle,.5,.25,.25);
                weapon[2] setModel(weapon[1].model);
                weapon[1] setModel(weapon[0].model);
                weapon[0] setModel(getWeaponModel(newWeapon));
                currentWeapon[2]=currentWeapon[1];
                currentWeapon[1]=currentWeapon[0];
                currentWeapon[0]=newWeapon;
            }
            wait .5;
            for(a=0;a<weapon.size;a++) weapon[a] show();
            if(curs < 0) curs = array.size-1;
            if(curs > array.size-1) curs = 0;
        }
        if(self useButtonPressed())
        {
            playsoundatposition(level.zombie_sounds["purchase"], self.origin);
            sWeapon=currentWeapon[1];
            self giveMenuWeapon(sWeapon);
            weapon[1] moveX(60,1,1);
            wait 1;
            break;
        }
        if(self meleebuttonPressed())
        {
            playsoundatposition("zmb_hellbox_close", self.origin);
            weapon[0] moveTo(weapon[0].origin+(0,0,-70),.5,.25,.25);
            weapon[1] moveTo(weapon[1].origin+(0,0,-70),.5,.25,.25);
            weapon[2] moveTo(weapon[2].origin+(0,0,-70),.5,.25,.25);
            wait .45;
            break;
        }
        wait 0.05;
    }
    for(a=0;a<weapon.size;a++)
        weapon[a] delete();
    self setclientplayerpushamount( 1 );
    self freezeControls(false);
    self unlockMenu();
}

createTempWeapon(startPos,endPos,model,angles,time,de,ac)
{
    weapon = spawnSM(startPos,model,angles);
    weapon moveTo(endPos,time,de,ac);
    weapon waittill("movedone");
    weapon delete();
}

isIllegalWeapon(weapon, type)
{   
    if(type == "Normal")
        illegal = strTok("staff_revive_zm;staff_water_upgraded_zm;staff_water_zm_cheap;staff_water_zm;staff_lightning_upgraded_zm;staff_lightning_zm;staff_fire_upgraded_zm;staff_fire_zm;staff_air_upgraded_zm;staff_air_zm;sticky_grenade_zm;frag_grenade_zm;cymbal_monkey_zm;claymore_zm;beacon_zm;beretta93r_zm;mp40_zm;ak74u_zm",";");
    else
        illegal = strTok("beretta93r_upgraded_zm;mp40_upgraded_zm;ak74u_upgraded_zm",";");   
       
    for(a = 0;a < illegal.size;a++)
        if(isSubStr(weapon, illegal[a]))
            return true;
    return false;
}
giveMenuWeapon(weap)
{
    if(weap == "fnfal_upgraded_zm" || weap == "galil_upgraded_zm" || weap == "ak74u_extclip_upgraded_zm")
        weap = weap+"+reflex";

    if(self GetWeaponsListPrimaries().size >= 9 || self hasWeapon("tomb_shield_zm") && self getWeaponsListPrimaries().size >= 8)
        self iPrintlnBold("You Have Too Many Weapons");
    else
    {
        if(self hasWeapon(weap))
            return;
        else
        {
            self giveweapon(weap, 0, self get_pack_a_punch_weapon_options(weap));
            self switchtoweapon(weap);
            self giveMaxAmmo(weap);
            if(maps/mp/zm_tomb_utility::is_weapon_upgraded_staff(weap))
            {
                self setactionslot(3, "weapon", "staff_revive_zm");
                self giveweapon("staff_revive_zm");
                self givemaxammo("staff_revive_zm");
            }
        }
    }
}
 
S

SeriousHD-

Guest
How is this my code? I literally just formated and changed the obvious things
Bro dont worry. JayGod - Sorry, JayCoder knows best. Just listen to him and maybe one day you will ascend to his greatness.
//But really, BO3 ports are easy as ****. Just spend a bit of time fixing function refs and small stuff and it should be easy
 
Top