Sans Réponses English Button to turn the iPhoneX off

  • Bonjour Visiteur ! Si un de vos sujets est présent ici, et que vous souhaitez le ré-ouvrire, merci de contacter Loic Shmit par message privée sur le forum !

    Hello Visiteur ! If one of your topics is present here, and you want to reopen it, please contact Loic Shmit by private message on the forum!

JakobRabe

User
26/5/20
1
0
100
Badges
1
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
 

Maxence

Director
Membre du personnel
Director
  • IMPRESSIONNANT ! Vous avez aidé au moins 50 personnes sur ce forum !
  • Expert de la communauté The Programmer ! Débloqué lorsque 100 messages sont postés avec votre compte !
  • Badge qui certifie que The Programmer a vérifié ce compte.
22/7/18
714
73
2 000
Badges
7
www.the-programmer.com
Steam
Voir
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 :)