This script enables admins with an admin rank of 5 to comp every player on the server. You can change the adminLevel required for this if you wish. I based this off the original compensate script already part of the framework.
The whole idea is, if you have a server crash or something. You can comp players when its backup etc.
First :
Navigate to mission/core/admin and create a new file called
fn_compAll.sqf
Inside that add the following:
Navigate to mission/core/admin and create a new file called
fn_compReceive.sqf
Inside that add the following:
Next head to > Functions.hpp and add the following in the class admin
Next head to > CfgRemoteExec.hpp and add the following in the file
Next; head over to mission/dialog folder and edit the compensate.hpp file.
Copy this entire code block, and save the file.
Add the following to the mission/stringtable.xml file
Edit the following string for this next one
STR_Admin_Amount
DO NOT JUST COPY THE ABOVE STRING, AS ITS ALREADY IN THE STRINGTABLE
And now your done. Dont forget to re-pbo your mission, and go ingame.
You can view it in the admin menu > comp
The whole idea is, if you have a server crash or something. You can comp players when its backup etc.
First :
Navigate to mission/core/admin and create a new file called
fn_compAll.sqf
Inside that add the following:
C++:
#include "..\..\script_macros.hpp"
/*
File: fn_compAll.sqf
Author: Drunken Cheetah
Desc: Comps every player, X amount below $500,000
*/
private ["_value","_action","_bool"];
if(FETCH_CONST(life_adminlevel) < 5) exitWith {closeDialog 0; hint localize "STR_ANOTF_ErrorLevel";};
_value = parseNumber(ctrlText 9922);
if(_value <= 0) exitWith {};
if(_value > 500000) exitWith {hint localize "STR_ANOTF_Fail2"};
_action = [
format [localize "STR_ANOTF_CompWarn2",[_value] call life_fnc_numberText],
localize "STR_Admin_Compensate",
localize "STR_Global_Yes",
localize "STR_Global_No"
] call BIS_fnc_guiMessage;
if (_action) then {
{
[_value,player] remoteExec ["life_fnc_compReceive",_x];
} forEach playableUnits;
hint format [localize "STR_ANOTF_Success2",[_value] call life_fnc_numberText];
closeDialog 0;
} else {
hint localize "STR_NOTF_ActionCancel";
closeDialog 0;
};
Navigate to mission/core/admin and create a new file called
fn_compReceive.sqf
Inside that add the following:
C++:
#include "..\..\script_macros.hpp"
/*
File: fn_compReceive.sqf
Author: Maxence
*/
params [
["_value",0,[0]],
["_from",objNull,[objNull]]
];
if(_value <= 0) exitWith {};
if(_value > 500000) exitWith {};
BANK = BANK + _value;
[1] call SOCK_fnc_updatePartial;
hint format["Admin %1 just compenstated everyone $%2",(name _from), [_value] call life_fnc_numberText];
Next head to > Functions.hpp and add the following in the class admin
C++:
class compAll {};
class compReceive {};
Next head to > CfgRemoteExec.hpp and add the following in the file
C++:
F(life_fnc_compReceive,CLIENT)
Next; head over to mission/dialog folder and edit the compensate.hpp file.
Copy this entire code block, and save the file.
C++:
class Life_Admin_Compensate {
idd = 9920;
name= "life_admin_compensate_give";
movingEnable = 0;
enableSimulation = 1;
onLoad = "[] spawn {waitUntil {!isNull (findDisplay 9920)}; ((findDisplay 9920) displayCtrl 9921) ctrlSetText localize ""STR_Admin_Amount""};";
class controlsBackground {
class Life_RscTitleBackground: Life_RscText {
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])"};
idc = -1;
x = 0.1;
y = 0.2;
w = 0.5;
h = (1 / 25);
};
class MainBackground: Life_RscText {
colorBackground[] = {0, 0, 0, 0.7};
idc = -1;
x = 0.1;
y = 0.2 + (11 / 250);
w = 0.5;
h = 0.3 - (22 / 250);
};
};
class controls {
class InfoMsg: Life_RscStructuredText
{
idc = 9921;
text = "";
x = 0.347678 * safezoneW + safezoneX;
y = 0.362471 * safezoneH + safezoneY;
w = 0.190403 * safezoneW;
h = 0.0605126 * safezoneH;
};
class Title: Life_RscTitle
{
idc = -1;
text = "$STR_Admin_Compensate"; //--- ToDo: Localize;
x = 0.347678 * safezoneW + safezoneX;
y = 0.334966 * safezoneH + safezoneY;
w = 0.190403 * safezoneW;
h = 0.0220046 * safezoneH;
colorText[] = {0.95,0.95,0.95,1};
};
class AdminCloseComp: Life_RscButtonMenu
{
onButtonClick = "closeDialog 0;";
idc = 1003;
text = "$STR_Global_Close"; //--- ToDo: Localize;
x = 0.48096 * safezoneW + safezoneX;
y = 0.477995 * safezoneH + safezoneY;
w = 0.0595008 * safezoneW;
h = 0.0220046 * safezoneH;
colorText[] = {1,1,1,1};
colorBackground[] = {0,0,0,0.8};
};
class AdminCompensVer: Life_RscButtonMenu
{
onButtonClick = "[] spawn life_fnc_adminCompensate;";
idc = 1004;
text = "$STR_Admin_Compensate"; //--- ToDo: Localize;
x = 0.347678 * safezoneW + safezoneX;
y = 0.477995 * safezoneH + safezoneY;
w = 0.0595008 * safezoneW;
h = 0.0220046 * safezoneH;
colorText[] = {1,1,1,1};
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])",0.5};
};
class AdminCompensTex: Life_RscEdit
{
idc = 9922;
text = "";
x = 0.385759 * safezoneW + safezoneX;
y = 0.444989 * safezoneH + safezoneY;
w = 0.123762 * safezoneW;
h = 0.0220046 * safezoneH;
};
class AdminCompenAll: Life_RscButtonMenu
{
onButtonClick = "[] spawn life_fnc_compAll;";
idc = 1006;
text = "Comp All"; //--- ToDo: Localize;
x = 0.409559 * safezoneW + safezoneX;
y = 0.477995 * safezoneH + safezoneY;
w = 0.0666409 * safezoneW;
h = 0.0220046 * safezoneH;
colorText[] = {1,1,1,1};
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])",0.5};
};
};
};
Add the following to the mission/stringtable.xml file
XML:
<Key ID="STR_ANOTF_Fail2">
<Original>You can not go above $500,000</Original>
</Key>
<Key ID="STR_ANOTF_CompWarn2">
<Original>You are about to comp every player on the server. All money, will go into their bank accounts.</Original>
</Key>
<Key ID="STR_ANOTF_Success2">
<Original>You just gave $%1 to every player.</Original>
</Key>
Edit the following string for this next one
STR_Admin_Amount
XML:
<Key ID="STR_Admin_Amount">
<Original>If comping all players, enter the amount below 500k and click 'Comp All', else Put the amount you want to compensate:</Original>
</Key>
DO NOT JUST COPY THE ABOVE STRING, AS ITS ALREADY IN THE STRINGTABLE
And now your done. Dont forget to re-pbo your mission, and go ingame.
You can view it in the admin menu > comp
Dernière édition par un modérateur: