ARZUMATA

Spawning Bike/QuadBike etc.

66 posts in this topic

you cant modify the database ie respect/poptabs from client files. you can use my addon where i explain this and that i uploaded here a while back http://www.exilemod.com/topic/7577-update-respectpoptabs-and-save-to-database/ 
 

and do something like this:

if !(ExileClientPlayerIsBambi) exitWith {};
if !((vehicle player) isEqualTo player) exitWith {}; 
   if (ExileClientPlayerMoney > 50) then {
      if ((getPlayerUID player) in ["11111111111111","222222222222","333333333"]) then {//player UID here
 
    titleText ["", "PLAIN DOWN"];
    player playActionNow "Medic"; 
    player removeAction DeployBikeAction; 
    _spawnPos = player modelToWorld [0,2,0];
    _spawnDir = (getDir player) -90;
    do_MakeBike = [player, _spawnPos, _spawnDir];
	
			_poptabs = 50;
			_newPoptabs = ExileClientPlayerMoney - _poptabs;
			ENIGMA_UpdateStats = [player,_newPoptabs];
			publicVariableServer "ENIGMA_UpdateStats";
    uiSleep 3;
    publicVariableServer "do_MakeBike"; 
    uiSleep 1;
    ['BIKE DEPLOYED for 50$',0,0.6,2,0] spawn bis_fnc_dynamictext;
} else {	
    ['You are not in list to spawn bike',0,0.6,2,0] spawn bis_fnc_dynamictext;
  };
};

PS i added in check for bambi state before allowing spawn of vehicle.

Edited by happydayz
  • Like 1

Share this post


Link to post
Share on other sites

Ah, nice man.. Thank you for the help here.

I'm just about to check out your "Update Respect/Poptabs and save to database" right now.

 

The abiltiy to use 'Spawn Bike' is now gone, since you've added: if !((vehicle player) isEqualTo player) exitWith {}; but the option is still available if you scroll the mouse wheel. Is it possible to have the option removed after Bambi status?

Share this post


Link to post
Share on other sites
Advertisement
if !(ExileClientPlayerIsBambi) exitWith {player removeAction DeployBikeAction};
if !((vehicle player) isEqualTo player) exitWith {}; 
   if (ExileClientPlayerMoney > 50) then {
      if ((getPlayerUID player) in ["11111111111111","222222222222","333333333"]) then {//player UID here
 
    titleText ["", "PLAIN DOWN"];
    player playActionNow "Medic"; 
    player removeAction DeployBikeAction; 
    _spawnPos = player modelToWorld [0,2,0];
    _spawnDir = (getDir player) -90;
    do_MakeBike = [player, _spawnPos, _spawnDir];
	
			_poptabs = 50;
			_newPoptabs = ExileClientPlayerMoney - _poptabs;
			ENIGMA_UpdateStats = [player,_newPoptabs];
			publicVariableServer "ENIGMA_UpdateStats";
    uiSleep 3;
    publicVariableServer "do_MakeBike"; 
    uiSleep 1;
    ['BIKE DEPLOYED for 50$',0,0.6,2,0] spawn bis_fnc_dynamictext;
} else {	
player removeAction DeployBikeAction
    ['You are not in list to spawn bike',0,0.6,2,0] spawn bis_fnc_dynamictext;
  };
};

give that a try...

Share this post


Link to post
Share on other sites

tho to confess I havent even loaded any of this code up at all. just saw on the home exile screen the question about poptabs not saving to db so thought i'd come lend a hand :) 

 

 

and the bit i added wasnt that line you mentioned....

 

if !(ExileClientPlayerIsBambi) exitWith {};

Just to explain a bit whats going on for you - ExileCLientPlayerIsBambi is equal to True when you are a bambi so basically its checking if you are or are not a bambi and if you are not a bambi it exits. and i just told it to exitwith 

player removeAction DeployBikeAction

so it should exit and remove the action.... see how it goes anyway...

Edited by happydayz

Share this post


Link to post
Share on other sites

Awesome man, will test it right now. Thanks again @)CoM(

I've installed Update Respect/Poptabs and save to database but it didn't seem to remove the money. Could you show me once again in this code how I could get it to use your Variables?

 

if !(ExileClientPlayerIsBambi) exitWith {player removeAction DeployBikeAction};
if !((vehicle player) isEqualTo player) exitWith {}; 
   if (ExileClientPlayerMoney > 50) then {
      if ((getPlayerUID player) in ["11111111111111","222222222222","333333333"]) then {//player UID here
 
    titleText ["", "PLAIN DOWN"];
    player playActionNow "Medic"; 
    player removeAction DeployBikeAction; 
    _spawnPos = player modelToWorld [0,2,0];
    _spawnDir = (getDir player) -90;
    do_MakeBike = [player, _spawnPos, _spawnDir];
	
			_poptabs = 50;
			_newPoptabs = ExileClientPlayerMoney - _poptabs;
			ENIGMA_UpdateStats = [player,_newPoptabs];
			publicVariableServer "ENIGMA_UpdateStats";
    uiSleep 3;
    publicVariableServer "do_MakeBike"; 
    uiSleep 1;
    ['BIKE DEPLOYED for 50$',0,0.6,2,0] spawn bis_fnc_dynamictext;
} else {	
player removeAction DeployBikeAction
    ['You are not in list to spawn bike',0,0.6,2,0] spawn bis_fnc_dynamictext;
  };
};

Share this post


Link to post
Share on other sites

With the below code, the following happens:

  • Menu Comes up to Spawn Bike for Bambi and Non Bambi
  • Bambi can press to 'Spawn Bike' but nothing happens and then the menu persists
  • Non-Bambi can press to 'Spawn Bike' - The option disappears and no longer comes up again, no bike is spawned

 

if !(ExileClientPlayerIsBambi) exitWith {player removeAction DeployBikeAction};
if !((vehicle player) isEqualTo player) exitWith {}; 
   if (ExileClientPlayerMoney > 50) then {
      if ((getPlayerUID player) in ["11111111111111","222222222222","333333333"]) then {//player UID here
 
    titleText ["", "PLAIN DOWN"];
    player playActionNow "Medic"; 
    player removeAction DeployBikeAction; 
    _spawnPos = player modelToWorld [0,2,0];
    _spawnDir = (getDir player) -90;
    do_MakeBike = [player, _spawnPos, _spawnDir];
	
			_poptabs = 50;
			_newPoptabs = ExileClientPlayerMoney - _poptabs;
			ENIGMA_UpdateStats = [player,_newPoptabs];
			publicVariableServer "ENIGMA_UpdateStats";
    uiSleep 3;
    publicVariableServer "do_MakeBike"; 
    uiSleep 1;
    ['BIKE DEPLOYED for 50$',0,0.6,2,0] spawn bis_fnc_dynamictext;
} else {	
player removeAction DeployBikeAction
    ['You are not in list to spawn bike',0,0.6,2,0] spawn bis_fnc_dynamictext;
  };
};

Share this post


Link to post
Share on other sites

ok thats strange its not working for you. how are you loading the addon i mentioned to you? just chuck it in the @exileserver\addons folder to have it auto load. I suggest when adding/working with new code to use the paramater -showscripterrors so that you can see where its having issues.. i will load it all up onmy test server now tho and  double check for you.

Share this post


Link to post
Share on other sites

Question: are you wanting everyone to be able to spawn the bike? because this code by default is for whitelisted players only. ifyou want it to work without having to manually add each player into the list then the code needs to be this:

 

if !(ExileClientPlayerIsBambi) exitWith {player removeAction DeployBikeAction};
if !((vehicle player) isEqualTo player) exitWith {}; 
   if (ExileClientPlayerMoney > 50) then {

    titleText ["", "PLAIN DOWN"];
    player playActionNow "Medic"; 
    player removeAction DeployBikeAction; 
    _spawnPos = player modelToWorld [0,2,0];
    _spawnDir = (getDir player) -90;
    do_MakeBike = [player, _spawnPos, _spawnDir];
	
			_poptabs = 50;
			_newPoptabs = ExileClientPlayerMoney - _poptabs;
			ENIGMA_UpdateStats = [player,_newPoptabs];
			publicVariableServer "ENIGMA_UpdateStats";
    uiSleep 3;
    publicVariableServer "do_MakeBike"; 
    uiSleep 1;
    ['BIKE DEPLOYED for 50$',0,0.6,2,0] spawn bis_fnc_dynamictext;
player removeAction DeployBikeAction; //comment out this line if you want players to be able to spawn multiple bikes (not recomended)
};

 

Share this post


Link to post
Share on other sites

Simple.  Just do this: (note you need to download this extra addon of mine if you want to be able to take the poptabs off the player permanently!

 

HOW TO INSTALL:

If your not running any extra addons folders the easiest way to run this is just adding the Enigma_Exile_Custom.pbo to the @ExileServer/Addons path where it will be loaded up automatically. Otherwise place into any addon folderpath that is loaded on the server!

https://github.com/happydayz-enigma/Enigma_Exile_Custom

 

edit config.cpp, you need to override default client function

Spoiler

class CfgExileCustomCode 
{
   	ExileClient_gui_inventory_event_onSlotDoubleClick = "ExileClient_gui_inventory_event_onSlotDoubleClick.sqf";
};

 

 

New version of ----  ExileClient_gui_inventory_event_onSlotDoubleClick.sqf

Spoiler

/**
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_control","_itemClassName","_magazine","_configName"];
disableSerialization;
_control = _this select 0;
_itemClassName = "";
switch (ctrlIDC _control) do 
{
	case 610:  { _itemClassName = primaryWeapon player; }; 
	case 620:  { _itemClassName = (primaryWeaponItems player) select 0; }; 
	case 621:  { _itemClassName = (primaryWeaponItems player) select 1; }; 
	case 622:  { _itemClassName = (primaryWeaponItems player) select 2; }; 
	case 641:  { _itemClassName = (primaryWeaponItems player) select 3; }; 
	case 611:  { _itemClassName = secondaryWeapon player; }; 
	case 624:  { _itemClassName = (secondaryWeaponItems player) select 0; }; 
	case 625:  { _itemClassName = (secondaryWeaponItems player) select 1; }; 
	case 626:  { _itemClassName = (secondaryWeaponItems player) select 2; }; 
	case 642:  { _itemClassName = (secondaryWeaponItems player) select 3; }; 
	case 612:  { _itemClassName = handgunWeapon player; }; 
	case 628:  { _itemClassName = (handgunItems player) select 0; }; 
	case 629:  { _itemClassName = (handgunItems player) select 1; }; 
	case 630:  { _itemClassName = (handgunItems player) select 2; }; 
	case 643:  { _itemClassName = (handgunItems player) select 3; }; 
	case 6240: { _itemClassName = headgear player; }; 
	case 6216: { _itemClassName = goggles player; }; 
	case 6217: { _itemClassName = ""; }; 
	case 6238: { _itemClassName = binocular player; }; 
	case 6211: { _itemClassName = ""; }; 
	case 6215: { _itemClassName = ""; }; 
	case 6212: { _itemClassName = ""; }; 
	case 6214: { _itemClassName = ""; [] ExecVM "spawn_bike.sqf"; }; //set path to whereever in mission file you keep spawn_bike.sqf
	case 6213: { _itemClassName = ""; }; 
	case 6331: { _itemClassName = uniform player; }; 
	case 6381: { _itemClassName = vest player; }; 
	case 6191: { _itemClassName = backpack player; }; 
	case 623: 
	{ 
		_magazine = primaryWeaponMagazine player;
		if (count _magazine > 0) then
		{
			_itemClassName = _magazine select 0;
		};
	}; 
	case 627: 
	{ 
		_magazine = secondaryWeaponMagazine player;
		if (count _magazine > 0) then
		{
			_itemClassName = _magazine select 0;
		};
	}; 
	case 631: 
	{ 
		_magazine = handgunMagazine player;
		if (count _magazine > 0) then
		{
			_itemClassName = _magazine select 0;
		};
	}; 
};
if !(_itemClassName isEqualTo "") then
{
	_configName = _itemClassName call ExileClient_util_gear_getConfigNameByClassName;
	[_configName, _itemClassName] call ExileClient_gui_itemDetails_show;
};
true

 

mpmissions/your.pbo/spawn_bike.sqf

Spoiler

if !(ExileClientPlayerIsBambi) exitWith {};
if !((vehicle player) isEqualTo player) exitWith {}; 
   if (ExileClientPlayerMoney > 50) then {

    titleText ["", "PLAIN DOWN"];
    player playActionNow "Medic"; 
    _spawnPos = player modelToWorld [0,2,0];
    _spawnDir = (getDir player) -90;
    do_MakeBike = [player, _spawnPos, _spawnDir];
	
			_poptabs = 50;
			_newPoptabs = ExileClientPlayerMoney - _poptabs;
			ENIGMA_UpdateStats = [player,_newPoptabs];
			publicVariableServer "ENIGMA_UpdateStats";
    uiSleep 3;
    publicVariableServer "do_MakeBike"; 
    uiSleep 1;
    ['BIKE DEPLOYED for 50$',0,0.6,2,0] spawn bis_fnc_dynamictext;
};

 

 

mpmissions/your.pbo/init.sqf

Spoiler

//TO BE USED ONLY ON SERVER
if (isDedicated || isServer) then {
	"do_MakeBike" addPublicVariableEventHandler {
		_parameters = (_this select 1);
		_parameters2  =(_parameters select 1);
		diag_log format ["createVehicleRequested %1 ", _parameters]; // YOU NEED THIS FOR LOGS TO SEE WHO DID IT
		veh = createVehicle["Exile_Bike_MountainBike", _parameters2 , [] ,0 , "NONE"];
	};
};

 

 

Just remember that they can buy as many bikes as they want as long as they have the money and as long as they are a bambi!

Edited by happydayz
  • Like 3

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.