Custom Loadout Once Every restart

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.
 
Should be simple enough i'll look into it for you a little bit later today if you'd like and repost my findings for you.
 
I would really be interested in this as well... possibly something more like a time I think would be easier... maybe once every 2 hours? (I know some servers only restart every 12 hours)
 
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.
 
Thats great news, i hope you can figure it out. it would be great if i can get something like this on my server. Thank you in advance!
 
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.

I'm not entirely sure I understand how it knows where to find the tables, but this is the routine in server_playerlogin.sqf that I believe handles it. You can see where it's replacing the backpack, model and inventory from the "cust_loadout" table. (cl.'model', cl.'backpack', cl.'inventory')

You can also see at the tail end it has a "where" statement to evaluate that player's survivor ID against the loadout ID in order to select the proper loadout. I've been staring at the same thing trying to figure out how to write an on death routine to change someone's loadout ID when they die; based on their humanity, survival time, or kill stats.


Code:
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);
 
            };
 
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!!
 
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!!
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.

You guys are awesome cant wait for the results!
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.
 
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! :p) and the second time it'll come back true (because it has happened! :p) and if the check comes back true then it'll skip the part in the code that checks for cl and clp. make sense?
 
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! :p) and the second time it'll come back true (because it has happened! :p) and if the check comes back true then it'll skip the part in the code that checks for cl and clp. make sense?

For iFeeStylin's request that should indeed work. I'm trying to do something a bit different in the other thread though.
 
ok iFeeStylin! i do believe i HAVE your solution! it's not tested yet though so i might be speaking to soon! ive been up for like 72+ hours (i have a sleeping disorder :/ ) so imma lay down and hopefully get like 30 mins of zzs i'll test this later tonight and let you know what i find for sure ! :p
 
I'm afraid to say that i have spoken too soon. i'm making progress thats for sure but not in the direction i was hoping lol! will keep working on this thanks for understanding :)
 
i was just about to post about this and found this thread so il resurrect it and see if anyone knows how to only have a loadout once per restart to prevent people gathering death loot over and over
i call a custom loadout in my init.sqf if that effects how this works.
 
No idea if this would work but I'm using something similar to this for vehicles that can only be spawned once per restart.

server_playerlogin.sqf
Code:
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";
        };
    };
 
Back
Top