English Not solved How to create a power button for iPhoneX

  • Auteur de la discussion Auteur de la discussion JakobRabe
  • Date de début Date de début
  • Bonjour Visiteur ! Les sujets de cette catégorie sont clos. Si vous souhaitez réouvrir, merci de nous contacter en précisant le lien du post à réouvrir !

    Hello Visiteur ! The topics in this category are closed. If you wish to reopen, please contact us with the link of the post you wish to reopen !

JakobRabe

User
26/5/20
1
0
100
Hello,

I want to Create a Button on the iPhoneX where you can Turn the Phone Off. When you have turned off no body can Phone you or Send Messages. Also when the Phone is Turned off the Buttons should not Shown that you still can use it when your Phone is On. When you press the button to turn on the Phone the Buttons should shown and you can phone and message normaly.

Someone can Help me?

LG
 
Hello :)

There is many way to do that, but first you'll have to edit the dialog of the menu you want (.hpp files, for example in the settings) to add for example a Life_Checkbox control.
Then when this box is activated, you can set a variable, for example :
Code:
player setVariable ["iphonex_mode","off",true];

Here is an example of a Life_Checkbox with the variable :
Code:
class iphoneMode: Life_Checkbox {
    idc = -1;
    oncheckedchanged = "if ((_this select 1) isEqualTo 1) then {player setVariable ["iphonex_mode","off",true];} else {player setVariable ["iphonex_mode","on",true];};";
    x = 0;
    y = 0;
    w =0;
    h = 0;
};
WARNING : You'll have to put the position of it : x, y, w, h

Then to block incoming messages/calls, in your @The_Programmer/addons/advanced_phone/client/fn_sendMSG.sqf, find :
Code:
_player = _toNum call _fn_findPlayerByNum;
if (isNull _player) exitWith {
    uiSleep 1; 
    hint (["STR_FAIL_PHONE_NUMBER","Max_Settings_Phone","Phone_Localization"] call theprogrammer_core_fnc_localize);
};
and add below :
Code:
if ((_player getVariable ["iphonex_mode","on"]) isEqualTo "off") exitWith {uiSleep 1; hint "This person's phone is turned off";};

And in your @The_Programmer/addons/advanced_phone/client/fn_sendCall.sqf, find :
Code:
_playerTo = _toNum call _fn_findPlayerByNum;

if (isNull _playerTo) exitWith {
    uiSleep 1; 
    hint (["STR_FAIL_PHONE_NUMBER","Max_Settings_Phone","Phone_Localization"] call theprogrammer_core_fnc_localize);
    player setVariable ["calling_ano",false,true];
    _exit = true;
};
and add below :
Code:
if ((_playerTo getVariable ["iphonex_mode","on"]) isEqualTo "off") exitWith {uiSleep 1; hint "This person's phone is turned off"; player setVariable ["calling_ano",false,true]; _exit = true;};

You just have to correctly place the CheckBox in the dialog and it should work :)