Jump to content

iben

Member
  • Posts

    100
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by iben

  1. 15 hours ago, Hooty said:

    Just installed working great for me.  After pulling vehicles out of garage it takes like 5 seconds for the paint to come back, no biggie. Great Work easy install instructions, thanks for showing all the paint code for easy merging.

    yeah, painting local object globally uses deprec. method and can be slow in some scenarios I guess. Seems garage is one of them...

  2. Hello guys,

    currently busy working on boring real life project always looking forward to rest time with DayZ Epoch.
    And because I'm lazy and doing stupid things like moving addons root folder up and down during
    my experiments - and always asking why my smart computer do not update path itself :)) -
    I decided support my lazy nature and write simple function which helps with paths a little bit.
    To be more precise, I wrote two variants - basic and extended. Well, will see if basic version
    will be found usefull. So here it is...

    ===

    But first - big Thank you to these guys:

    • DayZ Epoch developers, collaborators and contributors (thank you guys for your excellent work!)
    • Karel Moricky from Bohemia Interactive for his simple and clever idea how to extract mission root.

    ===

    Changelog:

    • [2017-06-19], v1.0 | Initial release

    ===

    Read "Goodbye". Wish you the best guys!

    ===

    How to install:

    It's completely up to you. Pick one way to load it to fits your needs:

    • as a separate file in your custom compiles;
    • in the beginning of your addon compiled init code;
    • just #include fnc in header of your addon compiled init code;
    • use your custom fnc library (using config);

    ===

    Why could be usefull?

    In my opinion, it's in every addon developer best interest to make addon
    as much as possible usable for user without extra steps. Not because
    you are user's slave :)), just because you save yourself answering questions
    leads to well known discovery - user didn't update the path (because he/she/it don't
    want to have this addon in mission root, but in customized server pack structure - this is usually my case).
    Using this fnc you can make your addon 'portable' like (I mean in mission folder boundaries).

    ===

    How to use it?

    • Remember 1 - this function returns first parent folder path relative to mission folder.
    • Remember 2 - you can use "zero based" option as second argument, which means, you can decide if you want to include "\" at the end of your path.
    • Remember 3 - you can uncomment '__IDEBUG__' and see some usefull info in your RPT logfile.
    • Remember 4 - you are developer - so again - choose your way that fills your needs the best.

    ===

    Let's take some practical examples:

    = Example 1: service point remake by @salival

    //src: service_point.sqf, line 39 - original
    
    // ---------------- CONFIG START ----------------
    diag_log "Service Points: loading config...";
    
    // general settings
    _folder = "scripts\service_points\"; // folder where the service point scripts are saved, relative to the mission file
    
    // Now you can change it to:
    _folder = [__FILE__,true] call fnc_IBEN_base_ROOTer; // this addon needs "\" at the end of path, so we set second argument (zero based option) "true"

    = Example 2: your custom addon (or more structured addons uses default Epoch files)

    // Create global variable:
    MyAddonROOTfolder = call {
    
      // ... code from fnc - see bellow
    
    };
    
    // ... or
    MyAddonROOTfolder = [__FILE__] call fnc_IBEN_base_ROOTer;
    
    // and just use it as a root base for your addon. Good news is it's compiled fnc so you can use it anywhere, right?

    ===

    How it looks like?

    // ===========================================================================
    // FUNCTIONS LIBRARY >> PATH MANIPULATION >> fnc_base_ROOTer.sqf
    // ===========================================================================
    // @Function name: fnc_IBEN_base_ROOTer
    // ===========================================================================
    // @Info:
    //  - Created by @iben for DayzEpoch 1.0.6.1+
    //  - Version: 1.0, Last Update [2017-06-19]
    //  - Credits:
    //   * DayZ Epoch developers, collaborators and contributors
    //     (thank you guys for your excellent work!)
    //   * @Karel Moricky from Bohemia Interactive for his idea how to extract
    //     mission root.
    // @Remarks:
    //  - This is basic version of IBEN_ROOTer, which means, it's able to find
    //    first parent folder path related to file calling this function.
    //    Output path is relative to mission folder.
    //    For more options look for extended version: 'fnc_IBEN_ext_ROOTer'
    // @Parameters:
    //  - current file (use __FILE__ macro)                              | string
    //  - zero based (true == "\", false == "" at the end of path)
    //    zero based is optional parameter (default false)               | boolean
    // @Prerequisities:
    //  - none
    // @Example:
    //  - #Example01: File in 'mission\a\b\file.sqf'
    //    * [__FILE__] call IBEN_fnc_base_ROOTer;
    //      output: path: 'a\b'
    //  - #Example02:File in 'mission\a\b\file.sqf'
    //    * [__FILE__,true] call IBEN_fnc_base_ROOTer;
    //      output: path (zero based): 'a\b\'
    // @Returns:
    //  - string
    // ===========================================================================
    // @Parameters Legend:
    //  * _a = _fil
    //  * _b = _cfg
    //  * _c = _ext
    //  * _d = _zeroBased
    //  * _e = _filArrRev
    //  * _f = _start1
    //  * _g = _end1
    //  * _j = _bs
    //  * _k = _start2
    //  * _l = _end2
    //  * _r = _result
    // ===========================================================================
    
    // IBEN_fnc_base_ROOTer = {
    
      // #define __IDEBUG__
    
      private ["_a","_b","_c"];
      _a = toArray (_this select 0);
      _b = toArray (str missionConfigFile);
      _c = count (toArray "description.ext");
    
      private "_d";
      // _d = false;
      _d = [false,_this select 1] select ((count _this > 1));
    
      // Reverse _a array, shorten it for speed by cutting virtual path
      private ["_e","_f","_g"];
      _e = [];
      _f = ((count _b) - _c);
      _g = ((count _a) - 1);
    
      private "_i";
      for "_i" from _g to _f step -1 do {
        _e set [count _e, (toString [_a select _i])];
      };
    
      // Find first backlash character position from reversed arr (_e)
      private "_j";
      _j = _e find "\";
      // Manage zero based find by user decision
      _j = [_j + 1,_j] select (_d);
    
      // Exit script if backslash wasn't found (already in root)
      if (_j < 0) exitWith {
        diag_log format
        [
          "=== [DEBUG] 'IBEN_fnc_base_ROOTer' refused path export! You are loading file [[ %1 ]] from MPMissions root - you don't need to use this function."
          ,__FILE__
        ];
      };
    
      // While we know last backlash position (or first in reversed file array),
      // export string with clean first parent folder path (relative to MPMission folder)
      private ["_k","_l","_r"];
      _k = _j;
      _l = ((count _e) - 1);
      _r = "";
    
      private "_y";
      for "_y" from _l to _k step -1 do {
        _r = format ["%1%2",_r,(_e select _y)];
      };
    
      #ifdef __IDEBUG__
      diag_log format
      [
        "=== [DEBUG] Addon relative root: [[ %1 ]], 'IBEN_fnc_base_ROOTer' output typeName: [[ %2 ]]. [[ File: %3, line %4 ]]"
        ,_r
        ,(typename _r)
        ,__FILE__
        ,__LINE__
      ];
      #endif
    
      _r
    
    // };
    
    // === :: FUNCTIONS LIBRARY >> PATH MANIPULATION >> fnc_base_ROOTer.sqf :: END

    ===

    That's it... Have Fun, stay cool!
    Cheers...

    ===

  3. Hello guys,

    when I read @nova post mentioned "[...] if you go into an area too fast [...] loot wont spawn.", suddenly I remember the first time I installed custom loot tables and was wondering how it's possible there is mostly no loot around my way. So I went to source code and then I found out :))

    There is nice restriction in player_spawnCheck:

    // source:player_spawnCheck.sqf
    _doNothing = false;
    if (_inVehicle) then {
      // ...
      if (_speed > 25) exitwith {_doNothing = true;}; // @here we go!
      //...
    };
    
    if (_doNothing) exitwith {}; // @well, this is bad :)
    
    // ... because code for loot is bellow :)

    So, I have to admit, I'm extremely lazy when developing... so I'm using vehicles with boosted speed (TP is too quick for me, no fun during testing :))
    Well, if this is your case, stay on foot or adjust above code to be sure there will be loot for you :))

    Cheers

    PS: If you adjust code too much, be carefull: you will fire loot spawning everywhere you (or players) driving with no reason (you are just passing by)... and this is not good for server perforrmance.

  4. 1 hour ago, azzdayz said:

    Wow I opened up a large can of confusion and didn't realize it. Sorry about that, but it's good that it's helping everyone in the end understand something that apparently needed some clarification.

    I will try and remove WAI messages (remote.sqf) tonight and see if everything still works. I played around with remote msg (remote_messages.sqf) and couldn't get it to work. I am sure it is just because I still don't fully understand, but trial and error will teach me.

    One question though, it sounds like they are basically the same script only one is edited a little bit to allow additional functions should you choose. Does that sound about right?

     

    Yaeah mate,

    you uderstood it well :)

    • if you have WAI installed, one remote msg file, let's say basic version, comes with WAI files.
    • If you have ZSC (coins) installed second remote msg file, let's say now -  extended version, comes with ZSC files.

    Well, from your perspective, both files do the same - send msg from server to client (player). From very basic point of view, ZSC (coins) version is able to sent more types of msgs.
    It means:

    • if you have ZSC in your files, you don't need WAI original version. If you remove WAI version, everything will work OK unless you will not follow ZSC instructions how to load remote_messages.sqf files in init.sqf.
    • If you have ZSC in your files and you'll remove ZSC version of remote msg (and keep WAI version only), you'll get error, because ZSC uses for example private msgs based on your UID.

    As you can see, it confused me as well :)) - because I was answering in one post about public EH and remote msgs and used as an example remote msg file - extended version - but didn't know
    where the file comes from :)))) Now it's clear because of @salival answer in thread - and maybe it could be meantioned in ZCS install instructions if it's not done already.

  5. 4 hours ago, azzdayz said:

    Thanks to both of you. You have helped fill in the blanks perfectly. I unknowingly installed the remote messages when I put coins on the server. I saw it later and didn't understand why I had it or if i was using it so I started researching it. Next thing I knew I was completely lost. With all the research and a basic understanding of reading the code I came to the conclusion I mentioned in the beginning, but now I understand.

      I have a test server so I might play around with it and see whats what, but should I decide not to take on the task then I will remove. At least now I know for sure I can :)

    Hi mate, see bellow post and: do not remove customized version of remote msg which comes from ZSC script (or you will get error when money script will try to send you private msg). You can safely remove default WAI instead - if you do and don't touch any other code, everything should works perfectly (using radio msg in WAI). Everything esle I wrote in my post is valid - I mean if you want to change msgs using "RemoteMessage". Cheers

  6. 4 hours ago, salival said:

    I include remote_messages.sqf in ZSC so we can utilize it if a player packs a safe/lockbox with coins in it: https://github.com/oiad/ZSC/blob/master/dayz_server/compile/server_handleSafeGear.sqf#L122-L123

    It's the easiest way to send a message to a player from the server plus WAI uses it so...

    Well @salivalthat's finally clarify where original code I was reffering to comes from and kills my confusion :smile: Well done, I'm gonna update relevant topic talking about this because we have the winner :)) Thx a lot for this, very usefull...

  7. Hi @azzdayz,
    let me try to clarify confusion about remote msgs.
    You're mixing two types of code which do the same, but slightly differently.

    I'll guess: you visited topic in this section "Dynamic text issue" and used customized file for
    remote msgs. If so, here is the start of your confusion:

    The first code for remote msg showing above in the first spoiler is default one, using radio msgs only
    and calling, in this case, default RE function for remote msg (which means, uses two types of public EH
    - default one from arma files, second one from WAI to call default one from arma)

    The second piece of code is customized version and it uses just one custom public EH + added possibility
    to use more types of msgs. The main reason of custom remote msgs file is use it not just along with WAI,
    but everywhere in your scripts so you can change the default behaviour of your msgs.

    You wrote about changing color with BIS_fnc_dynamicText function.
    The reason why it's not working for you is this: you have to change code in WAI file named "mission_winorfail.sqf"

    // This is part of mission_winoffail.sqf that needs to be changed:
    
    // Mission start msg
    if (wai_radio_announce) then {
      RemoteMessage = ["radio","[RADIO] " + _msgstart];
      publicVariable "RemoteMessage";
    } else {
      [nil,nil,rTitleText,_msgstart,"PLAIN",10] call RE;
    };
    
    // Mission win msg
    if (wai_radio_announce) then {
      RemoteMessage = ["radio","[RADIO] " + _msgwin];
      publicVariable "RemoteMessage";
    } else {
      [nil,nil,rTitleText,_msgwin,"PLAIN",10] call RE;
    };
    
    // Mission fail msg
    if (wai_radio_announce) then {
      RemoteMessage = ["radio","[RADIO] " + _msglose];
      publicVariable "RemoteMessage";
    } else {
      [nil,nil,rTitleText,_msglose,"PLAIN",10] call RE;
    };
    
    // ... all of this has to be changed

    ===

    If you want to use dynamic text with customized version of remote msgs file, you have to change:
    (it's needed everytime you decide to use different type of remote msg (radio, global chat, dyn. text etc - just follow instructions in code)

    RemoteMessage = ["dynamic_text","["your text 1line","your text 2line"]]; // custom text 2 lines
    publicVariable "RemoteMessage";
    
    RemoteMessage = ["dynamic_text","[_msgstart,"your text 2line"]]; // default WAI text 1line, custom text 2line
    publicVariable "RemoteMessage";
    
    // The confusion part is, dynamic text case comes with two paramaters in array:
    _message = _this select 1; // in the beginning of code
    //...for dynamic text (check the source code) it's:
    [_message select 0, _message select 1] // in dyn. text part

    ===

    You can of course change customized code to fits you needs.
    If I may to give you any advice, I would say something like:
    stay with your default file on live server and use it safely. Try to change and customize and play with remote msg on your local machine so you can experiment safely.

    ===

    Cheers

  8. 23 hours ago, juandayz said:

    i had writed this old for my 1.0.5.1 is a Blackjack game... you can adjust to use in 1.6.1 using the new salival ZSC function to add-remove money or the iben function for the same.

    How this works? you set an scroll menu option on one of your trader and execute this scritp.

      Reveal hidden contents
    
    
    private ["_rand","_added","_costs"];
    
    
    _costs = 500;
    
    if (_neartrader) then {
    	if !([ player,_costs] call SC_fnc_removeCoins) then {
    		titleText [format["Needs %1 %2 for gambling.",_costs,CurrencyName] , "PLAIN DOWN", 1];
    	} else {
    	titleText [format["you pay %1  %2 %3",_costs,CurrencyName] , "PLAIN DOWN", 1];
    
    			_rand = floor(random 200);
    			
    			if (_rand <= 50) then {
    				
    				titleText ["You took 24 you lost", "PLAIN DOWN"];titleFadeOut 5; 
    			};
    			if (_rand <= 150 && _rand > 51) then {
    				_added = [player, 1000] call SC_fnc_addCoins;
    				[format["<t size='1.2' color='#D01000'>WOW 21!!!!%1</t><br/><t size='0.9'>WIN 1.000!!!!.</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;  
    			};
    			if (_rand <= 180 && _rand > 151) then {
    				
    				titleText ["you take 18 I take 20you lost", "PLAIN DOWN"];titleFadeOut 5;
    			};
    			if (_rand <= 200 && _rand > 181) then {
    				titleText ["You take 20, But its my day 21! you lost", "PLAIN DOWN"];titleFadeOut 5;
    						};
        };
      };	

     

    @DAmNRelentless i think you can update it in a minute, its very easy... just need a time prevention to not use again and use

    Here you got a quick update to start to work.

    
    _depositMoneyin = "cache";//bank is the other option//works if u have the @iben function and true below
    _fn_SC_uniCoins = true;//set false if u dont have @iben funcion
    _Reward = 1000;
    _cost = 100;
    _coins = player getVariable [Z_moneyVariable,0];
    
    if (_coins < _cost) then {
        cutText[format["You need %1 coins to play this game!",_cost], "PLAIN DOWN"];
    } else {
    titleText [format["you pay %1 coins goodluck",_cost] , "PLAIN DOWN", 1];
    sleep 1;
    player setVariable[Z_moneyVariable, (_coins - _cost), true];
    _rand = floor(random 100);
    if (_rand <= 70) exitWith {
    _cardtext = [
    "24",
    "22",
    "23",
    "25",
    "19"
    ]call BIS_fnc_selectRandom;
    
    titleText [format["You took %1 ...looser",_cardtext], "PLAIN DOWN",2]; 
    			};
    	
    if (_rand <= 100 && _rand > 71) then {
    [format["<t size='1.2' color='#D01000'>WOW 21!!!!%1</t><br/><t size='0.9'>WIN %2!!!!.</t>",(name player),_Reward],0,0,2,2] spawn BIS_fnc_dynamicText; 
     if (_fn_SC_uniCoins) then {
         [player,_Reward,"add",_depositMoneyin] call fnc_SC_uniCoins;
        } else {
          _coins = _coins + _Reward;
          player setVariable[Z_moneyVariable,_coins,true];
        };
    };	
    };

     

    Hi guys,
    code bellow is adjusted to be used with fnc_SC_uniCoins function + some optimization for speed:

    private ["_moneyTarget","_Reward","_cost","_rand","_cardtext"];
    
    _moneyTarget = "cache";
    _Reward = 1000;
    _cost = 100;
    
    // Exit the game if player is low on money
    if !([player,_cost,"remove",_moneyTarget] call fnc_SC_uniCoins) exitWith {
      cutText[format["You need %1 coins to play this game!",_cost], "PLAIN DOWN"];
    };
    titleText [format["you pay %1 coins goodluck",_cost] , "PLAIN DOWN", 1];
    _rand = floor(random 100);
    
    // Exit immedieatelly when first condition is true
    call {
      if (_rand <= 70) exitWith {
        _cardtext = ["24","22","23","25","19"] call BIS_fnc_selectRandom;
        titleText [format["You took %1 ...looser",_cardtext], "PLAIN DOWN",2];
      };
    
      if (_rand <= 100 && _rand > 71) exitWith {
        [player,_Reward,"add",_moneyTarget] call fnc_SC_uniCoins;
        [format["<t size='1.2' color='#D01000'>WOW 21!!!!%1</t><br/><t size='0.9'>WIN %2!!!!.</t>",(name player),_Reward],0,0,2,2] spawn BIS_fnc_dynamicText;
      };
    };

    Cheers gamblers... :)))

  9.  

     

    Hello guys,

    currently I'm working on couple addons for my server and from time to time,
    when coding, some answers to your questions pops up in my head.
    Couple days ago I was asked about server restart time and uptime. Well,
    why not to share it - BUT... nothing bad about current solution you're probably using!
    In fact, the code for this is everywhere - that's right. I did it my way not because
    I couldn't use common code - but just because I'm still learning a lot - and because I needed
    restart time/uptime solution for my files.
    So here is it... if you want to try, test it and let me know. The true is, I haven't time to test
    it properly. So I'm gonna be happy to hear your thoughts...

    ===

    Big thanks always goes to:

    ===

    Changelog:

    • [2017-06-04], v1.0 | Initial release

    ===

    Read "Goodbye". Wish you the best guys!

    ===

    How it looks like:

    // ===========================================================================
    // FUNCTIONS LIBRARY >> Universal server timer function
    // ===========================================================================
    // @Function name: fnc_IBEN_uniSTime
    // ===========================================================================
    // @Remarks:
    //  - Can be called 2 ways:
    //    * Restart/Uptime with label
    //    * Restart/Uptime without label
    // @Parameters:
    //  - Time for restart cycle in seconds                               | number
    //  - Time mode (values: "restart"/"uptime")                          | string
    //  - Label (example: "Restart in")                                   | string
    // @Related files:
    //  - none
    // @Example:
    //  - For server time we are using global var: SERV_RESTART = 10800; (3h)
    //  - restart time with no label
    //    * [SERV_RESTART,"restart"] call fnc_IBEN_uniSTime;
    //  - restart time with label
    //    * [SERV_RESTART,["restart","Restart in"]] call fnc_IBEN_uniSTime;
    //  - uptime with no label
    //    * [SERV_RESTART,"uptime"] call fnc_IBEN_uniSTime;
    //  - uptime with label
    //    * [SERV_RESTART,["uptime","Time from start"]] call fnc_IBEN_uniSTime;
    // @Returns:
    //  - time string in format: "h:mm", or "Restart in: h:mm"
    // ===========================================================================
    private ["_serverCycle","_timerParams","_timerType","_label","_useLabel","_minArr",
    "_srvTime","_goTime","_leftTime","_opTime","_hours","_y","_minutes","_key","_sub",
    "_notLabel","_useLabel"];
    
    _label = ""; // label reset
    _useLabel = false;
    
    _serverCycle = _this select 0;
    _timerParams = _this select 1;
    if (typeName _timerParams != "ARRAY") then {
      _timerType = _timerParams;
      _useLabel = false;
    } else {
      _timerType = _timerParams select 0;
      _label = _timerParams select 1;
      _useLabel = true;
    };
    
    _minArr = [1,2,3,4,5,6,7,8,9,0];
    _srvTime =  "0h 00min"; // @info: default time
    _goTime = 0;
    _goTime = serverTime;
    _leftTime = (round (_serverCycle - _goTime));
    
    _opTime = [_goTime,_leftTime] select (_timerType == "restart");
    
    if (_leftTime > 0) then {
      _hours = (floor ((_opTime / 60) / 60));
      _minutes = (floor ((_opTime / 60) - (_hours * 60)));
    
      _key = _minutes;
      {
        _sub = _minArr select _x;
        if (_sub == _key) exitWith {
          _minutes = _sub;
        };
      } count _minArr;
    
      _minutes = [_minutes,format["0%1",_minutes]] select (_minutes < 10);
      _notLabel = format ["%1h %2m",_hours,_minutes];
      _incLabel = format ["%1: %2h %3m",_label,_hours,_minutes];
      _srvTime = [_notLabel,_incLabel] select (_useLabel);
    
    } else {
      _srvTime
    };
    _srvTime
    
    
    // === :: fnc_IBEN_uniSTime END

    ===

    Check source code (Github)

    ===

    FEATURES:

    • Not big deal, just small piece of code as output from my work to make things easier...
    • Function is able to output Restart time or Uptime with single line code (see bellow) and can be easily integrated into your code.
    • If you restart system fails (or you with settings :) and time is over, time stays formatted as: '0h:00min'
    • Usage examples: debug monitor, log time (diag_log) etc.
    • It's a function - you can easily maintain your "time" code...

    ===

    How to install:

    It's actually very easy: practical example is the best way to explain, what needs to be done. See repo structure and files.

    Source files are available at Github repo. You can download them from here.

    ===

    How to use it:

    = General usage:

    // @Parameters:
    //  - Time for restart cycle in seconds                               | number
    //  - Time mode (values: "restart"/"uptime")                          | string
    //  - Label (example: "Restart in")                                   | string
    // ==========================================================
    // @Scenario:
    //  - First, we store our server restart time into global variable
    //    so we can easily use it anywhere and change it at once later,
    //    if we want to change time:
    if (isNil SERV_RESTART) then {
      SERV_RESTART = 10800;
    };
    // @example 01: Restart time with no label
    [SERV_RESTART,"restart"] call fnc_IBEN_uniSTime;
    
    // @example 02: Restart time with label
    [SERV_RESTART,["restart","Restart in"]] call fnc_IBEN_uniSTime;
    
    // @example 03: Uptime with label
    [SERV_RESTART,["uptime","Time from start"]] call fnc_IBEN_uniSTime;
    
    // @Returns:
    //  - Time string in format: "h:mm", or "Restart in: h:mm"

    ===

    ...easy enough, isn't it?

    ===

    = Specific usage:

    // === Scenario 01:
    
    // It's very easy to add it to your debug monitor code. In fact, we're not gonna to cover
    // this specific scenario - just look around forum, there are plenty of releases.
    // But... many time I heard question like: "How can I add restart time/uptime to the right
    // bottom screen corner the way how watermark is?".
    // Well, this is our first scenario:
    
    // === What to do:
    // It's actually pretty easy: just grab your files from my repo - how to implement you will
    // easily find out from prepared files - just follow repo structure.
    // Done? OK - so you integrated 'fnc_IBEN_uniSTime' into your compiled files and you can
    // use it now.
    // Everyone has some kind of debug monitor, right? So just add this piece of code:
    
    
    while {1 == 1} do {
      private ["_Tinfo","_Tval",...some local vars];
    
      // ... your debug monitor code
    
    
      // =======================================================================
      // GUI: RESTART TIMEOUT (see picture bellow)
      // (but you can add uptime with/withou label - look for examples above)
      // =======================================================================
      _Tval  = [SERV_RESTART,["restart","Restart in"]] call fnc_IBEN_uniSTime;
      _Tinfo = format ["<t size='.35' align='right' font='TahomaB'>%1</t>", _Tval];
    
      [
        _Tinfo
        ,safezoneX * -1
        ,0.98 * safezoneH + safezoneY
        ,9999
        ,0
        ,0
        ,50009
      ] spawn BIS_fnc_dynamicText;
    
      // your code for parsing text bellow
    
        uiSleep 2;
      };
    
    // === Scenario 02:
    // Let's implement formatted time info into your debug output (logs).
    
    // === What to do:
    // Just add:
    diga_log format ["=== [DEBUG] Player %1 (%2) just found your secret item. [%3]",
                     (name player),
                     getPlayerUID player,
                     [SERV_RESTART,["uptime","Uptime"]] call fnc_IBEN_uniSTime)]];
    // RPT output:
    "=== [DEBUG] Player iben (8542514521...) just found your secret item. [Uptime: 1h:30min]"
    
    // === Done!

    ===

    Screen right bottom time watermark (showcase):

    9134EAA3451FB1C398EE2B5CED387E48747B770F

    ===

    ...that's all... Have Fun!!!
    Cheers...

    ===

  10. 1 minute ago, juandayz said:

    @iben why the hell i need a function....to add coins?.hahah @DAmNRelentless @Anhor lets finish here that we start in dblood mod.. hsha joke. Nice iben. And the examples are separates mods lol.

    :tongue: Thx buddy... as I said in your thread... let's keep the mod (Epoch) alive and thx to all lifekeepers... you deserves a huge THX for you dedication to mod... thx

  11. Just now, DAmNRelentless said:

    @iben

    This could be helpful for some people who wanna also change the ugly titletext but as I said, I have custom messages now. :)

    Pointed. Well, done! And as I said, it could be helpful for you so you don't need to invent the wheel if code it's already there. It's of course valid just in case you have WAI isntalled (which I suppose you do in relation to your text).
    Anyway, good for you buddy,

    Cheers

  12. On 27. 5. 2017 at 4:30 PM, DAmNRelentless said:

    Yeah but that's a titletext and in my opinion this is pretty ugly. I came to that problem when I tried to replace the default titletext WAI messages with dynamic messages because they look a lot better. So yeah, yours is working on serverside if you don't want to avoid messing with sending variables and stuff like that to the client.

    Hi mate,

    I assume you've already find out solution for your situation. But just in case, if I may, a have small notice for this subject.

    I agree, WAI titletext msgs are pretty annoying (you know it when scoping target :)).
    But, let's do not ivent the wheel: WAI core code base has great fully working script for remote msgs which of course uses public EH.
    You can choose which type of msg you want to fire... all you need to do is use:

    // src: original wai code, mission_winorfail in this case
    RemoteMessage = ["radio","[RADIO] " + _msgstart];
    publicVariable "RemoteMessage";

    As you can see, EH takes 2 parameters: (1) type of msg; (2) msg text.
    Now let's look into code bellow post and we can find out, there are these types of msgs:

    • system chat;
    • hint;
    • titleCut;
    • titleText;
    • dayz_rollingMessages;
    • BIS_fnc_dynamicText;

    So, pick one to fits your needs and you good to go.
    Once you have this small file installed and loaded in your init.sqf outside (!isDedicated) and (isServer) part, you can use it everywhere. Just fire pEH.

    ===

    If you aim with your question was scoped on problem which you faced and you want to know what was wrong, the context is important.
    I mean, even if your one line of code is correct, from the momment you passed an argument to it without showing context - nobody can answer your question I think.
    You know it well, there could be no bug in your code, but other server settings (antihack included) can broke your work.
    For example: I use almost exactly the same as you do, but there is no problem on my side.

    Cheers guys...

    EDIT: I'm sorry, I've just looked at WAI github src code and there is basic remote only. Seems I updated and expanded code before (I'm not sure...).
              Just tested (so be sure it's really working) and it is - if you use this code, be carefull about BIS dynTxt - it takes msg text parameter
             as array with two elements (see src)

    EDIT2: Mystery about source code bellow solved: it comes from ZSC from @salival. You can see original here.

    Just in case the code is here:

     

     
    
    fnc_remote_message = {
      private ["_type","_message"];
      _type = _this select 0;
      _message = _this select 1;
      call {
        if (_type == "radio") exitWith {
          if (player hasWeapon "ItemRadio") then {
            if (player getVariable["radiostate",true]) then {
              systemChat _message;
              playSound "Radio_Message_Sound";
            };
          };
        };
        if (_type == "private") exitWith {if(getPlayerUID player == (_message select 0)) then {systemChat (_message select 1);};};
        if (_type == "global") exitWith {systemChat _message;};
        if (_type == "hint") exitWith {hint _message;};
        if (_type == "titleCut") exitWith {titleCut [_message,"PLAIN DOWN",3];};
        if (_type == "titleText") exitWith {titleText [_message, "PLAIN DOWN"]; titleFadeOut 10;};
        if (_type == "rollingMessages") exitWith {_message call dayz_rollingMessages;};
        if (_type == "dynamic_text") exitWith {
          [
            format["<t size='0.40' color='#FFFFFF' align='center'>%1</t><br /><t size='0.70' color='#d5a040' align='center'>%2</t>",_message select 0,_message select 1],
            0,
            0,
            10,
            0.5
          ] spawn BIS_fnc_dynamicText;
        };
      };
    };
    
    "RemoteMessage" addPublicVariableEventHandler {(_this select 1) spawn fnc_remote_message;};
  13. Hello guys,

    because I was couple times asked for updated and unified dev function for single currency (originally posted in ZSC thread),
    I've decided release it here so you can have all info in one place.
    So here it is with specific example (with detailed comments) you can try for fun...

    ===

    First thing first - let's start with giving credits for these great guys:

    ===

    This function was reworked and updated for Epoch 1.0.6.1+

    ===

    Changelog:

    • [2017-05-08], v1.0 | Initial release, published at Epoch forum
    • [2017-05-28], v1.1 | Added: debug (parameters check, exec time to analyze code performace in game)
    • [2017-05-31], v1.2 | Improved: removed unnecessary checks during player sync

    ===

    Read "Goodbye". Wish you the best guys!

    ===

    How it looks like:

    Check source code (Github)

    ===

    FEATURES:

    • Function is able to manage money processing with single line code (see bellow) and can be easily integrated into your code
    • You can use debug option to check your fnc parameters + exec time (code performance) showed on screen (global chat):
      just uncoment line: '#define: __ DEBUG__' is src code;
    • It's pretty fast but remember: use it only if you're developing some addon or you know exactly what to do.
      Otherwise, you can stil use common methods used by addons authors - mostly it's even faster their way, because of scoped approach;
    • It's a function - you can easily maintain your "money" code...

    ===

    How to install:

    It's actually very easy: practical example is the best way to explain, what needs to be done - see repo structure and files.

    Source files are available at Github repo (specific usage example included!). You can download them from here.

    ===

    How to use it:

    = General usage:

    // [_player,_amount,_action,_target] call fnc_SC_uniCoins;
    // '_player' : object : player, _killer...etc
    // '_amount' : number : 1000
    // '_action' : string : 'add'   / 'remove'
    // '_target' : string : 'cache' / 'bank'
    // ==========================================================
    // @example 01: Remove 5.000 Coins from player's wallet:
    [player,5000,'remove','cache'] call fnc_SC_uniCoins;
    
    // @example 02: Add 1.000 Coins to player's wallet:
    [player,1000,'add','cache'] call fnc_SC_uniCoins;
    
    // @example 03: Remove 7.000 Coins from player's bank account:
    [player,7000,'remove','bank'] call fnc_SC_uniCoins;
    
    // @example 04: Add 15.000 Coins to player's bank account:
    [player,15000,'add','bank'] call fnc_SC_uniCoins;

    ===

    ...easy enough, isn't it?

    ===

    Specific usage (with detailed description):

    // === Scenario:
    
    // Award player for killing local zombies.
    // If player kills zombie, he will receive random amount of money from 0 to 250 Coins for kill.
    // Let's make it interesting - player receive money only in case he used the gun defined by you:
    
    // === What to do:
    
    // Save file "local_eventKill.sqf" to your custom compiles folder, load it in your custom compiles file
    // outside (!isDedicated) and (isServer) - we need this file for both client and server.
    // (it's in 'dayz_code' folder: you can download file from:
    // https://github.com/EpochModTeam/DayZ-Epoch/blob/master/SQF/dayz_code/compile/local_eventKill.sqf)
    
    // Open your custom variables file (or add bellow code to your init.sqf file) and add:
    playerZedKillAward = true; // ... so you can quickly turn ON/OFF your script
    
    // Now, let's create some code in 'local_eventKill.sqf' file:
    
    
    if (local _zed) then {
    private["_killer","_fnc_uniCoinsTest","_allowedWps"];
    
      // code
    
      // ...find last line of code:
      _killer setVariable["humanity",_humanity,true];
      // Bellow we define local function "_fnc_killZedsAward" so we can call it easily:
    
      // ===
    
      _fnc_killZedsAward = {
        private ["_action","_target","_money","_curWep"];
    
        _action = _this select 0; // @info: we take parameter from call in main code bellow this fnc and assign value to local var
        _target = _this select 1; // @info: we take parameter from call in main code bellow this fnc and assign value to local var
        _money = (round(random 5) * 50); // @info: now from 0 to 250 Coins, define to your liking
        _curWep = getText (configFile >> 'CfgWeapons' >> currentWeapon _killer >> 'displayName'); // @info: What's the name of player current weapon? We need this for info in hint or dayz_rollingMessages
    
        call {
          // Player has 20% chance to get 0 coins from random (if you will use round(random 5) - meaning staying with 5, scale from 0 to 4)
          // So let's check it first and prevent display msg on screen in such a case
          if (_money == 0) exitWith {
          //@info: You can pick 'dayz_rollingMessages' and comment 'hintSilent' if your hint layer is occupied by your debug monitor
          ["Sorry, our bank is low on money!"] call dayz_rollingMessages;
          hintSilent "Sorry, our bank is low on money!";
          };
          // If random money are above zero, let's call dev fnc_SC_uniCoins.
          // First parameter '_killer' is defined by original code; _money param was defined above,
          // _action and _target parameters we defined in main code bellow...
          if ([_killer,_money,_action,_target] call fnc_SC_uniCoins) exitWith {
          //@info: You can pick 'dayz_rollingMessages' and comment 'hintSilent' if your hint layer is occupied by your debug monitor
            hintSilent format ["Zed kill award!\nweapon: [%1]\nReceived: [%2 %3]",_curWep,_money,CurrencyName];
            [format["Zed kill award! Weapon: [%1] Received: [%2 %3]",_curWep,_money,CurrencyName]] call dayz_rollingMessages;
          };
          // Do not put any default code for call here - if you do, you will trigger code action in cases,
          // like zombie is killed close to you by some accident (from experience)
        };
      };
    
    // Now let's create main procedure:
      if (playerZedKillAward) then {
      // @info: define your custom array of weapons here:
        _allowedWps = [ 
          'M110_NVG_EP1',
          'M9_SD_DZ','DMR_DZ',
          'M9_DZ'
        ];
        if ((currentWeapon _killer) in _allowedWps) exitWith {
           // @info: if player used allowed weapon, tell '_fnc_killZedsAward', what to do with money.
           // You can be creative here :))
          ["add","cache"] call _fnc_killZedsAward;
        };
      };
    
    };
    
    // === Done!

    ===

    ...that's all, you can use it wherever money are... Have Fun!!
    Cheers...

    ===

  14. 1 hour ago, DieTanx said:

    fnc_SC_uniCoins = compile preprocessFileLineNumbers "dayz_code\compile\fnc_SC_uniCoins.sqf";

    could yo explain what/how/why this is?

    i saw in another post, but im not 100 percent sure if its something i needed

     

    ive not used this before- i see its commeted out in variables- is this needed?

    // if (isServer) then {
    //   DZE_safeVehicle = [];
    // };

    Hello,

    first - could you please edit your post and surround quote by spoiler (always use it if your quote is too long)? Thx

    second - 'fnc_SC_uniCoins' is neccesary for script, because it's used for money transaction and player wealth check (player is paying for painting). Without it you get error. Besides, it's universal function for single currency, so it can be used every time you need to manipulate money (if you are developer). More info about fnc_SC_uniCoins you can find in this post.

    third - variables, commented part if(isServer)... it's not neccessary for script - it's just there to visualise spot, where to put paintable vehicles array. You can safely remove it, if you don't need it...

    Hope it helps,

    Cheers

  15. 1 minute ago, LuckBeWitYa said:

    ok well, I found one issue in server_monitor, but as for the init ..I have a server on survival servers so as the set up is different...some of the init are in init.sql and some are in an EpochConfig.sql..... I do not see some things in there as in the Hotfix....rest seems fine just in different locations...thanks for the help....guess I will just have to go code by code and see what's missing and what's changed.

    ok, I think it's in your serverside files anyway... check RPT (mainly server rpt) if there is another warning or error ... good luck!

×
×
  • Create New...