Jump to content
oSoDirty

[Release] Scroll, Click, or Key press -Server info

Recommended Posts

This is just a really simple script i wrote to display rules for my server. My 1st script so dont be too harsh  ^_^

 

How it works: It detects if you are moving or not and adds a menu to your scroll wheel.  If unedited it will be red and read "rules"

When the action is toggled, more menus (categories) come up, each of these menus triggers a small script to read some messages, or in this case, rules. 

Once the player starts moving again then all menus disappear, Rules is the only menu that remains persistent when stopped

again, rules will again have to be toggled to bring up the other menus. (New Options now included)

 

Before you continue, make sure you have a custom variables.sqf and the custom file for your method of choice before proceeding. If not. Check forums for the tutorial you need and return when prepared.

 

This version HERE has to be closed manually.

 

This version HERE closes the display when you move. 

 

If you have added this already and personalized it you may just want to add this:

waitUntil  { speed player > 0 };
	if (speed player > 0) then {
		(findDisplay 72) closeDisplay 0;
	};	
};

a space below the last closing bracket in each of the files you personalized.  

 

 

 

Screenshots: Menu 1   Menu 2  Menu 3

 

Method 1 - Scroll Wheel

 

This method requires a custom fn_selfActions.sqf  - If you don't have this, look it up and return once you do.

 

Inside fn_selfActions find the line (its very close to the top)

_canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);

 and underneath it place this

//rules start
if(speed player <= 1) then {
    if (s_rules < 0) then {
        s_rules = player addaction[("<t color=""#c70000"">" + ("Rules") +"</t>"),"custom\rules\rules_init.sqf","",-3,false,false,"",""];
    };
} else {
    player removeAction s_rules;
    s_rules = -1;
    };
//rules end

So you should have something similar to this

_onLadder =		(getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);

//rules start
if(speed player <= 1) then {
    if (s_rules < 0) then {
        s_rules = player addaction[("<t color=""#c70000"">" + ("Rules") +"</t>"),"custom\rules\rules_init.sqf","",-3,false,false,"",""];
    };
} else {
    player removeAction s_rules;
    s_rules = -1;
    };
//rules end

_nearLight = 	nearestObject [player,"LitObject"];

 

Method 2 - Right Click

 

This method require a custom Extra_Rc.hpp

 

Add this to the bottom of your Extra_Rc.hpp:

class ItemMap {
        class serverRules {
            text = "Rules";
            script = "execVM 'custom\rules\rules_init.sqf'";
        };
    };

 

Method 3 - Tab Key   Can be changed, just look up dik keycodes and replace the code with one of your choice. Just be careful not to use a banned key if using an anti-hack tool.

 

This method requires a custom dayz_spaceInterrupt.sqf

 

Add this to your dayz_spaceInterrupt.sqf:

if (_dikCode == 0x0F) then {
   execVM 'custom\rules\rules_init.sqf'
    _handled = true;
};

 

Once you have chosen and completed one of the methods above, open variables.sqf and find:

dayz_resetSelfActions = {

and add

s_rules = -1;

in to the array.

 

 

Once you are done with that simply create a folder called custom in you MPMissions folder then place rules folder inside the custom folder. If you have a folder called custom already just use yours.

 

It can be placed in any folder including the root of MPMissions, but you would have to go into fn_selfActions and rules_init and change the paths in the addActions.

 

 

Thanks to, -Ree- for the request post for something like this that made me want to do it.

Thanks to, -Gr8Boi-  for added options found in this post and for showing me how to make this much prettier.

Thanks to,  -Sandbird-  for some tips and helping me debug some last minute issues.

Thanks to,  -CordIAsis-  for the auto removal code.

 

 

Thats all folks!

 

 

Feel free to use, abuse edit, and release any variation you like. Just give us a shout out!

Share this post


Link to post
Share on other sites

Try this Method, looks way better

private["_separator1","_txt"];
cutText ["HOLD LEFT-CLICK ON TEXT AND DRAG UP AND DOWN, PRESS ESCAPE TO CLEAR OR CONTINUE ON BOTTOM!", "PLAIN DOWN"];
sleep 1;
"Hints & Tips" hintC [
                                                            "*No Camping and No Killing Inside or within 400m of Safezones",
                                                            "*No Griefing and No Stealing While inside Safezones",
                                                            "*No unattended vehicles",
                                                            "*They will be deleted",
                                                            "*XX",
                                                            "*XX",
                                                            "*XX",
                                                            "*XX"
];

Share this post


Link to post
Share on other sites

 

Try this Method, looks way better

private["_separator1","_txt"];
cutText ["HOLD LEFT-CLICK ON TEXT AND DRAG UP AND DOWN, PRESS ESCAPE TO CLEAR OR CONTINUE ON BOTTOM!", "PLAIN DOWN"];
sleep 1;
"Hints & Tips" hintC [
                                                            "*No Camping and No Killing Inside or within 400m of Safezones",
                                                            "*No Griefing and No Stealing While inside Safezones",
                                                            "*No unattended vehicles",
                                                            "*They will be deleted",
                                                            "*XX",
                                                            "*XX",
                                                            "*XX",
                                                            "*XX"
];

 

It is indeed. Thank you!

Share this post


Link to post
Share on other sites

Images, pls! :)

Right now it just displays Title Text on screen like a mission would. Nothing special. But i am working on one last thing before i drop the update to make it a bit more prettier (thanks to Gr8Boi)

 

Once i upload the new files ill add some screenshots of the menus. Its kind of personalized as well so ill have to make it a bit more basic before i upload it. Will be out soon!

Share this post


Link to post
Share on other sites

Your first script? Nice work! Feels good doesn't it? :D

I still remember my first script, it was appauling XD

 

Yes, thanks! It does actually lol.

Hopefully one day ill be able look back at it and smh xD

Share this post


Link to post
Share on other sites

What i should edit if I want that the "rules" will be vanished too if I'm moving?

 

Everything lol. Since the dialog is in game it has preset ways for closing it, escape is the fastest way to close it. Unless there is a way to emulate a keypress with commands, which i have not found a way to do. All i have found on the subject is an unanswered forum on Bohemia Interactive. Thus leading me to believe it's not possible to send a keystroke with a command. (would love to be corrected). So unless someone would like to enlighten me on the subject on how to make the hintC dialog go away using  waitUntil or anything similar. Im left to believe the only way is to create your own dialog and write a script to use them instead. I honestly have no intention of doing this. Simply because it goes against what i had planned for this. Which was for it to be simple, small, and not give players access to certain dialogs.

Share this post


Link to post
Share on other sites

 

Not tried it but it should work.

if (player is moving too fast) then {
    (findDisplay 72) closeDisplay 0;
};

 

Well, it's weird lol. The 1st time i tried it i totally derped and put  "<= 0"  for some reason. But it was making it go away and just pop the usual after hint, then realizing my mistake, full of hope i set it to  "> 0". So i tried it and it didn't work. I checked to see if somehow i magically messed it up again. Didn't see anything. So i get the idea to click the action and immediately start running before the display shows up. Well, lol it just flashed and popped the other hint. But if I actually let the display load before proceeding to walk forward it just stays until i cancel it out manually.

Share this post


Link to post
Share on other sites

Mmm, maybe because it wasn't in a loop? Or was it? If it wasn't in some sort of loop then it'd only check the player's speed once and never again which may be the reason why <=0 worked, because you were standing still when the one and only speed check occured.

Try this-

// Your hintC stuff goes here.
[] spawn
{
    waitUntil {!isNull (findDisplay 72)};
    waitUntil {(speed player) > 0};
    (findDisplay 72) closeDisplay 0;
};

EDIT:
If you haven't already and want to remove the standard hint that appears on closing the hintC display you can place this code just underneath your hintC call-

clearhint = (findDisplay 72) displayAddEventHandler ['unload','_this spawn {hintSilent ''; (_this select 0) displayRemoveEventHandler ['unload',clearhint];};']

EDIT2:

You can rename the clearhint, that's not really important, it's just a variable name. Just be sure to rename both instances of it!

 

EDIT3:!! Made a typo, updated it. I used isNil instead of isNull

Share this post


Link to post
Share on other sites

The derps are strong in me tonight. XD

 

I actually did use a waitUntil the first time i tried it.... with  <= 0  lol 

but i removed the waitUntil before i caught the mess up. So the loop was closed before i stopped then? I did take a small walk of shame when it didnt close ^^  

 

Thank you!!!!

 

As far as the clearing of the 2nd hint, when i added it in it just broke the closeDisplay. 

Share this post


Link to post
Share on other sites

Sweet Deal thank you =)

 

I will have to add this in the morning =D

 

question any chance for a Toggle key like "Tab" ("0x0F")  https://community.bistudio.com/wiki/DIK_KeyCodes

"Tab" Brings up Menu

"Tab" Closes Menu

"Move" Closes Menu

 

 

I have special players... had to change Scroll Suicide to a right click action lol

 

 

p.s. you left your .git folders in the zip =) (" in case someone is wondering what they should do with them just remove them =) ")
 

Share this post


Link to post
Share on other sites

lol, i tried to use github, im clueless lol. But as far as i know someone is working on a right click version using maca's right click functions. And at my skill level in coding, i could probably get the actions to show/remove with tab, but im not sure how to make the menu them self without using the scroll. Pretty sure that would require a dialog.

Share this post


Link to post
Share on other sites

Add this to the OP if you want:

 

Right Click Activate :

 

Add this to your Extra_Rc.hpp :

class ItemMap {
        class serverRules {
            text = "Rules";
            script = "execVM 'custom\rules\rules_init.sqf'";
        };
    };

For TAB Key Activate

 

add this to your custom dayz_spaceInterrupt.sqf

if (_dikCode == 0x0F) then {
   execVM 'custom\rules\rules_init.sqf'
    _handled = true;
};

Share this post


Link to post
Share on other sites

Hey guys if im trying to add new tab what would i add here, trying to add the message tab i have it inserted into this text cant try test it yet...to many players online.

also i notice the "-insertnumber ,false,true,"",""]; " keeps going higher what would i put for the message tab? P.S how do ya do the spoiler tabs for code?

 

 

 

 

///////////////////////////////////////////////////////////////////
// Detailed scroll rules ///////////////////////////////////////////
// By oSoDirty ////////////////////////////////////////////////////
// rules initialization  ///////////////////////////////////////////
///////////////////////////////////////////////////////////////////

if(speed player <= 0) then {
    _isDirty = true;
        if(_isDirty) then {
        _rule_set1 = player addAction["PVP","custom\rules\pvp.sqf","",-5,false,true,"",""];
        _rule_set2 = player addAction["mods","custom\rules\mods.sqf","",-6,false,true,"",""];
        _rule_set3 = player addAction["Chat","custom\rules\chat.sqf","",-7,false,true,"",""];
        _rule_set4 = player addAction["Building","custom\rules\building.sqf","",-8,false,true,"",""];
        _rule_set5 = player addAction["Cheating","custom\rules\cheating.sqf","",-9,false,true,"",""];
        _rule_set6 = player addAction["Thanks","custom\rules\thanks.sqf","",-9,false,true,"",""];
        _rule_set7 = player addAction["message","custom\rules\message.sqf","",-9,false,true,"",""];
        waitUntil { speed player > 0 };
            player removeAction _rule_set1;
            player removeAction _rule_set2;
            player removeAction _rule_set3;
            player removeAction _rule_set4;
            player removeAction _rule_set5;
            player removeAction _rule_set6;
            player removeAction _rule_set7;
            _rule_set1 = -1;
            _rule_set2 = -1;
            _rule_set3 = -1;
            _rule_set4 = -1;
            _rule_set5 = -1;
            _rule_set6 = -1;
            _rule_set7 = -1;
            };
        };
    };
};

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Similar Content

    • By icomrade
      Hello all,
      We are pleased to announce the release of ArmA 2 DayZ Epoch 1.0.6, available for download at: http://epochmod.com/a2dayzepoch.php
      This release introduces the integration of some of the most common Epoch community modifications from prior epoch release, DayZ Mod 1.8.8, and a new group system that persists in the database.  Most of the highlights can be found in the change log below, which is fairly comprehensive, but by no means exhaustive.
      Please note that community addons/expansions for previous Epoch release WILL NOT work on Epoch 1.0.6, be sure to review the change log for which mods are now included. In addition, the loot table format has completely changed, you must base your loot table modifications on the new format, which can be found by evaluating the stock loot tables: https://github.com/EpochModTeam/DayZ-Epoch/tree/Release_1.0.6/SQF/dayz_code/Configs/CfgLoot
      1.0.5.1 and older Single Currency scripts are NOT compatible with 1.0.6, there is no included single currency script in this release. However, because we are so wonderful, we have chosen to integrate single currency saving to the DB, so a third-party HiveEXT is not necessary and the SQF is all that needs to be written/updated.
       
    • By gle353
      Ever tired of zombies in your base glitching trouth the walls and hit you while building?
      Ever tried to stay safe for a short pipi-break at your base, come back and got eaten alive?

      Stop it now, Here is the solution!

      1. Open Init.sqf, serach for 

       
      if (DZE_R3F_WEIGHT) then {execVM "\z\addons\dayz_code\external\R3F_Realism\R3F_Realism_Init.sqf";}; and post below:

       
      [] execVM "custom\base_SafeArea.sqf"; Save and close Init.sqf. Now create a folder called "custom" if you dont have one. Now create a new SQF-File called "base_SafeArea.sqf".
      Open it and insert following code in it:
       
      //--------------------------------------------------------------------- // Epoch Base Safe Area // By MadMartyr // Modified from generic ZombieShield code by felixberndt and meat // http://opendayz.net/threads/prevent-zombie-spawning.8799/#post-32461 //--------------------------------------------------------------------- dayz_poleSafeArea = 40; //range of your plotpole safespace while {true} do { sleep 5; // No Zeds near Plot Poles _playerPos = getPos player; _nearPole = nearestObject [_playerPos, "Plastic_Pole_EP1_DZ"]; //You can replace the Plastic_Pole by any other item. Usefull for gemcrating if (!isNull _nearPole) then { _pos2 = getPos _nearPole; _zombies2 = _pos2 nearEntities ["zZombie_Base", dayz_poleSafeArea]; _count2 = count _zombies2; for "_i" from 0 to (_count2 -1) do { _zombie2 = _zombies2 select _i; deleteVehicle _zombie2; }; }; };
      You can change the Range by edit the dayz_poleSafeArea.
      If you use Alchemical Crafting, you can change the "Plastic_Pole_EP1_DZ" in any other placeable.





      All creadits goes to @MadMartyr for posting his code and @ebayShopper for adding the deleteVehicle idea, instead of porting away.

      Original Post:
       
       
    • By tyrant50187
      Im looking for the ability to add Script allowing Eyescan (retina scan) For Safe's and lockboxes, ether or, its something i havent found any script for but have found mentions and seen, any suggestions, links, or scripts are welcome, please Let me know!
    • By Bloodthirsty
      Hey I just need some files for this server, any and all you guys can come up with and think it deserve post that shit in chat rn. I want to see some crazy ideas and additions if you got em :) Lets see what you guys can come up with

    • By randall421
      The loot spawning on my server will respawn or cycle right infrnt of you if you move more than 5m away or if someone else near you moves 5ft away. I check player_spawncheck.sqf and it looks fine. 
      player_spawncheck.sqf 
      //player_spawncheck.sqf private ["_isWreck","_maxControlledZombies","_looted","_zombied","_doNothing","_spawnZedRadius","_serverTime","_age","_nearbyBuildings","_position","_speed","_radius","_maxlocalspawned","_maxWeaponHolders","_currentWeaponHolders","_maxtoCreate","_inVehicle","_isAir","_isLand","_isSea","_Controlledzeddivided","_totalcrew","_nearby","_type","_config","_canSpawn","_dis","_checkLoot","_islocal","_bPos","_zombiesNum"]; _age = -1; //_nearbyBuildings = []; _position = [player] call fnc_getPos; _speed = speed (vehicle player); _radius = 200; //150*0.707; Pointless Processing (106.5) _spawnZedRadius = 20; /* //Tick Time PVDZ_getTickTime = player; publicVariableServer "PVDZ_getTickTime"; */ //Total Counts _maxlocalspawned = round(dayz_spawnZombies); _maxControlledZombies = round(dayz_maxLocalZombies); _maxWeaponHolders = round(dayz_maxMaxWeaponHolders); _currentWeaponHolders = round(dayz_currentWeaponHolders); //Limits (Land,Sea,Air) _inVehicle = (vehicle player != player); /* _isAir = vehicle player iskindof "Air"; _isLand = vehicle player iskindof "Land"; _isSea = vehicle player iskindof "Sea"; if (_isLand) then { } else { }; if (_isAir) then { } else { }; if (_isSea) then { } else { }; */ _doNothing = false; if (_inVehicle) then { _Controlledzeddivided = 0; //exit if too fast if (_speed > 25) exitwith {_doNothing = true;}; //Crew can spawn zeds. _totalcrew = count (crew (vehicle player)); if (_totalcrew > 1) then { _Controlledzeddivided = 2; //Dont allow driver to spawn if we have other crew members. if (player == driver (vehicle player)) exitwith {_doNothing = true;}; } else { _Controlledzeddivided = 4; }; if (_Controlledzeddivided > 0) then { _maxControlledZombies = round(_maxControlledZombies / _Controlledzeddivided); r_player_divideinvehicle = _Controlledzeddivided; }; }; if (_doNothing) exitwith {}; /*if ("ItemMap_Debug" in items player) then { deleteMarkerLocal "MaxZeds"; deleteMarkerLocal "Counter"; deleteMarkerLocal "Loot30"; deleteMarkerLocal "Loot120"; deleteMarkerLocal "Agro80"; _markerstr = createMarkerLocal ["MaxZeds", _position]; _markerstr setMarkerColorLocal "ColorYellow"; _markerstr setMarkerShapeLocal "ELLIPSE"; _markerstr setMarkerBrushLocal "Border"; _markerstr setMarkerSizeLocal [_radius, _radius]; _markerstr1 = createMarkerLocal ["Counter", _position]; _markerstr1 setMarkerColorLocal "ColorRed"; _markerstr1 setMarkerShapeLocal "ELLIPSE"; _markerstr1 setMarkerBrushLocal "Border"; _markerstr1 setMarkerSizeLocal [_radius+100, _radius+100]; _markerstr2 = createMarkerLocal ["Agro80", _position]; _markerstr2 setMarkerColorLocal "ColorRed"; _markerstr2 setMarkerShapeLocal "ELLIPSE"; _markerstr2 setMarkerBrushLocal "Border"; _markerstr2 setMarkerSizeLocal [80, 80]; _markerstr2 = createMarkerLocal ["Loot30", _position]; _markerstr2 setMarkerColorLocal "ColorRed"; _markerstr2 setMarkerShapeLocal "ELLIPSE"; _markerstr2 setMarkerBrushLocal "Border"; _markerstr2 setMarkerSizeLocal [30, 30]; _markerstr3 = createMarkerLocal ["Loot120", _position]; _markerstr3 setMarkerColorLocal "ColorBlue"; _markerstr3 setMarkerShapeLocal "ELLIPSE"; _markerstr3 setMarkerBrushLocal "Border"; _markerstr3 setMarkerSizeLocal [120, 120]; diag_log ("LocalZombies: " +str(dayz_spawnZombies) + "/" +str(dayz_maxLocalZombies)); //Logging diag_log (format["%1 Local.Agents: %2/%3, NearBy.Agents: %8/%9, Global.Agents: %6/%7, W.holders: %10/%11, (radius:%4m %5fps).","SpawnCheck", _maxlocalspawned, _maxControlledZombies, _radius, round diag_fpsmin,dayz_currentGlobalZombies, dayz_maxGlobalZeds, dayz_CurrentNearByZombies, dayz_maxNearByZombies, _currentWeaponHolders,_maxWeaponHolders]); };*/ // nearObjects is faster than nearestObjects when sorting by distance isn't needed // "Building" includes House and all of its child classes (Crashsite, IC_Fireplace1, IC_Tent, etc.) _nearby = _position nearObjects ["Building",_radius]; _maxlocalspawned = _maxlocalspawned max floor(_maxControlledZombies*.8); if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; }; //Spawn Zeds & loot in buildings { _type = typeOf _x; _config = missionConfigFile >> "CfgLoot" >> "Buildings" >> _type; _canSpawn = isClass (_config); if (_canSpawn) then { _dis = _x distance player; _checkLoot = (count (getArray (_config >> "lootPos"))) > 0; _islocal = _x getVariable ["", false]; // object created locally via TownGenerator. //Make sure wrecks always spawn Zeds _isWreck = _x isKindOf "CrashSite"; //Loot if (getNumber(_config >> "lootChance") > 0) then { if (_currentWeaponHolders < _maxWeaponHolders) then { //Basic loot check if ((_dis < 125) and (_dis > 30) and !_inVehicle and _checkLoot) then { _serverTime = serverTime; _looted = (_x getVariable ["looted",_serverTime]); _age = _serverTime - _looted; //Building refresh rate if (_age == 0 or (_age > getNumber(_config >> "lootRefreshTimer"))) then { _x setVariable ["looted",_serverTime,!_islocal]; _x call building_spawnLoot; if (!(_x in dayz_buildingBubbleMonitor)) then { dayz_buildingBubbleMonitor set [count dayz_buildingBubbleMonitor, _x]; }; //diag_log [ diag_tickTime, "new loot at",_x,"age:", _age, "serverTime:", _serverTime]; }/* else { diag_log [ diag_tickTime, "won't spawn loot at",_x,"age:", _age, "serverTime:", _serverTime]; }*/; }; }; }; //Zeds if (getNumber(_config >> "zombieChance") > 0) then { if (_dis > _spawnZedRadius) then { _serverTime = serverTime; _zombied = (_x getVariable ["zombieSpawn",_serverTime]); _age = _serverTime - _zombied; if ((_age == 0) or (_age > 300)) then { if (!_isWreck) then { if ((dayz_spawnZombies < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then { _bPos = getPosATL _x; _zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); if (_zombiesNum == 0) then { _x setVariable ["zombieSpawn",_serverTime,!_islocal]; if (!(_x in dayz_buildingBubbleMonitor)) then { //add active zed to var dayz_buildingBubbleMonitor set [count dayz_buildingBubbleMonitor, _x]; }; //start spawn [_x] call building_spawnZombies; }; //diag_log (format["%1 building. %2", __FILE__, _x]); }; } else { _bPos = getPosATL _x; _zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 30)]); //Should be a wreck if (_zombiesNum == 0) then { [_x,_isWreck] call building_spawnZombies; }; }; }; }; }; }; } forEach _nearby; At first I thought it was a respawn timer issue or something like that but if you don't move the loot will stay, you have to back away from it or someone else has to get within range and its not like you have to run away for this to happen, you can just back up a few steps and watch the loot change right infront of you. I have been playing around with it just trying to see if i can figure it out but if anyone knows what i should do or can at least point me in the right direction it would be a huge help.
       
      Thanks
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...