Closed noxsicarius closed 10 years ago
You could make this broadcast optional. Allowing those who won't abuse it to do it in the darkness of the admin corners we sit in. ;)
That is why the main post says to make it optional as a reminder to myself.
If you would like I can maybe add this for you :) I was thinking of something like adding a vars.sqf and then something simple like this for god mode
/*
Heals all damage and makes the user invincible to damage by everything
excluding antihack killing a hacker.
*/
if (isNil "adminToolBroadcast") then
{
adminToolBroadcast = true;
};
private ["_playerGM"];
_playerGM = _this select 0;
if (_playerGM) then
{
if (adminToolBroadcast = true) then
{
hint "God mode enabled by Admin: %1", (name player);
} then
{
player_zombieCheck = {};
fnc_usec_damageHandler = {};
fnc_usec_unconscious = {};
(vehicle player) removeAllEventHandlers "handleDamage";
(vehicle player) addEventHandler ["handleDamage", { false }];
(vehicle player) allowDamage false;
r_player_unconscious = false;
r_player_infected = false;
r_player_injured = false;
r_player_inpain = false;
r_player_loaded = false;
r_player_cardiac = false;
r_player_lowblood = false;
r_fracture_legs = false;
r_fracture_arms = false;
r_player_blood = 11999;
r_player_timeout = 0;
r_handlerCount = 0;
dayz_sourceBleeding = objNull;
dayz_hunger = 0;
dayz_thirst = 0;
dayz_temperatur = 100;
disableUserInput false;
player setVariable ["USEC_injured",false,true];
{player setVariable[_x,false,true];} forEach USEC_woundHit;
player setVariable ["unconsciousTime", r_player_timeout, true];
player setHit ['legs',0];
player setVariable ['hit_legs',0,false];
player setVariable['medForceUpdate',true,true];
};
}
else
{
player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
player addEventHandler ["handleDamage", {true}];
player removeAllEventHandlers "handleDamage";
player allowDamage true;
};
this was done on my phone through remote desktop so ignore the messy code and possible mis-spellings but you get the idea :)
I already have this set up on my local stuff but I did it a bit different. I am setting the broadcast in the adminlist.sqf and then adding it to all of the files that have potential to be severely abused. I will be changing admilist.sqf to be a config file instead. I will be centralizing all options into the file so it is easier to use.
BTW I want to let you know that with that code it only displays to the person who activates god mode. It also utilizes hints. Hints are a nice clean way of showing data, but custom debug menus are very common and override the default one. This typically causes hints to not work so it is best to either display system chat or title text.
It was just a rough draft :) hint is the first thing that came to mind
This will need to be delayed until 2.0
SystemChat can only be called server side. I would rather use system chat so that text does not spam the player's view
I don't believe that is correct, I use systemChat for quite a few things mission side and it works fine for me anyway
Toss me an example. Maybe I did something stupid. It was a quick small test and it didn't work.
My edit for Vehicle gui
private ["_kindOf", "_filter", "_cfgvehicles","_dialog","_vehicle"];
#define KINDOF_ARRAY(a,b) [##a,##b] call {_veh = _this select 0;_types = _this select 1;_res = false; {if (_veh isKindOf _x) exitwith { _res = true };}forEach _types;_res}
PermDialogSelected = -1;
AdminDialogList = 13000;
if (isNil "vhnlist") then
{
vhnlist = [];
_kindOf = ["LandVehicle","Air","Ship"];
_filter = ["BIS_Steerable_Parachute","ParachuteBase","StaticWeapon"];
_cfgvehicles = configFile >> "cfgVehicles";
titleText ["Generating Vehicle list... Wait...","PLAIN DOWN"];titleFadeOut 2;
systemChat ('<TheWastelandDiaries>: To spawn perm vehicles you must be near a trader or you get temp banned.');
for "_i" from 0 to (count _cfgvehicles)-1 do
{
private ["_vehicle", "_veh_type", "_textPart"];
_vehicle = _cfgvehicles select _i;
// diag_log(_vehicle);
if (isClass _vehicle) then {
_veh_type = configName(_vehicle);
if ((getNumber(_vehicle >> "scope") == 2) and (getText(_vehicle >> "picture") != "") and (KINDOF_ARRAY(_veh_type,_kindOf)) and !(KINDOF_ARRAY(_veh_type,_filter))) then {
_textPart = getText(configFile >> "cfgVehicles" >> _veh_type >> "displayName");
_image = (gettext (configFile >> "CfgVehicles" >> _veh_type >> "picture"));
vhnlist set [count vhnlist,[_veh_type, _textPart, _image]];
};
};
};
titleText ["List is ready...","PLAIN DOWN"];titleFadeOut 2;
};
_dialog = createdialog "AdminDialog";
lbClear AdminDialogList;
{
private ["_index", "_x","_image"];
_image = _x select 2;
_index = lbAdd [AdminDialogList, format["%2 (%1)", _x select 0, _x select 1]];
lbSetPicture [AdminDialogList, _index, _image];
} forEach vhnlist;
LoadSpecificList = {
private ["_kindOf", "_filter", "_cfgvehicles","_dialog","_vehicle"];
lbClear AdminDialogList;
vhnlist = [];
//_kindOf = ["LandVehicle","Air","Ship"];
_kindOf = [_this select 0];
_filter = ["BIS_Steerable_Parachute","ParachuteBase","StaticWeapon"];
_cfgvehicles = configFile >> "cfgVehicles";
titleText ["Generating Vehicle list... Please wait ...","PLAIN DOWN"];titleFadeOut 2;
for "_i" from 0 to (count _cfgvehicles)-1 do
{
private ["_vehicle", "_veh_type", "_textPart"];
_vehicle = _cfgvehicles select _i;
if (isClass _vehicle) then {
_veh_type = configName(_vehicle);
if ((getNumber(_vehicle >> "scope") == 2) and (getText(_vehicle >> "picture") != "") and (KINDOF_ARRAY(_veh_type,_kindOf)) and !(KINDOF_ARRAY(_veh_type,_filter))) then {
_textPart = getText(configFile >> "cfgVehicles" >> _veh_type >> "displayName");
_image = (gettext (configFile >> "CfgVehicles" >> _veh_type >> "picture"));
vhnlist set [count vhnlist,[_veh_type, _textPart, _image]];
};
};
};
titleText ["List is ready...","PLAIN DOWN"];titleFadeOut 2;
lbClear AdminDialogList;
{
private ["_index", "_x","_image"];
_image = _x select 2;
_index = lbAdd [AdminDialogList, format["%2 (%1)", _x select 0, _x select 1]];
lbSetPicture [AdminDialogList, _index, _image];
} forEach vhnlist;
};
waitUntil { !dialog };
if ((PermDialogSelected < 0) && (TempDialogSelected < 0)) exitWith {};
if (PermDialogSelected > -1) then {
_vehicle = ((vhnlist select PermDialogSelected) select 0);
hint format["Spawning Perm %1", _vehicle];
[_vehicle] execVM "custom\toolmenu\common\VehicleSpawn\addvehicle.sqf";
};```
Seems like I did it right. Maybe there was just an error in my check. I tend to miss small things when busy.
Broadcast the use of the tools when spawning crates and enabling god mode. Any option that has the potential to be severely abused. Make it optional.