Hi people,
When you found hostages you have to tell them : "I'm taking your phone, you can't call/text the police or anyone". But sometimes there are trollers. So I had an idea : create a script that virtually create a "physical" cellphone.
Here is how it's work : When you knock-out someone, his cellphone (represented by the radio) will be drop on the floor and the person won't longer be able to use his phone. If he wants to have a phone again he'll have to buy one to a shop or picking the radio on the floor.
There is the tutorial :
1° Create a new file called "fn_physicalPhone" in \core\pmenu\
/*
File: fn_physicalPhone.sqf
Author: Timo
Description:
With no radio cant use Cellphone
*/
if("ItemRadio" in assignedItems player) then {
createDialog "Life_cell_phone"; // "Life_cell_phone" or /** Life_my_smartphone **\ if you use the SQL Based Smartphone By Silex
} else {
hint parseText format ["<t size=1.30' font='puristaMedium' align='center' color='#0D82DF'>No CellPhone</t><br/><br/>
<t size='0.90 'font='puristaLight' align='left'>You must have have a cellphone (Radio) to use this. You can buy cellphone in a general store</t><br/>"];
};
2° Add this in "Functions.hpp"
class Player_Menu
{
file = "core\pmenu";
class wantedList {};
. . . .
class physicalPhone {}; // ADD these line
};
3° Change a line in \dialog\player_inv.hpp
class ButtonCell : Life_RscButtonMenu {
idc = 2014;
text = "$STR_PM_CellPhone";
onButtonClick = "[] call life_fnc_physicalPhone;"; //CHANGE the old line by this
x = 0.42 + (6.25 / 19.8) + (1 / 250 / (safezoneW / safezoneH));
y = 0.8 - (1 / 25);
w = (6.25 / 40);
h = (1 / 25);
};
4° Add this in "fn_keyHandler.sqf" in \core\functions\
//Knock out, this is experimental and yeah... (Shift + G)
case 34: {
if(_shift) then {_handled = true;};
if(_shift && playerSide == civilian && !isNull cursorTarget && cursorTarget isKindOf "Man" && isPlayer cursorTarget && alive cursorTarget && cursorTarget distance player < 4 && speed cursorTarget < 1) then {
if((animationState cursorTarget) != "Incapacitated" && (currentWeapon player == primaryWeapon player OR currentWeapon player == handgunWeapon player) && currentWeapon player != "" && !life_knockout && !(player GVAR ["restrained",false]) && !life_istazed && !life_isknocked) then {
[cursorTarget] spawn life_fnc_knockoutAction;
//ADD THIS
if("ItemRadio" in assignedItems cursorTarget) then {
cursorTarget removeweapon "ItemRadio";
hint "The cellphone of the person was placed on the ground.";
_defenceplace1 = "Item_ItemRadio" createVehicle (player modelToWorld[0,0,0]);}
else { hint "The person that you knock out have no cellphone!"};
//ADD THIS
};
};
};
Basically that's it. You can now create a new shop, or add radio to an existing shop. You also can add radio to default loadout. There is plenty of tutorials to do that.
Screens (It's in my primary language) :
http://image.noelshack.com/fichiers/2014/34/1408740019-2014-08-22-00003.jpg
http://image.noelshack.com/fichiers/2014/34/1408740019-2.jpg
http://image.noelshack.com/fichiers/2014/34/1408740019-3.jpg