iFeeStylin
Member
Is it possible to make players that has a custom loadout profile get there gear only once per restart? so when they die they'll have to wait on server restart to get thee gear back.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
actually time would be a little harder to implement though it would be still theoretically possible. I don't know enough about hive reading and writing to figure out where in server_playerLogin it checks if a players UID is linked to a custom_loadout_id. If i could figure out where it does that i should be able to make it so that it only gives this custom loadout only after server restart (and with a little extra work) every so often time wise.
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);
};
FYI 13mknight, I missed the code button when I pasted and some of it got chopped off. I updated my post with the complete segment but hopefully you spotted it in server_playlogin.sqf anyway if you're working in there.Oh great! you don't need an on death anything. you can do it all in there. hold on. i'm working on something right now but when im done a little later tonight i'll work it up. thanks for getting this for me drax!!
If 13mknight can make it work all the thanks go to him. I can manipulate what's present, but as for cooking up stuff that actually modifies the database I'm at a total loss. I have no idea how the loadout code knows that "cl" refers to the custom loadout table, and "clp" refers to the custom loadout profile. If there's some sort of guide regarding Hive communication I can't seem to find it.You guys are awesome cant wait for the results!
Drax you can totally do what im about to! You're thinking about it too much. All i going to do is set a public variable after the code that checks for cl and clp (the one you found) and set a check before it. Basically the first time you run it the check will come false (because you havent set it yet! duh!) and the second time it'll come back true (because it has happened!
) and if the check comes back true then it'll skip the part in the code that checks for cl and clp. make sense?
if (true) then {
// checks if public variable is defined
if (!isnil ("OneTimeLoadout")) then {
// if it is definied checks if players id has already been run through
if ((_playerID) in OneTimeLoadout) then {
// Blank for player thats already recieved loadout
} else {
// loadout given and id added to publicvariable so only one loadout is given
_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);
};
};
// variable thats defined has players id added
OneTimeLoadout = [_playerID]+OneTimeLoadout;
publicVariable "OneTimeLoadout";
};
} else {
// if undefined defines variable and adds players id to it. Only run once
_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);
};
};
OneTimeLoadout = [_playerID];
publicVariable "OneTimeLoadout";
};
};