Modme Forums
Menu:

How to give a weapon in BLack Ops 3?

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: WARDOGSK93
So im tryign to give my self weapons from script but everytime i try this i just a a "struct is not an entity" error







What i have tried so far



player GiveWeapon("ray_gun"); // Didnt think this would work
// -----------------------------------------
player GiveWeapon(GetWeapon("ray_gun"));
// -----------------------------------------
weapon = GetWeapon("ray_gun");

player GiveWeapon(weapon);
// -----------------------------------------
#using scripts\zm\_zm_weapons;

weapon = GetWeapon("ray_gun");

player zm_weapons::weapon_give(weapon);
// -----------------------------------------
#using scripts\zm\_zm_weapons;

player zm_weapons::weapon_give("ray_gun");
// -----------------------------------------
// tried all of the above but adding a SEE BELOW before them to make sure everything gets init'ed
level waittill("between_round_over");


ModmeBot:

Reply By: MiKeY_

weapon = getWeapon(<string name="">);
player giveWeapon( weapon );</string>


ModmeBot:

Reply By: WARDOGSK93
thats what ive tried but the game keeps throwing a error "struct is not a entity"



heres my script, currently its all commetded out cause no matter how i type it i just keep getting the same error and not being given the weapon



#using scripts\codescripts\struct;

#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\compass;
#using scripts\shared\exploder_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\laststand_shared;
#using scripts\shared\math_shared;
#using scripts\shared\scene_shared;
#using scripts\shared\util_shared;

#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;

#insert scripts\zm\_zm_utility.gsh;

#using scripts\zm\_zm;
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_utility;
#using scripts\zm\_zm_score;
#using scripts\zm\_zm_weapons;

#namespace wardog_test_script;

function pre_init()
{
    callback::on_connect(&test_player_connect);
}

function test_player_connect()
{
//    level waittill("between_round_over");

//    weapon = GetWeapon("pistol_standard");
//    knife = GetWeapon("knife");
//    grenade = GetWeapon("frag_grenade");
    
//    string = "smg_standard";
//    weapon = getWeapon(string);
//    knife = GetWeapon("knife");
//    grenade = GetWeapon("frag_grenade");

//    self zm_weapons::weapon_give("smg_standard");
//    self zm_weapons::weapon_give(GetWeapon("smg_standard"));
//    self giveWeapon(weapon);
//    self SwitchToWeapon(weapon);
//    self zm_weapons::give_build_kit_weapon(weapon);
//    self zm_weapons::weapon_give(weapon, false, false, false, true);
//    self SetWeaponAmmoClip(weapon, 1);
//    self SetWeaponAmmoStock(weapon, 0);

//    self GiveWeapon(knife);

//    self zm_utility::set_player_melee_weapon(knife);

//    self GiveWeapon(grenade);
//    self SetWeaponAmmoClip(grenade, 1);

//    self zm_utility::set_player_lethal_grenade(grenade);
}


ModmeBot:

Reply By: WARDOGSK93
Wow the reason this wasnt workign was cause of a stupid typo i made in my callback system :( im so dumb See typo