Creating a Donator Box to Spawn

Sevealin

New Member
Im attempting to create a box that spawns on selected player which contains Items in a .sqf.
Here is the Donator Script which is what makes the box on the selected player

Code:
//AlPMaker
_max = 10; snext = false; plist = []; pselect5 = "";
{if ((_x != player) && (getPlayerUID _x != "")) then {plist set [count plist, name _x];};} forEach entities "CAManBase";
{if ((count crew _x) > 0) then {{if ((_x != player) && (getPlayerUID _x != "")) then {plist set [count plist, name _x];};} forEach crew _x;};} foreach (entities "LandVehicle" + entities "Air" + entities "Ship");
smenu =
{
_pmenu = [["",true]];
for "_i" from (_this select 0) to (_this select 1) do
{_arr = [format['%1', plist select (_i)], [12],  "", -5, [["expression", format ["pselect5 = plist select %1;", _i]]], "1", "1"]; _pmenu set [_i + 2, _arr];};
if (count plist > (_this select 1)) then {_pmenu set [(_this select 1) + 2, ["Next", [13], "", -5, [["expression", "snext = true;"]], "1", "1"]];}
else {_pmenu set [(_this select 1) + 2, ["", [-1], "", -5, [["expression", ""]], "1", "0"]];};
_pmenu set [(_this select 1) + 3, ["Exit", [13], "", -5, [["expression", "pselect5 = 'exit';"]], "1", "1"]];
showCommandingMenu "#USER:_pmenu";
};
_j = 0; _max = 10; if (_max>9) then {_max = 10;};
while {pselect5 == ""} do
{
[_j, (_j + _max) min (count plist)] call smenu; _j = _j + _max;
WaitUntil {pselect5 != "" or snext};
snext = false;
};
if (pselect5 != "exit") then
{
_name = pselect5;
{
if(name _x == _name) then
{
hint format ["Spawning $5 Donator Package for: %1", _name];
_abox = "AmmoBoxBig" createVehicle (position _x);
execVM "admintools\cargo.sqf";
sleep 0.25;
};
} forEach entities "CAManBase";
};

And here is the cargo.sqf that is its resource from the file above

Code:
_abox = _this select 0;
_dayz_wep =["M14_EP1","AK_47_M","RPG7V","Stinger","RPG18","Saiga12K","MetisLauncher","M136","Javelin","SMAW","G36a","BAF_L85A2_RIS_ACOG","BAF_L85A2_RIS_Holo","BAF_LRR_scoped_W","BAF_L85A2_RIS_SUSAT","BAF_L85A2_UGL_ACOG","BAF_L85A2_UGL_Holo","BAF_L85A2_UGL_SUSAT","BAF_L86A2_ACOG","BAF_LRR_scoped","G36C","BAF_L7A2_GPMG","G36_camo","G36K",
  "revolver_gold_EP1","AK_107_GL_kobra","M4A1_HWS_GL","Remington870_lamp","M4A3_CCO_EP1","M4A1_AIM_SD_camo","BAF_L85A2_RIS_CWS","BAF_AS50_scoped","Winchester1866","LeeEnfield","revolver_EP1","FN_FAL","FN_FAL_ANPVS4","m107_DZ",
           "Mk_48_DZ","DMR","M16A2","M16A2GL","bizon_silenced","AK_74","M4A1_Aim","AKS_74_kobra","AKS_74_U","AK_47_M","M24","M1014","M4A1","MP5SD","MP5A5","huntingrifle","Crossbow","glock17_EP1","M9",
           "M9SD","Colt1911","UZI_EP1","Binocular","Binocular_Vector","NVGoggles","ItemGPS","ItemMap","ItemCompass","ItemWatch","ItemFlashlight","ItemFlashlightRed","ItemKnife","ItemHatchet","ItemMatchbox",
           "ItemEtool","ItemToolbox"];
 
_dayz_mag =["30Rnd_556x45_Stanag","30Rnd_556x45_G36","30Rnd_556x45_G36SD","PG7V","PG7VL","R_RPG18_AT","AT13","EvMoney","8Rnd_B_Saiga12_74Slug","8Rnd_B_Saiga12_Pellets","PG7VR","EvDogTags","OG7","M_Javelin_AT","CDF_dogtags","M_Stinger_AA","SMAW_HEAA","SMAW_HEDP","SmokeShell","HandGrenade_Stone","SmokeShellRed","SmokeShellGreen","SmokeShellYellow","SmokeShellOrange","SmokeShellPurple","SmokeShellBlue","TrapBear","5Rnd_86x70_L115A1","30Rnd_9x19_UZI_SD","30Rnd_545x39_AK","30Rnd_545x39_AKSD","30Rnd_762x39_AK47","30Rnd_556x45_StanagSD","20Rnd_762x51_DMR",
  "30Rnd_762x39_AK47","5Rnd_762x51_M24","10Rnd_127x99_m107","8Rnd_B_Beneli_74Slug","1Rnd_HE_M203","FlareWhite_M203",
           "FlareGreen_M203","1Rnd_Smoke_M203","200Rnd_556x45_M249","8Rnd_B_Beneli_Pellets","30Rnd_9x19_MP5","30Rnd_9x19_MP5SD","100Rnd_762x51_M240","15Rnd_W1866_Slug","5x_22_LR_17_HMR",
           "10x_303","15Rnd_9x19_M9","15Rnd_9x19_M9SD","7Rnd_45ACP_1911","17Rnd_9x19_glock17","8Rnd_9x18_Makarov","6Rnd_45ACP","8Rnd_9x18_Makarov","BoltSteel","Mine","MineE","HandGrenade_west",
           "FoodSteakRaw","FoodSteakCooked","FoodCanBakedBeans","FoodCanSardines","FoodCanPasta","ItemSodaCoke","ItemSodaPepsi","ItemSodaMdew","ItemWaterbottle","HandRoadFlare","HandChemGreen","HandChemBlue",
           "HandChemRed","ItemSandbag","ItemTankTrap","ItemWire","ItemBandage","ItemPainkiller","ItemMorphine","ItemEpinephrine","ItemAntibiotic","ItemBloodbag","ItemHeatPack","PartWoodPile","PartWheel",
           "PartFueltank","PartGlass","PartEngine","PartGeneric","PartVRotor","ItemJerrycan","ItemGenerator","ItemTent","Skin_Soldier1_DZ","Skin_Survivor2_DZ","Skin_Camo1_DZ","Skin_Sniper1_DZ"];
 
_dayz_bpk =["DZ_Patrol_Pack_EP1","DZ_Assault_Pack_EP1","DZ_CivilBackpack_EP1","DZ_ALICE_Pack_EP1","DZ_Backpack_EP1"];
 
{_abox addWeaponCargo [_x,100];} forEach _dayz_wep;
{_abox addMagazineCargo [_x,100];} forEach _dayz_mag;
{_abox addBackpackCargo [_x,2];} forEach _dayz_bpk;


The box is spawning, but with nothing inside, and also when I spawn the box on myself by using...
Code:
_abox = "AmmoBoxBig" createVehicle (position player);
 
[_abox] execVM "admintools\cargo.sqf";
The box works perfectly fine, but anything else I can't get anything to spawn inside.
 
This is what I have if it gives you a better idea on how to set it up.

Code:
_classname = "USBasicWeaponsBox";
_mypos = getposATL player;
_dir = getdir player;
_mypos = [(_mypos select 0)+2*sin(_dir),(_mypos select 1)+2*cos(_dir), (_mypos select 2)];
_spawn = createVehicle [_className, _mypos, [], 0, "CAN_COLLIDE"];
_spawn setDir _dir;
_spawn setposATL _mypos;
 
_weapons = [
    "M4A1",
    "bizon_silenced",
    "MP5A5",
    "Winchester1866",
    "M1014",
    "AKS_74_U",
    "BAF_L85A2_RIS_Holo",
    "AK_74"
 
];
 
_magazine = [
    "HandGrenade_West",
    "Skin_Soldier1_DZ"
 
];
 
_magazine2 = [
    "30Rnd_556x45_Stanag",
    "64Rnd_9x19_SD_Bizon",
    "8Rnd_B_Beneli_74Slug",
    "5Rnd_762x51_M24",
    "30rnd_9x19_MP5",
    "15Rnd_W1866_Slug",
    "100Rnd_762x51_M240",
    "30Rnd_545x39_AK"
 
];
 
clearWeaponCargoGlobal _spawn;
clearMagazineCargoGlobal _spawn;
 
{_spawn addWeaponCargoGlobal [_x, 3];} forEach _weapons;
{_spawn addMagazineCargoGlobal [_x, 2];} forEach _magazine;
{_spawn addMagazineCargoGlobal [_x, 30];} forEach _magazine2;

Credit goes to whoever posted this code in Blue Phoenix's Admin Tools thread. I just added some extra stuff to it to make it more customizable.
 
Guys I would really like this can you tell me how to set this up and where to put the files like do i have to put a peice of code in player_login.sqf or something ?
 
Back
Top