Jump to content
  • 0

Donator gear with database


marsjee

Question

Hello,

So I used reality dayz package for a very long time. They have a very good working donator gear package with datavase function. I thought it would be cool and nice to have that in the epoch package aswell.

I'm not good at arma coding, I do understand the code when reading it but thats it.
Maybe someone here can help or maybe even the epoch dev crew wants this in a release ?
 

 

PlayerLogin.sqf

// Check custom inventory for new characters
if (_model == "") then {
        _key = format["CHILD:999:select replace(cl.`inventory`, '""', '""""') inventory, replace(cl.`backpack`, '""', '""""') backpack, replace(coalesce(cl.`model`, 'Survivor2_DZ'), '""', '""""') model from `cust_loadout` cl join `cust_loadout_profile` clp on clp.`cust_loadout_id` = cl.`id` where clp.`unique_id` = '?':[%1]:",str(_playerID)];
        _data = "HiveEXT" callExtension _key;

        //Process result
        _result = call compile format ["%1", _data];
        _status = _result select 0;

        if (_status == "CustomStreamStart") then {
                if ((_result select 1) > 0) then {
                        _data = "HiveEXT" callExtension _key;
                        _result = call compile format ["%1", _data];
                        _inventory = call compile (_result select 0);
                        _backpack = call compile (_result select 1);
                        _model = call compile (_result select 2);
                };
        };
};


create table if not exists cust_loadout (
  id bigint unsigned not null auto_increment,
  inventory varchar(2048) not null,
  backpack varchar(2048) not null,
  model varchar(100) default null,
  
  primary key pk_cust_loadout (id)
) character set utf8 engine=InnoDB;
 
create table if not exists cust_loadout_profile (
  cust_loadout_id bigint unsigned not null,
  unique_id varchar(128) not null,
 
  primary key pk_cust_loadout_profile (cust_loadout_id, unique_id),
  foreign key fk1_cust_loadout_profile (cust_loadout_id) references cust_loadout (id),
  foreign key fk2_cust_loadout_profile (unique_id) references profile (unique_id)
) character set utf8 engine=InnoDB;

Anybody that can help me with this? Please let me know :)

Link to comment
Share on other sites

Recommended Posts

  • 0

NO why data base style when you can do it mission.pbo style! :P 

Add in init
 

[] ExecVM "Donator".sqf";

Donator.sqf
 

waitUntil {!isNil ("PVDZE_plr_LoginRecord")};
if ((getPlayerUID player) in ["########","#######","######","########"]) then {DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar"];
DefaultWeapons = ["ItemMap","ItemFlashlight","ItemHatchet"];
DefaultBackpack = "DZ_Patrol_Pack_EP1";
DefaultBackpackWeapon = "";
 

Then add your stuff to that^^

Link to comment
Share on other sites

  • 0

NO why data base style when you can do it mission.pbo style! :P 

Add in init

 

[] ExecVM "Donator".sqf";

Donator.sqf

 

waitUntil {!isNil ("PVDZE_plr_LoginRecord")};
if ((getPlayerUID player) in ["########","#######","######","########"]) then {DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar"];
DefaultWeapons = ["ItemMap","ItemFlashlight","ItemHatchet"];
DefaultBackpack = "DZ_Patrol_Pack_EP1";
DefaultBackpackWeapon = "";
 

Then add your stuff to that^^

 

How to make multiple kits?

Link to comment
Share on other sites

  • 0

On server restart the file is unlocked in the mission folder. A file holding the array of donator UIDs could be edited then by code.

Not ideal as it requires a wait until server restart.

I have done some work on custom loadouts from the db. not sure how much more data that object_data table really needs currently. Is something I plan on picking up again, currently working on the bus and similar AI missions..

Link to comment
Share on other sites

  • 0

On server restart the file is unlocked in the mission folder. A file holding the array of donator UIDs could be edited then by code.

Not ideal as it requires a wait until server restart.

I have done some work on custom loadouts from the db. not sure how much more data that object_data table really needs currently. Is something I plan on picking up again, currently working on the bus and similar AI missions..

Hi,

I think adding this donator pack or something like it would make lots of server owners happy :)

And it's not really hard either is it :) ?

Link to comment
Share on other sites

  • 0

NO why data base style when you can do it mission.pbo style! :P 

Add in init

 

[] ExecVM "Donator".sqf";

Donator.sqf

 

waitUntil {!isNil ("PVDZE_plr_LoginRecord")};
if ((getPlayerUID player) in ["########","#######","######","########"]) then {DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar"];
DefaultWeapons = ["ItemMap","ItemFlashlight","ItemHatchet"];
DefaultBackpack = "DZ_Patrol_Pack_EP1";
DefaultBackpackWeapon = "";
 

Then add your stuff to that^^

reading this code looks like kid forgot to close with a '}' at the end, could be wrong

 

 

I like it, but I also want the standard load-out to be custom. What would be nice is a logic for multiple load-outs in one .sqf.

 

something like

waitUntil {!isNil ("PVDZE_plr_LoginRecord")};

if ((getPlayerUID player) in ["########","#######","######","########"]) then {
     DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar"];
     DefaultWeapons = ["ItemMap","ItemFlashlight","ItemHatchet"];
     DefaultBackpack = "DZ_Patrol_Pack_EP1";
     DefaultBackpackWeapon = "";
     }
     elseif moderator {
          insert mod gear
          }
          elseif admin{
               insert admin gear
               }
               elseif non of the above{
                    insert standard gear
                    }

but i don't know the proper syntax for a flowing "elseif" tree

 

does any one know? i need 5 different load-outs. Admins, moderators, Pro-Donators, Donators, Standard

Link to comment
Share on other sites

  • 0

 

im sorry, but the logic of a "switch" statement confuses me.

waitUntil {!isNil ("PVDZE_plr_LoginRecord")};

switch true do {
    case ((getPlayerUID player) in ["17061521","39658331","10646734"])  :  //Admins: 
        {
        DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","20Rnd_B_AA12_74Slug","20Rnd_B_AA12_74Slug","20Rnd_B_AA12_Pellets","ItemGoldBar10oz"];
        DefaultWeapons = ["glock17_EP1","AA12_PMC","Binocular_Vector","NVGoggles","ItemMap","ItemCompass","ItemGPS","ItemWatch","ItemKnife","Itemtoolbox","ItemCrowbar","Itemetool","ItemHatchet"];
        DefaultBackpack = "DZ_LargeGunBag_EP1";
        DefaultBackpackWeapon = "";
        };
    case ((getPlayerUID player) in ["125624940","63905682"])  : //Moderators: 
        {
        DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","8Rnd_B_Saiga12_74Slug","8Rnd_B_Saiga12_74Slug","8Rnd_B_Saiga12_Pellets","ItemGoldBar10oz"];
        DefaultWeapons = ["glock17_EP1","Saiga12K","Binocular_Vector","NVGoggles","ItemMap","Itemtoolbox"];
        DefaultBackpack = "DZ_GunBag_EP1";
        DefaultBackpackWeapon = "";
        };
    case ((getPlayerUID player) in ["123456789"])  : //Pro-Donators:
        {
        DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar"];
        DefaultWeapons = ["ItemMap","ItemFlashlight","ItemHatchet"];
        DefaultBackpack = "DZ_Patrol_Pack_EP1";
        DefaultBackpackWeapon = "";
        };
    case ((getPlayerUID player) in ["234567891"])  : //Donators:
        {
        DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar"];
        DefaultWeapons = ["ItemMap","ItemFlashlight","ItemHatchet"];
        DefaultBackpack = "DZ_Patrol_Pack_EP1";
        DefaultBackpackWeapon = "";
        };
    default  //Default Loadout
        {
        DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar"];
        DefaultWeapons = ["ItemMap","ItemFlashlight","ItemHatchet"];
        DefaultBackpack = "DZ_Patrol_Pack_EP1";
        DefaultBackpackWeapon = "";
        };
};

That doesnt work...sad panda.

 

I have called it after the full moon syntax in the init.sqf and at the end of the init.sqf, i have died, respawned 3 times with each configuration. notepad++ shows "case" in blue bold text but "default" is in regular black text?

 

I'm lost.

Link to comment
Share on other sites

  • 0

Don't seem that confused as that works perfectly :)

 

Get rid of 

waitUntil {!isNil ("PVDZE_plr_LoginRecord")};

Is wasteful and totally unrequired.

 

Make sure that donator.sqf is run in 

if (!isDedicated) then {....};

and it must be before the line

_playerMonitor = [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";	

as that is when the loadouts are set..

 

This is my section of init.sqf and it works:

if (!isDedicated) then {
	//Conduct map operations
	0 fadeSound 0;
	waitUntil {!isNil "dayz_loadScreenMsg"};
	dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
	
	//Donator
	[] execVM "tools\donator.sqf";
	
	//Run the player monitor
	_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
	_playerMonitor = 	[] execVM "\z\addons\dayz_code\system\player_monitor.sqf";	
	_void = [] execVM "R3F_Realism\R3F_Realism_Init.sqf";
	
	//Lights
	[0,0,true,true,false,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
	
	//Waypoint Generator
	["","","",[false,objNull]] execVM "modules\init_waypoint_generator_choose.sqf";
	
	//Zombie Sheild
	[] execVM "tools\zed_shield.sqf";
	
	//Admin Vehicle Spawn
	["","","",[false,objNull]] execVM "vehicle\init_vehicle_spawn.sqf";	
	
	
};
Link to comment
Share on other sites

  • 0

O.o this is much easeir to read^^  thanks axeman!!!  So my question with this is there is only one SQF correct?  And that is called by the Init file in mission PBO?  and can i just take out the

        DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar"];
        DefaultWeapons = ["ItemMap","ItemFlashlight","ItemHatchet"];
        DefaultBackpack = "DZ_Patrol_Pack_EP1";
        DefaultBackpackWeapon = ""

thats in my init file?  I would think yo uwould since this just falls out of switch into default correct?  And most importanly the Switch does work then?

Link to comment
Share on other sites

  • 0

The DefaultMagazines / weapons etc. variables are global. So long as they are set before the player monitor is run they will work.

So yes, they can be set further up in init.sqf with the rest of the epoch variables

If they aren't set then the default / basic loadout will be applied.

Link to comment
Share on other sites

  • 0

is my switch statement correct?

 

Yah no, the default load-out isnt working?

 

Axeman's tweak of the placement and removal of unneeded code is great, but I swear the switch statement is wrong when it gets to default. Did I mis-type it? As I said previously the "default" syntax isn't recognized by the .sqf parser in Notepad++, which leaves me to believe that its wrong.

 

Can I just use a blank "case" statement, as the fist ones should complete the logic? Or do I need to use a case statement that asks if the player ID doesn't match the above IDs?

Link to comment
Share on other sites

  • 0

is my switch statement correct?

 

Yah no, the default load-out isnt working?

 

Axeman's tweak of the placement and removal of unneeded code is great, but I swear the switch statement is wrong when it gets to default. Did I mis-type it? As I said previously the "default" syntax isn't recognized by the .sqf parser in Notepad++, which leaves me to believe that its wrong.

 

Can I just use a blank "case" statement, as the fist ones should complete the logic? Or do I need to use a case statement that asks if the player ID doesn't match the above IDs?

 

Are you sure your aren't missing some syntax before the default statement ?

 

Have just tried it and it works fine with the default loadout. My notepad++ parses the default fine, is highlighted in blue..

switch true do {
    case ((getPlayerUID player) in ["12345678","39658331","10646734"])  :  //Admins: 
        {
        DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","20Rnd_B_AA12_74Slug","20Rnd_B_AA12_74Slug","20Rnd_B_AA12_Pellets","ItemGoldBar10oz"];
        DefaultWeapons = ["glock17_EP1","AA12_PMC","Binocular_Vector","NVGoggles","ItemMap","ItemCompass","ItemGPS","ItemWatch","ItemKnife","Itemtoolbox","ItemCrowbar","Itemetool","ItemHatchet"];
        DefaultBackpack = "DZ_LargeGunBag_EP1";
        DefaultBackpackWeapon = "";
        };
    case ((getPlayerUID player) in ["125624940","63905682"])  : //Moderators: 
        {
        DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","8Rnd_B_Saiga12_74Slug","8Rnd_B_Saiga12_74Slug","8Rnd_B_Saiga12_Pellets","ItemGoldBar10oz"];
        DefaultWeapons = ["glock17_EP1","Saiga12K","Binocular_Vector","NVGoggles","ItemMap","Itemtoolbox"];
        DefaultBackpack = "DZ_GunBag_EP1";
        DefaultBackpackWeapon = "";
        };
    case ((getPlayerUID player) in ["123456789"])  : //Pro-Donators:
        {
        DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar"];
        DefaultWeapons = ["ItemMap","ItemFlashlight","ItemHatchet"];
        DefaultBackpack = "DZ_Patrol_Pack_EP1";
        DefaultBackpackWeapon = "";
        };
    case ((getPlayerUID player) in ["234567891"])  : //Donators:
        {
        DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar"];
        DefaultWeapons = ["ItemMap","ItemFlashlight","ItemHatchet"];
        DefaultBackpack = "DZ_Patrol_Pack_EP1";
        DefaultBackpackWeapon = "";
        };
    default  //Default Loadout
        {
        DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar"];
        DefaultWeapons = ["ItemMap","ItemFlashlight","ItemHatchet"];
        DefaultBackpack = "DZ_LargeGunBag_EP1";
        DefaultBackpackWeapon = "";
        };
};
Link to comment
Share on other sites

  • 0

I have respawned multiple times with my uid removed from the admins list. and all i get and a bandage, painkillers, and a flashlight.

 

Its saposed to give me 2 bandages, a g17, 2 mags, morphine, and painkillers.

 

If I am in the admin list it works flawlessly. (g17, aa12, full medkit/kit and large gunbag)

 

Im going crazy trying to get it to work. I will post my .sqf when im done configuring it.

Link to comment
Share on other sites

  • 0

yea this is working great for me.  i would defiantly check your gear that you put into the code.  i have went through every level and also let it go out to default and everything is working with no errors.  I also commented out my default load out gear in my Init file to make sure nothing conflicted.  

Link to comment
Share on other sites

  • 0

Well i seemed to have borked it somewhere some how. I gave up and went to the simpler if statement.

//Default Loadout
DefaultMagazines = ["ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemMorphine","ItemPainkiller","ItemWaterbottleBoiled","FoodSteakCooked"];
DefaultWeapons = ["glock17_EP1","ItemFlashlight","ItemHatchet"];
DefaultBackpack = "DZ_Patrol_Pack_EP1";
DefaultBackpackWeapon = "";

//Admin Loadout
if ((getPlayerUID player) in ["########","#######","########"]) then {  //Admins: Name, Name, Name
	DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","20Rnd_B_AA12_74Slug","20Rnd_B_AA12_Pellets","20Rnd_B_AA12_Pellets","ItemGoldBar10oz"];
	DefaultWeapons = ["glock17_EP1","AA12_PMC","Binocular_Vector","NVGoggles","ItemMap","ItemCompass","ItemGPS","ItemWatch","ItemKnife","Itemtoolbox","ItemCrowbar","Itemetool","ItemHatchet"];
	DefaultBackpack = "DZ_LargeGunBag_EP1";
	DefaultBackpackWeapon = "";
	};

//Moderator Loadout
if ((getPlayerUID player) in ["########","########","#######","#########"]) then {   //Moderators: Name, Name, Name, Name
	DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","8Rnd_B_Saiga12_Pellets","8Rnd_B_Saiga12_Pellets","8Rnd_B_Saiga12_74Slug","ItemGoldBar10oz"];
	DefaultWeapons = ["glock17_EP1","Saiga12K","Binocular_Vector","NVGoggles","ItemMap","Itemtoolbox"];
	DefaultBackpack = "DZ_Backpack_EP1";
	DefaultBackpackWeapon = "";
	};

//Pro-Donator Loadout
if ((getPlayerUID player) in ["#########"]) then {  //Pro-Donators: 
	DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","8Rnd_B_Beneli_Pellets","8Rnd_B_Beneli_Pellets","8Rnd_B_Beneli_74Slug","ItemGoldBar10oz"];
	DefaultWeapons = ["M9SD","Remington870_lamp","Binocular","ItemMap","ItemCompass","ItemFlashlightRed","ItemKnife","ItemMatchbox","ItemHatchet"];
	DefaultBackpack = "DZ_GunBag_EP1";
	DefaultBackpackWeapon = "";
	};

//Donator Loadout
if ((getPlayerUID player) in ["#########"]) then {  //Donators: 
	DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar","15Rnd_W1866_Slug","15Rnd_W1866_Slug"];
	DefaultWeapons = ["glock17_EP1","Winchester1866","ItemMap","ItemFlashlightRed","ItemHatchet"];
	DefaultBackpack = "DZ_ALICE_Pack_EP1";
	DefaultBackpackWeapon = "";
	};

I used an 'if' statement after the default load-out to change it if any player matches. I fully works so I'm sticking with it, I have no idea why the default loadout wouldn't work.

Link to comment
Share on other sites

  • 0

This caused a rather odd issue. It keeps kicking all my players for vehicle restricition #0. This to my understanding meant that all my players are spawning in as birds...

 

I have a test server set up wich has exactly the same server and mission pbo as my main server. It works on that one but when I do it to my main server it doesn't... Any idea's anyone?

 

My donator sqf is an exact copy of yours, Axeman

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...