English Solved Sending Messages to All Civilians as a Police Officer

Kevin

User
12/2/21
1
0
100
Hello,

I would like to add a button with which it is possible to write a message to all civilians as a police officer. I imagine that the message is sent and displayed in the same way as the admin message.
Changes for users:
  • Policemen have a new button in the Iphone
  • Display of the message like the admin message to all,
(a text from the stringtabel.xml should be displayed as sender, so it can be easily modified).

Does anyone have an idea how this can be implemented?

Alternatively to a button, the _toString can also be used as well as for the message to the admin.
Then there should be a button like Send to Admin, with which a recipient is entered.

Many thanks in advance for the help
 
Solution
Hello ! It's a lot of changes, but ok 😅

In your mission/The-Programmer/Iphone_XI/dialogs/phone_system/messages/sendMessage.hpp, below this button :
Code:
class closeMenu : Life_RscButtonInvisibleIphoneXI
{
   idc = -1;
   onbuttonclick = "closeDialog 0; [] spawn the_programmer_iphone_xi_fnc_phone_init;";
   tooltip = "$STR_Global_Close";
   x = 0.704489499999999 * safezoneW + safezoneX;
   y = 0.943902610619469 * safezoneH + safezoneY;
   w = 0.0699896666666673 * safezoneW;
   h = 0.0147325909537858 * safezoneH;
};
you can add this new button with its icon :
Code:
class policeAllPicture : Life_RscPicture
{
   idc = 04202809;
   text = "";
   x = 0.634062 * safezoneW + safezoneX;
   y = 0.28 * safezoneH + safezoneY;
   w =...
Hello ! It's a lot of changes, but ok 😅

In your mission/The-Programmer/Iphone_XI/dialogs/phone_system/messages/sendMessage.hpp, below this button :
Code:
class closeMenu : Life_RscButtonInvisibleIphoneXI
{
   idc = -1;
   onbuttonclick = "closeDialog 0; [] spawn the_programmer_iphone_xi_fnc_phone_init;";
   tooltip = "$STR_Global_Close";
   x = 0.704489499999999 * safezoneW + safezoneX;
   y = 0.943902610619469 * safezoneH + safezoneY;
   w = 0.0699896666666673 * safezoneW;
   h = 0.0147325909537858 * safezoneH;
};
you can add this new button with its icon :
Code:
class policeAllPicture : Life_RscPicture
{
   idc = 04202809;
   text = "";
   x = 0.634062 * safezoneW + safezoneX;
   y = 0.28 * safezoneH + safezoneY;
   w = 0.21 * safezoneW;
   h = 0.7 * safezoneH;
};
class policeAllButton : Life_RscButtonInvisibleIphoneXI
{
   idc = 04202810;
   onbuttonclick = "";
   x = 0.6515625 * safezoneW + safezoneX;
   y = 0.899929869223206 * safezoneH + safezoneY;
   w = 0.043125 * safezoneW;
   h = 0.0243572497541787 * safezoneH;
};


In your @The_Programmer/addons/iphone_xi/client/phone_system/messages/fn_phone_newMessageMenu.sqf, you can add at the end of the file :
Code:
if ((playerSide isEqualTo west) && ((call life_adminlevel) isEqualTo 0)) then {
    (_display displayCtrl 04202810) buttonSetAction "['allplayers'] call the_programmer_iphone_xi_fnc_phone_sendMessage;";
    (_display displayCtrl 04202809) ctrlSetText format ["%1\menus\phone_system\messages\extra\adminButton.paa",_basePath];
} else {
    (_display displayCtrl 04202810) ctrlEnable false;
    (_display displayCtrl 04202809) ctrlShow false;
};
-> That will add the button for players in west side, not admins (because they already have the admin button at the same place).


In your @The_Programmer/addons/iphone_xi/client/phone_system/messages/fn_phoneSendMessage.sqf, below :
Code:
if (_type isEqualTo "adminall") exitWith {[1,"",_messageText] spawn max_phone_fnc_sendMSG; closeDialog 0;};
you can add :
Code:
if (_type isEqualTo "allplayers") exitWith {[_messageText,(name player),9] remoteExec ["max_phone_fnc_clientMessage",-2]; closeDialog 0;};
-> Call the function to send the message to everyone.


In your @The_Programmer/addons/advanced_phone/client/fn_clientMessage.sqf, add in the switch :
Code:
case 9 : {
    if (profileNamespace getVariable ["The_programmer_silence",false]) then {
        hintSilent parseText format ["<t color='#FF0000'><t size='2'><t align='center'>MESSAGE FROM POLICE<br/><br/><t color='#33CC33'><t align='left'><t size='1'>Recipient: <t color='#ffffff'>All civilians<br/><t color='#33CC33'>From: <t color='#ffffff'>police<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%1",_msg];
    } else {
        _son = profileNamespace getVariable ["The_programmer_SMS","Notif_iphone"];
        if ((isClass (missionConfigFile >> "CfgSounds" >> _son)) || (isClass (configFile >> "CfgSounds" >> _son))) then {[player,_son,50,1] remoteExec ["life_fnc_say3D",0];};

        hint parseText format ["<t color='#FF0000'><t size='2'><t align='center'>MESSAGE FROM POLICE<br/><br/><t color='#33CC33'><t align='left'><t size='1'>Recipient: <t color='#ffffff'>All civilians<br/><t color='#33CC33'>From: <t color='#ffffff'>police<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%1",_msg];
    };

    ["AdminMessage",["You have a new message from the police !"]] call bis_fnc_showNotification;
    if (playerSide isEqualTo west) then {systemChat format ["Sent by the police officer : %1",_from];};
};
-> Display the message, you can change the texts here.


Note :
The texture of the button is the same as the button for the admin, it is thus written "ADMIN ALL" if you want to modify it, it is necessary to make a new texture in your mission/Iphone_XI/textures/menus/phone_system/messages/extra like the file adminButton.paa which you will be able to name policeButton.paa for example.
-> It will be necessary to modify in the fn_phone_newMessageMenu.sqf the name of the texture to put the new one.
 
Solution