Bonjour , je tien a précisé que ce tuto ne viens pas de moi mais de Forum Bulldog : http://www.altisliferpg.com/topic/4375-modifyextended-admin-menu/
Commençons tout de suite :
1 . Commencer par aller dans votre base de donnée dans players puis structure puis cherché adminlevel , et rajouté 2 grade admin cela devrait ressemblé à ça :
'0','1','2','3','4','5'
2 . Aller dans Function.h (qui se trouve a la racine de votre mission) et modifié la Class Admin
class Civilian
{
file = "core\civilian";
class freezePlayer {};
};
class Admin
{
file = "core\admin";
class admininfo {};
class adminid {};
class admingetID {};
class adminMenu {};
class adminQuery {};
class adminSpectate {};
class adminTeleport {};
class adminTpHere {};
class adminDebugCon {};
class adminCompensate {};
class adminGodMode {};
class adminFreeze {};
class adminMarkers {};
};
3 . Aller dans stringtable.xml (Qui se trouve à la racine de votre mission) et modifié Admin Menu
<Key ID="STR_Admin_Spectate">
<Original>Spectate</Original>
<English>Spectate</English>
<German>Zuschauen</German>
<French>Regardez</French>
</Key>
<Key ID="STR_Admin_Teleport">
<Original>Teleport</Original>
<English>Teleport</English>
<German>Teleport</German>
<French>Teleport</French>
</Key>
<Key ID="STR_Admin_TpHere">
<Original>TP Here</Original>
<English>TP Here</English>
<German>TP Hier</German>
<French>TP Ici</French>
</Key>
<Key ID="STR_Admin_Debug">
<Original>Debug</Original>
<English>Debug</English>
<German>Debug</German>
<French>Debug</French>
</Key>
<Key ID="STR_Admin_Compensate">
<Original>Comp</Original>
<English>Comp</English>
<German>Comp</German>
<French>Comp</French>
</Key>
<Key ID="STR_Admin_God">
<Original>GodMode</Original>
<English>GodMode</English>
<German>Gott</German>
<French>Dieu</French>
</Key>
<Key ID="STR_Admin_Freeze">
<Original>Freeze</Original>
<English>Freeze</English>
<German>Freeze</German>
<French>Geler</French>
</Key>
<Key ID="STR_Admin_Markers">
<Original>Markers</Original>
<English>Markers</English>
<German>Markers</German>
<French>Markers</French>
</Key>
<Key ID="STR_ANOTF_CompWarn">
<Original>You are about to give yourself $%1 to compensate to another player <br/><br/>You must give this cash to the person you are compensating manually.</Original>
<English>You are about to give yourself $%1 to compensate to another player <br/><br/>You must give this cash to the person you are compensating manually.</English>
<German>To Be Changed</German>
<French>Vous êtes sur le point de vous donner $%1 pour compenser à un autre joueur <br/><br/> S'il vous plaît donner à cette à la personne vous compensez manuellement</French>
</Key>
<Key ID="STR_ANOTF_Success">
<Original>You have added $%1 to your account.</Original>
<English>You have added $%1 to your account.</English>
<German>To Be Changed</German>
<French>Vous avez ajouté $%1 à votre compte</French>
</Key>
<Key ID="STR_ANOTF_Fail">
<Original>You can not go above 999999.</Original>
<English>You can not go above 999999.</English>
<German>To Be Changed</German>
<French>Vous ne pouvez pas aller au-dessus $999999</French>
</Key>
<Key ID="STR_ANOTF_Amount">
<Original>Please type in the amount to compensate.</Original>
<English>Please type in the amount to compensate.</English>
<German>To Be Changed</German>
<French>S'il vous plaît entrer la quantité pour compenser</French>
</Key>
<Key ID="STR_ANOTF_Frozen">
<Original>You have disabled %1's input.</Original>
<English>You have disabled %1's input.</English>
<German>To Be Changed</German>
<French>Vous avez désactivé %1's contrôles</French>
</Key>
<Key ID="STR_ANOTF_Unfrozen">
<Original>You have enabled %1's input.</Original>
<English>You have enabled %1's input.</English>
<German>To Be Changed</German>
<French>Vous avez permis %1's contrôles</French>
</Key>
<Key ID="STR_ANOTF_Error">
<Original>You can't do that dumbass.</Original>
<English>You can't do that dumbass.</English>
<German>To Be Changed</German>
<French>Vous ne pouvez pas le faire sur vous-même</French>
</Key>
<Key ID="STR_ANOTF_ErrorLevel">
<Original>Your Admin Level is not high enough.</Original>
<English>Your Admin Level is not high enough.</English>
<German>To Be Changed</German>
<French>Votre Niveau admin n'est pas suffisamment élevée</French>
</Key>
<Key ID="STR_ANOTF_MDisabled">
<Original>Player Markers Disabled.</Original>
<English>Player Markers Disabled.</English>
<German>To Be Changed</German>
<French>Needs Translation</French>
</Key>
<Key ID="STR_ANOTF_MEnabled">
<Original>Player Markers Enabled.</Original>
<English>Player Markers Enabled.</English>
<German>To Be Changed</German>
<French>Needs Translation</French>
</Key>
<Key ID="STR_NOTF_ActionCancel">
<Original>Action Cancelled</Original>
<English>Action Cancelled</English>
<German>Aktion abgebrochen</German>
<French>Action Annulée</French>
</Key>
<Key ID="STR_Global_Yes">
<Original>Yes</Original>
<English>Yes</English>
<German>Ja</German>
<French>Oui</French>
</Key>
<Key ID="STR_Global_No">
<Original>No</Original>
<English>No</English>
<German>Nein</German>
<French>Aucun</French>
</Key>
4 . Toujours dans le même fichier juste en dessous Modifié Notification admin
<Key ID="STR_NOTF_Frozen">
<Original>You have been frozen by an administrator</Original>
<English>You have been frozen by an administrator</English>
<German>To Be Changed</German>
</Key>
<Key ID="STR_NOTF_Unfrozen">
<Original>You have been unfrozen by an administrator</Original>
<English>You have been unfrozen by an administrator</English>
<German>To Be Changed</German>
</Key>
5 . dialog\admin_menu.hpp
class life_admin_menu {
idd = 2900;
name= "life_admin_menu";
movingEnable = false;
enableSimulation = true;
onLoad = "[] spawn life_fnc_adminMenu;";
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.8;
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.8;
h = 0.6 - (2 / 250);
};
};
class controls {
class Title : Life_RscTitle {
colorBackground[] = {0, 0, 0, 0};
idc = 2901;
text = "$STR_Admin_Title";
x = 0.1;
y = 0.2;
w = 0.6;
h = (1 / 25);
};
class PlayerList_Admin : Life_RscListBox
{
idc = 2902;
text = "";
sizeEx = 0.035;
//colorBackground[] = {0,0,0,0};
onLBSelChanged = "[_this] spawn life_fnc_adminQuery";
x = 0.12; y = 0.26;
w = 0.30; h = 0.4;
};
class PlayerBInfo : Life_RscStructuredText
{
idc = 2903;
text = "";
x = 0.42;
y = 0.25;
w = 0.35;
h = 0.6;
};
class CloseButtonKey : Life_RscButtonMenu {
idc = -1;
text = "$STR_Global_Close";
onButtonClick = "closeDialog 0;";
x = -0.06 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.88 - (1 / 25);
w = (6.25 / 40);
h = (1 / 25);
};
class AdminID : Life_RscButtonMenu {
idc = -1;
text = "$STR_Admin_GetID";
onButtonClick = "[] call life_fnc_admingetID;";
x = 0.1 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.88 - (1 / 25);
w = (6.25 / 40);
h = (1 / 25);
};
class Compensate : Life_RscButtonMenu {
idc = 2904;
text = "$STR_Admin_Compensate";
onButtonClick = "createDialog ""Life_Admin_Compensate"";";
x = 0.26 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.88 - (1 / 25);
w = (6.25 / 40);
h = (1 / 25);
};
class Spectate : Life_RscButtonMenu {
idc = 2905;
text = "$STR_Admin_Spectate";
onButtonClick = "[] call life_fnc_adminSpectate;";
x = 0.42 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.88 - (1 / 25);
w = (6.25 / 40);
h = (1 / 25);
};
class Teleport : Life_RscButtonMenu {
idc = 2906;
text = "$STR_Admin_Teleport";
onButtonClick = "[] call life_fnc_adminTeleport; hint 'Select where you would like to teleport';";
x = 0.58 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.88 - (1 / 25);
w = (6.25 / 40);
h = (1 / 25);
};
class TeleportHere : Life_RscButtonMenu {
idc = 2907;
text = "$STR_Admin_TpHere";
onButtonClick = "[] call life_fnc_adminTpHere;";
x = -0.06 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.885;
w = (6.25 / 40);
h = (1 / 25);
};
class God : Life_RscButtonMenu {
idc = 2908;
text = "$STR_Admin_God";
onButtonClick = "[] call life_fnc_adminGodMode;";
x = 0.1 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.885;
w = (6.25 / 40);
h = (1 / 25);
};
class Freeze : Life_RscButtonMenu {
idc = 2909;
text = "$STR_Admin_Freeze";
onButtonClick = "[] call life_fnc_adminFreeze;";
x = 0.26 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.885;
w = (6.25 / 40);
h = (1 / 25);
};
class Markers : Life_RscButtonMenu {
idc = 2910;
text = "$STR_Admin_Markers";
onButtonClick = "[] spawn life_fnc_adminMarkers;";
x = 0.42 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.885;
w = (6.25 / 40);
h = (1 / 25);
};
class Debug : Life_RscButtonMenu {
idc = 2911;
text = "$STR_Admin_Debug";
onButtonClick = "hint 'Disabled';";
x = 0.58 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.885;
w = (6.25 / 40);
h = (1 / 25);
};
};
};
6 . dialog\compensate.hpp
class Life_Admin_Compensate {
idd = 9920;
name= "life_admin_compensate_give";
movingEnable = false;
enableSimulation = true;
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;
sizeEx = 0.020;
text = "";
x = 0.1;
y = 0.25;
w = 0.5; h = 0.11;
};
class Title : Life_RscTitle {
colorBackground[] = {0, 0, 0, 0};
idc = -1;
text = "$STR_Admin_Compensate";
x = 0.1;
y = 0.2;
w = 0.5;
h = (1 / 25);
};
class AdminCloseComp : Life_RscButtonMenu {
idc = -1;
text = "$STR_Global_Close";
onButtonClick = "closeDialog 0;";
x = -0.06 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.5 - (1 / 25);
w = (6.25 / 40);
h = (1 / 25);
};
class AdminCompensVer : Life_RscButtonMenu {
idc = -1;
text = "$STR_Admin_Compensate";
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};
onButtonClick = "[] spawn life_fnc_adminCompensate;";
x = 0.27;
y = 0.40;
w = (6.25 / 40);
h = (1 / 25);
};
class AdminCompensTex : Life_RscEdit
{
idc = 9922;
text = "";
x = 0.04 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.35;
w = (13 / 40);
h = (1 / 25);
};
};
};
7. dialog\MasterHandler.h
#include "compensate.hpp"
8 . core\admin\fn_adminMenu.sqf
#include <macro.h>
/*
File: fn_adminMenu.sqf
Author: Bryan "Tonic" Boardwine
Description:
Opens the admin menu, sorry nothing special in here. Take a look for yourself.
*/
if(__GETC__(life_adminlevel) < 1) exitWith {closeDialog 0;};
private["_display","_list","_side"];
disableSerialization;
waitUntil {!isNull (findDisplay 2900)};
_display = findDisplay 2900;
_list = _display displayCtrl 2902;
if(__GETC__(life_adminlevel) < 1) exitWith {closeDialog 0;};
switch(__GETC__(life_adminlevel)) do
{
case 1: {ctrlShow [2904,false];ctrlShow [2905,false];ctrlShow [2906,false];ctrlShow [2907,false];ctrlShow [2908,false];ctrlShow [2909,false];ctrlShow [2910,false];ctrlShow [2911,false];};
case 2: {ctrlShow [2905,false];ctrlShow [2906,false];ctrlShow [2907,false];ctrlShow [2908,false];ctrlShow [2909,false];ctrlShow [2910,false];ctrlShow [2911,false];};
case 3: {ctrlShow [2907,false];ctrlShow [2908,false];ctrlShow [2909,false];ctrlShow [2910,false];ctrlShow [2911,false];};
case 4: {[2911,false];};
};
//Purge List
lbClear _list;
{
_side = switch(side _x) do {case west: {"Cop"}; case civilian : {"Civ"}; case independent : {"Med"}; default {"Unknown"};};
_list lbAdd format["%1 - %2", _x getVariable["realname",name _x],_side];
_list lbSetdata [(lbSize _list)-1,str(_x)];
} foreach playableUnits;
if(__GETC__(life_adminlevel) < 1) exitWith {closeDialog 0;};
9 . core\admin\fn_adminSpectate.sqf
#include <macro.h>
/*
File: fn_adminSpectate.sqf
Author: ColinM9991
Description:
Spectate the chosen player.
*/
if(__GETC__(life_adminlevel) == 0) exitWith {closeDialog 0;};
private["_unit"];
_unit = lbData[2902,lbCurSel (2902)];
_unit = call compile format["%1", _unit];
if(isNil "_unit") exitwith {};
if(isNull _unit) exitWith {};
if(_unit == player) exitWith {hint localize "STR_ANOTF_Error";};
[] spawn {
while {dialog} do {
closeDialog 0;
sleep 0.01;
};
};
_unit switchCamera "INTERNAL";
hint format["You are now spectating %1 \n\n Press F10 to stop Spectating.",_unit getVariable["realname",name _unit]];
AM_Exit = (findDisplay 46) displayAddEventHandler ["KeyDown","if((_this select 1) == 68) then {(findDisplay 46) displayRemoveEventHandler ['KeyDown',AM_Exit];player switchCamera 'INTERNAL';hint 'You have stopped spectating';};false"];
10 . core\admin\fn_adminTeleport.sqf
#include <macro.h>
/*
File: fn_adminTeleport.sqf
Author: ColinM9991
Credits: To original script author(s)
Description:
Teleport to chosen position.
*/
if(__GETC__(life_adminlevel) == 0) exitWith {closeDialog 0;};
[] spawn {
while {dialog} do {
closeDialog 0;
sleep 0.01;
};
};
tele={
_pos = [_this select 0, _this select 1, _this select 2];
(vehicle player) setpos [_pos select 0, _pos select 1, 0];
onMapSingleClick "";
openMap [false, false];
hint "You have teleported to your selected position";
};
openMap [true, false];
onMapSingleClick "[_pos select 0, _pos select 1, _pos select 2] call tele";
11. core\admin\fn_adminTpHere.sqf
#include <macro.h>
/*
File: fn_adminTpHere.sqf
Author: ColinM9991
Description:
Teleport selected player to you.
*/
if(__GETC__(life_adminlevel) == 0) exitWith {closeDialog 0;};
private["_target"];
_target = lbData[2902,lbCurSel (2902)];
_target = call compile format["%1", _target];
if(isNil "_target") exitwith {};
if(isNull _target) exitWith {};
if(_unit == player) exitWith {hint localize "STR_ANOTF_Error";};
_target setPos (getPos player);
hint format["You have teleported %1 to your location",_target getVariable["realname",name _target]];
12. core\admin\fn_adminCompensate.sqf
#include <macro.h>
/*
File: fn_adminCompensate.sqf
Author: ColinM9991
Description:
Figure it out.
*/
private["_value","_action"];
if(__GETC__(life_adminlevel) < 2) exitWith {closeDialog 0; hint localize "STR_ANOTF_ErrorLevel";};
_value = parseNumber(ctrlText 9922);
if(_value < 0) exitWith {};
if(_value > 999999) exitWith {hint localize "STR_ANOTF_Fail"};
//if(!([str(_value)] call life_fnc_isnumeric)) exitWith {hint localize "STR_AIM_notnumeric"};
_action = [
format [localize "STR_ANOTF_CompWarn",[_value] call life_fnc_numberText],
localize "STR_Admin_Compensate",
localize "STR_Global_Yes",
localize "STR_Global_No"
] call BIS_fnc_guiMessage;
if(_action) then {
life_cash = life_cash + _value;
hint format [localize "STR_ANOTF_Success",[_value] call life_fnc_numberText];
closeDialog 0;
} else {
hint localize "STR_NOTF_ActionCancel";
closeDialog 0;
};
13. core\admin\fn_adminDebugCon.sqf
#include <macro.h>
/*
File: fn_adminDebugCon.sqf
Author: ColinM9991
Description:
Opens the Debug Console.
*/
if(__GETC__(life_adminlevel) < 3) exitWith {closeDialog 0; hint "You have no business using this";};
createDialog "RscDisplayDebugPublic";
[[0,format["Admin %1 has opened the Debug Console.",profileName]],"life_fnc_broadcast",nil,false] spawn life_fnc_MP;
14. core\admin\fn_adminGodMode.sqf
#include <macro.h>
/*
File: fn_adminGodMode.sqf
Author: Tobias 'Xetoxyc' Sittenauer
Description: Enables God mode for Admin
*/
if(__GETC__(life_adminlevel) < 3) exitWith {closeDialog 0; hint localize "STR_ANOTF_ErrorLevel";};
[] spawn {
while {dialog} do {
closeDialog 0;
sleep 0.01;
};
};
if(life_god) then {
life_god = false;
titleText ["God mode disabled","PLAIN"]; titleFadeOut 2;
player allowDamage true;
} else {
life_god = true;
titleText ["God mode enabled","PLAIN"]; titleFadeOut 2;
player allowDamage false;
};
15. core\admin\fn_adminFreeze.sqf
#include <macro.h>
/*
File: fn_adminFreeze.sqf
Author: ColinM9991
Description: Freezes selected player
*/
if(__GETC__(life_adminlevel) < 3) exitWith {closeDialog 0; hint localize "STR_ANOTF_ErrorLevel";};
private["_unit"];
_unit = lbData[2902,lbCurSel (2902)];
_unit = call compile format["%1", _unit];
if(isNil "_unit") exitWith {};
if(isNull _unit) exitWith {};
if(_unit == player) exitWith {hint localize "STR_ANOTF_Error";};
[[player],"life_fnc_freezePlayer",_unit,false] spawn life_fnc_MP;
16 . core\admin\fn_adminMarkers.sqf
#include <macro.h>
/*
File: fn_adminMarkers.sqf
Sourced from Lystics Player Markers Loop
*/
if(__GETC__(life_adminlevel) < 3) exitWith {closeDialog 0; hint localize "STR_ANOTF_ErrorLevel";};
life_markers = !life_markers;
if(life_markers) then {
PlayerMarkers = [];
FinishedLoop = false;
hint localize "STR_ANOTF_MEnabled";
while{life_markers} do {
{
if !(_x in allUnits) then {
deleteMarkerLocal str _x;
};
} forEach PlayerMarkers;
PlayerMarkers = [];
{
if(alive _x && isplayer _x) then {
deleteMarkerLocal str _x;
_pSee = createMarkerLocal [str _x,getPos _x];
_pSee setMarkerTypeLocal "mil_triangle";
_pSee setMarkerPosLocal getPos _x;
_pSee setMarkerSizeLocal [1,1];
_pSee setMarkerTextLocal format['%1',_x getVariable["realname",name _x]];
_pSee setMarkerColorLocal ("ColorRed");
PlayerMarkers = PlayerMarkers + [_x];
};
} forEach allUnits;
sleep 0.2;
};
FinishedLoop = true;
} else {
if(isNil "FinishedLoop") exitWith {};
hint localize "STR_ANOTF_MDisabled";
waitUntil{FinishedLoop};
{
deleteMarkerLocal str _x;
} forEach PlayerMarkers;
};
17. core\configuration.sqf
life_god = false; //Add this
life_frozen = false; //And this
life_markers = false; //Finally this
18 . Nouveau fichier dans core\civilian est nommé le fn_freezePlayer.sqf
#include <macro.h>
/*
File: fn_freezePlayer.sqf
Author: ColinM9991
Description: Freezes selected player
*/
private["_admin"];
_admin = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;
if(life_frozen) then {
hint localize "STR_NOTF_Unfrozen";
[[1,format[localize "STR_ANOTF_Unfrozen",profileName]],"life_fnc_broadcast",_admin,false] spawn life_fnc_MP;
disableUserInput false;
life_frozen = false;
} else {
hint localize "STR_NOTF_Frozen";
[[1,format[localize "STR_ANOTF_Frozen",profileName]],"life_fnc_broadcast",_admin,false] spawn life_fnc_MP;
disableUserInput true;
life_frozen = true;
};
Voila , aurevoir et au fait je suis de retour