Jump to content
Timo

[TUTORIAL] Physical Cellphone

Recommended Posts

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 :

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/&gt"];
};

Add this in "Functions.hpp"

class Player_Menu
{
  file = "core\pmenu";
  class wantedList {};
           . . . .           
  class physicalPhone {}; // ADD these line
};

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);
		};

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) :
Edited by AlaskaVet
Fixed your fn_physicalPhone.sqf
  • Like 3

Share this post


Link to post
Share on other sites

Yes it is, 

createDialog "Life_cell_phone"; // or /** Life_my_smartphone **\ if you use the SQL Based Smartphone   By Silex
Edited by Timo
  • Like 1

Share this post


Link to post
Share on other sites

Hello guy ! I want install this on my server. It's ok but i doesn't work with taskforce radio... I change Itemradio with tf_anprc152 and i doesn't work... An idea? Thanks for all ! (Version 4.4 R3)

Edited by ArashTaFace

Share this post


Link to post
Share on other sites
On 03/10/2016 at 10:44 PM, ⓈⓉⒺⒺⓁ™ said:

in my fn_keyhandler there is 2 case 34 i changed it to 40 not sure if it will still work

It will if you find what key case 40 is, because the cases are keys.

Share this post


Link to post
Share on other sites

tell me something else xcam is not working on my arma 3 so i add in eden editor a lot of items to spesific a lot of trees and now the mission in editor is lagging what i have to do to add them inside the map it self? terrain builder?

 

Share this post


Link to post
Share on other sites
50 minutes ago, Johnny Cash said:

tell me something else xcam is not working on my arma 3 so i add in eden editor a lot of items to spesific a lot of trees and now the mission in editor is lagging what i have to do to add them inside the map it self? terrain builder?

 

Pick one location to ask me man, not both PM and here....

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.