The-Programmer Forum

Maxence a écrit le dernier message :
#2
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 :)