Jump to content
  • 0

diag_log addtions to admintools and other mods


TLDS

Question

We'd log to add some diag_log statements that include the players name that activates the script.  This will allow us to track which of the admins is using admin tools and in which situations.  Keeps everyone honest when you know your actions are logged.

 

We are currently using Blue Phoenix Admin Tools and while they are nice and suite our needs i had some concerns since it basically allows admins some pretty powerful tools and can be abused.  I came up with a simple diag_log statement i tried added in the spectate script and it seems to break the script.  Here is a sample example.

showCommandingMenu "#USER:zombieDistanceScreen";
WaitUntil{ZobieDistanceStat};

 titleText [format["Zombie shield activated with distance %1 meters!",ZombieDistance],"PLAIN DOWN"]; titleFadeOut 4;
 diag_log (""ADMIN TOOLS: Zombie Shield Activated for "" + (name _x));" \n
 } else {
 ZobieDistanceStat=false;

which is supposed to be called when the script is executed

 

and when the script is deactivated is this set of code.

 };
 };
 titleText ["Zombie shield deactivated!","PLAIN DOWN"]; titleFadeOut 4;
 diag_log (""ADMIN TOOLS: Zombie Shield Deactivated for "" + (name _x));" \n

Anyone have any pointers as to why it doesn't work?  Thanks for helping if its something obvious.  I'm only a novice coder and the syntax looks ok to me.

Link to comment
Share on other sites

17 answers to this question

Recommended Posts

  • 0

Interestingly enough, your line didnt break the script, it atleast executes, however i get no message regarding this in the RPT log.  Even this generic adaptation of your line doesnt print

diag_log(format["ADMIN TOOLS: Zombie Shield Activated for : "]);

So i'm at a complete loss for words.  Is the diag_log a function only callable if admin tools was compiled in the core of the server?  That would make sense why any attempts to pass a statement to diag_log have failed because blue phoenix admin tools currently is ran from the mission folder.

 

If it were to be needed to be compiled into the dayz_server.pbo (which is actually what i'd like to do to keep the mission file size down) could anyone give me some pointers on how to do that?  i'd greatly appreciate it.

Link to comment
Share on other sites

  • 0

Also no effect.  I'm starting to believe that diag_log can't be called from scripts that are run at the map level, only inside the compiled server core.

 

Anyone have any pointers on how to accomplish that?  i'd honestly prefer it that way.

 

I'd like to move the admin tools to inside the dayz_server.pbo and call them from the init.sqf in the map.

 

I've already tested a few variations of trying to accomplish this and the follow produced mixed results.

 

I copied the admin tools into the dayz_server.pbo and had a script that gave the admin tools menu option to the listed players.  The script would then call admin tools using the appropriate path (for example \z\addons\dayz_server\mods\admintools\admintoolsmain.sqf

 

I always got the menu option since it was in the missions folder but when attempting to execute the menu option i get a Error: Cant Execute Script \z\addons\dayz_server\mods\admintools\admintoolsmain.sqf

 

Thanks for any advice you guys give.  I really appreciate it.

Link to comment
Share on other sites

  • 0

I'm not a pro, but that code you added looks wrong. I'd go with something like:


diag_log(format["ADMIN TOOLS: Zombie Shield Deactivated for : %1",name _x]);

Haven't tested it, but that's how I'd try it in my scripts! 

 

This works perfectly on my server, I run this type of script server side.  

Link to comment
Share on other sites

  • 0

Thanks for the 

 

This works perfectly on my server, I run this type of script server side.  

 

Thanks for the words of encouragement, maybe i screwed something up on my end.

 

Just want to clarify, when you say you run this type of script server side, you are implying you run it from inside the dayz_server.pbo and not in scripts that are executed from the MPMissions folder?

Link to comment
Share on other sites

  • 0

Ok, that makes sense based on what i've tested so far that should always work.  However has anyone tried passing 

diag_log(format["ADMIN TOOLS: Zombie Shield Deactivated for : %1",name _x]);

from say the init.sqf of their mission file? or something similiar?   Because i've not been able to get any diag_log statements to push text to the logs from the scripts that use that line (or similiar) from the mission folder.

Link to comment
Share on other sites

  • 0

You wont, from how I understand things anyway, as diag_log is server side only.  I think there's something similar you can use for client machines, but it will only log to the client report file which is no use to an admin.  Hopefully someone else more knowledgeable will come to your rescue :)

Link to comment
Share on other sites

  • 0

Hayward, i appreciate the information and it has been useful.

 

I can still make this whole she-bang work if i can get the blue phoenix admin tools to run from server side, the more i research the more i understand its complicated.  Anyone have any insight into this?

Link to comment
Share on other sites

  • 0

Hi run Blue Phoenix Admin tools on my server and my admins only have access to spectate player and flip car i feel like they don't need anything else to admin the server :) and track players what players are doing there is no need for them to spawn in or change there loadouts or esp that's just as bad as been a hacker. :)

Link to comment
Share on other sites

  • 0

Hi run Blue Phoenix Admin tools on my server and my admins only have access to spectate player and flip car i feel like they don't need anything else to admin the server :) and track players what players are doing there is no need for them to spawn in or change there loadouts or esp that's just as bad as been a hacker. :)

 

Spectate players is worse than ESP if you ask me :p

Link to comment
Share on other sites

  • 0

I couldn't agree with you more, ALL tools that give a player the ability to do something that everyone else can't do can be abused.

 

Our admins are held accountable to each other and the community we serve, which is why i am trying so hard to enable logging.  It keeps everyone just that much more honest and it makes it easier to show our community the lengths we go to keep the game honest and enjoyable for all.

 

However i will say this.  All the tools i've been working on (Spectate, Weapon Kits, Spawn Vehicles) are legitimately used in dozens of scenarios where it has served the greatest good in the community.  Here are some for-instances.

 

Spectate is used primarily as an observation tool and is used on players reported for ESP, it allows the admin to observe the player and see how they view the world.  (if they magically spin around and shoot a bush without first laying eyes on the player.... we investigate further etc.)  We also spectate players from an observe and record scenario in our player events where admins lead random events like bounties, warzones etc to create community videos to which you could very well have been a star.

 

Weapon Kits and Spawning in Vehicles often serve the player events where Admins are usually set as a mercenary role where they are equipped with matching kits etc.  Being able to rapidly set these kits before an event rather then fumble about in the SQL is a benefit.  Sometimes the player events feature taking down a vehicle convoy etc and we use spawned in vehicles so players can capture them but is not persistent on restart.

 

There are more scenarios where these tools are used in legit ways but to keep the tools to be used in good faith logging IS REQUIRED.  Which is why i have been questioning so hard as to if anyone has any idea on how to accomplish this.

Link to comment
Share on other sites

  • 0

One more thing you could try...

if (isServer) then {
diag_log(format["ADMIN TOOLS: Zombie Shield Deactivated for : %1",name _x]);
}; 

Now the others are probably laughing at me thinking what noob, but honestly.. If that doesn't work, I have no more ideas for now :(

Link to comment
Share on other sites

  • 0

This hasn't been tested, I just typed it up from memory lol.. But worth a try and can easily be modified and cleaned up if anyone else wants to help:
 
In your mission.pbo init.sqf add this line at the very end:

execVM = "\z\addons\dayz_server\modules\bfmessages.sqf";

Create a file called bfmessages.sqf in your servers modules folder and paste this into it:

if (isNil "BFMessage") then {
BFMessage = [];
publicVariable "BFMessage";
};

if(isServer) then {
_Loop = true;
while {(_Loop)} do { 
sleep 120; // Change to any number you like, but no need to have it run too often.
_arrayLength = count BFMessage; // Count the number of messages stored in the Array
	if(_arrayLength == 0) then { // If the Array is empty do nothing
	} else { 
		{ diag_log _x } forEach BFMessage; 
				  BFMessage=[]; // We don't want duplicate entries, so reset the Array!
				    publicVariable "BFMessage";
				}
		};
};

Then use this in your bf scripts:

_TheMessage = format["ADMIN TOOLS: Zombie Shield Deactivated for : %1",name _x];      
    BFMessage = BFMessage + [_TheMessage];
     publicVariable "BFMessage"; // This will make sure ALL clients even the server get the updated array.

Then that's it.. All the messages will be stored in an array that is shared across all clients and the server, then every 2 minutes the script on the server checks the array an if its got new entries it will add them to the report file one by one, so you'll have them listed with line breaks so to speak... 
 
Here's how the array works, if you don't already know...
 
When the first message is added to the array it looks like this:
 
["ADMIN TOOLS: Zombie Shield Deactivated for : Hayward"]
 
As more and more are added (during that 2 minutes), it'll eventually look like this:
 
["ADMIN TOOLS: Zombie Shield Deactivated for : Hayward" , "ADMIN TOOLS: Zombie Shield Deactivated for : TLD" , "ADMIN TOOLS: Zombie Shield Deactivated for : Billy"]
 
Then after the two minutes is up the script will take each of those entries and add them to your report log one by one..
 
Sorry, I'm still a noob when it comes to this stuff.  But I hope that works for you..

Link to comment
Share on other sites

  • 0

I appreciate you giving some insight!  It's inspiring me to take this approach and will give it a shot probaly in 8-12 hours or so when i get some time.  I'll let you know if i have any luck.  At the very least its giving me some ideas on how to make this work for my needs.

 

Thanks again.

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
  • Advertisement
  • Discord

×
×
  • Create New...