Jump to content
  • 0

Help remaking this bike script


juandayz

Question

Hey,  i working on deployable drug plants.  Using right click on a shovel.  and using the old deploy bike script.

The plant spawn fine. but when i extract the drug, this plant explote. and kill me:)

heres the drug.sqf

Spoiler

if (false) then {
    cutText [format["You are in combat and cannot plant marihuana."], "PLAIN DOWN"];
} else {    
    player playActionNow "Medic";
    r_interrupt = false;   
    _dis=10;
    _sfx = "repair";
    [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
    sleep 6;
 
    _object = "fiberplant" createVehicle (position player);
    _object setVariable ["ObjectID", "1", true];
    _object setVariable ["ObjectUID", "1", true];
 
    player reveal _object;
 
    cutText [format["You've used your shovel to plant a herb! enjoy!"], "PLAIN DOWN"];
 
    r_interrupt = false;
    player switchMove "";
    player playActionNow "stop";
 
    sleep 10;
 
    cutText [format["Warning: Spawned herbs DO NOT SAVE after server restart!"], "PLAIN DOWN"];
 
};

and the call for extra_rc.hpp (this work fine)

Spoiler

 class ItemKnife {
        class farmhemp {
            text = "take drugs";
            script = "execVM 'custom\script\hemp.sqf'";
        };
    };
  class ItemKiloHemp {
        class smokeweed {
            text = "smoke";
            script = "execVM 'custom\script\smokeshit.sqf'";
        };
    };
   class ItemShovel {
         class smokeweed {
            text = "Plant drug";
            script = "execVM 'custom\script\drug.sqf'";
        };
    };
};

and i put "fiberplant" into variables.sqf in section: dayz_allowedObjects = []

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

try it too

Spoiler

private ["_mags","_player","_weps","_hasItems","_hasTools","_wheelNumber","_canDo","_finished","_finishedTime","_veh","_vehtospawn","_dir","_pos","_dist"];

_player = player; //Setting a local variable as player saves resources
_mags = magazines _player;
_weps = weapons _player;
_vehicle = vehicle _player;
_canDo = call fnc_actionAllowed;
_wheelNumber = {_x == "ItemWaterbottle";} count _mags; // must return 2 or more
_hasItems = (("ItemBurlap" in _mags) && (_wheelNumber > 1));
_hasTools = ("ItemShovel" in _weps);

if((_hasItems && _hasTools && RequireToolBoxBike && RequirePartsBike) || (!RequireToolBoxBike && RequirePartsBike && _hasItems) || (!RequirePartsBike && RequireToolBoxBike && _hasTools) || (!RequirePartsBike && !RequireToolBoxBike)) then {
    hasBikeItem = true;
} else {
    hasBikeItem = false;
    if(RequirePartsBike && RequireToolBoxBike) then {
        cutText ["\n\nNecesitas: 1x Burlap, 1x shovel y 2x botellas de agua para plantar", "PLAIN DOWN"];
    } else {
        if(RequirePartsBike && !RequireToolBoxBike) then {
            cutText ["\n\nNecesitas: 1x Burlap and 2x botellas de agua para plantar", "PLAIN DOWN"];
        } else {
            if(!RequirePartsBike && RequireToolBoxBike) then {
                cutText ["\n\nNecesitas: 1x Shovel para plantar", "PLAIN DOWN"];
            };
        };
    };
};


/********** Exit sequences **********/
if (!hasBikeItem) exitWith {};
if(!(_canDo)) exitWith {cutText ["no puedes ahora mismo","PLAIN DOWN"];};
/********** End Exit sequences **********/


DZE_ActionInProgress = true;
if(RequirePartsBike) then {
    _player removeMagazine "ItemBurlap";
    _player removeMagazine "ItemWaterbottle";
    _player removeMagazine "ItemWaterbottle";
};
if(RequireToolBoxBike) then {
    _player removeWeapon "ItemShovel";
};

_player playActionNow "Medic";
[_player,"repair",0,false,10] call dayz_zombieSpeak;
[_player,10,true,(getPosATL _player)] spawn player_alertZombies;

r_interrupt = false;
r_doLoop = true;

_finished = false;
_finishedTime = diag_tickTime+8;

while {r_doLoop} do {
    if (diag_tickTime >= _finishedTime) then {
        r_doLoop = false;
        _finished = true;
    };
    if (r_interrupt) then {
        r_doLoop = false;
    };
    sleep 0.1;
};

if (_finished) then {
    _vehtospawn = "fiberplant";
    _dist = 6;
    _dir = getDir vehicle _player;
    _pos = getPosATL vehicle _player;
    _pos = [(_pos select 0)+_dist*sin(_dir),(_pos select 1)+_dist*cos(_dir),0];
    _veh = createVehicle [_vehtospawn, _pos, [], 0, "CAN_COLLIDE"];
    _veh setVariable ["MalSar",1,true];
    _veh setVariable ["ObjectID", "1", true];
    _veh setVariable ["ObjectUID", "1", true];
    clearMagazineCargoGlobal _veh;
    clearWeaponCargoGlobal _veh;

    cutText ["\nAlta planta amego", "PLAIN DOWN",3];
    DZE_ActionInProgress = false;
    sleep 6;
    cutText ["\nWarning: las plantas se secan con el restart!", "PLAIN DOWN"];
} else {
    r_interrupt = false;
    _player switchMove "";
    _player playActionNow "stop";
    DZE_ActionInProgress = false;
    
    if(RequirePartsBike) then {
        _player addMagazine "ItemBurlap";
        _player addMagazine "ItemWaterbottle";
        _player addMagazine "ItemWaterbottle";
    };
    if(RequireToolBoxBike) then {
        _player addWeapon "ItemShovel";
    };
    
    cutText ["\n\ndecidiste no plantar!", "PLAIN DOWN",4];
};

 

i need a Battleye exeption to no exploit?

Link to comment
Share on other sites

  • 0

use the right click click_actions but add an allowed actions to the anti hack 

 

 

use this code

 

_player RemoveItems = ["ItemGoldBar",2] // use some thing like this

 

_objectPlaced = "class name here";

// Automagically grab position of player (for output later).

_objectPosition = (getPos player);

// Spawn object on top of player.

_placement = _objectPlaced createVehicle getPos player;

// Set its position to ontop of the player

_placement setPos (getPos player);

// Get the direction the player is facing + alter rotation

_placement setDir (getDir player + 180);

// Wait 3 seconds

sleep 3;

// Set the height of the object (in meters) if required

//_placement setPos [(getPos _placement) select 0, (getPos _placement) select 1, 0.2];
 

Link to comment
Share on other sites

  • 0

mmm no.  see i use it whit it  my knife right click.  This works well when i add a "fiberplant" by arma2oa editor.

Spoiler

/*
put together for DayZ Epoch
Credits to Shogun338 from Insurrection gaming
modified for separate "gather weed" script
*/

private ["_gearmenu","_playerPos","_nearWeed","_weed","_objectID","_objectUID"];
_playerPos = getPosATL player;
_hempqty = {_x == "ItemKiloHemp"} count magazines player;
_nearWeed = count nearestObjects [_playerPos, ["fiberplant"], 4] > ;
_weed = nearestObject [player, "fiberplant"];

if !(_nearWeed) exitWith {
	cutText [format["You need to be near the weed plants in order to gather."], "PLAIN DOWN"];
};
if (_hempqty > 2) exitWith { 
    cutText [format["WARNING: %1, You have maximum amount of weed in your inventory! You could get arrested by the police ;)", name player], "PLAIN DOWN"];
};
if (dayz_combat == 1) then { 
    cutText [format["You are in Combat and Cannot Gather the Weed."], "PLAIN DOWN"];
} else {
	disableSerialization;
	_gearmenu = FindDisplay 106;
	_gearmenu CloseDisplay 106;
	player playActionNow "Medic";
	r_interrupt = false;
	sleep 6;
	_objectID = _weed getVariable["ObjectID","0"];
	_objectUID = _weed getVariable["ObjectUID","0"];
	deleteVehicle _weed;
	[_objectID,_objectUID] call server_deleteObj;
	_weed setDamage 1;
	player addMagazine "ItemKiloHemp";
	sleep 2;
	cutText [format["You've Gathered Some Weed! Smoke that shit or sell it at Black market dealer!!"], "PLAIN DOWN"];	
};

when i spawn a "fiberplant" using right click on shovel. then "fiberplant" spawn fine. Problem is when i cut this spawned fiberplant whit the knife. The plant explote.

im not using infistar.. just battleye... i try to add "fiberplant" in createvehicle.txt on battleye but dsnt works

Link to comment
Share on other sites

  • 0

TNKSSSS selennaa works fineeee now!!!  tnks u too kiwwi!

another questionn....  where i can put  requiere plot in here:

Spoiler

if (false) then {
    cutText [format["You are in combat and cannot set a plant."], "PLAIN DOWN"];
} else {    
    player playActionNow "Medic";
    r_interrupt = false;
    player removeWeapon "ItemShovel";
    _dis=10;
    _sfx = "repair";
    [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
    sleep 6;
 
    _object = "fiberplant" createVehicle (position player);
    _object setVariable ["ObjectID", "1", true];
    _object setVariable ["ObjectUID", "1", true];
 
    player reveal _object;
 
    cutText [format["You've used your shovel to set a plant! smell like a dream!"], "PLAIN DOWN"];
 
    r_interrupt = false;
    player switchMove "";
    player playActionNow "stop";
 
    sleep 10;
 
    cutText [format["Warning: Spawned plants DO NOT SAVE after server restart!"], "PLAIN DOWN"];
 
};

 

Link to comment
Share on other sites

  • 0

got it,

Spoiler

private ["_onLadder","_isWater","_cancel","_reason","_canBuildOnPlot","_vehicle","_inVehicle","_abort","_requireplot","_isAllowedUnderGround","_offset","_isPole","_findNearestPoles","_findNearestPole","_ownerID","_distance","_classname","_IsNearPlot","_needText"];

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_40") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
 
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater =  dayz_isSwimming;
_cancel = false;
_reason = "";
_canBuildOnPlot = false;

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
 
DZE_Q = false;
DZE_Z = false;
 
DZE_Q_alt = false;
DZE_Z_alt = false;
 
DZE_Q_ctrl = false;
DZE_Z_ctrl = false;
 
DZE_5 = false;
DZE_4 = false;
DZE_6 = false;
 
DZE_cancelBuilding = false;
 
call gear_ui_init;
closeDialog 1;


 
if (_isWater) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_26", "PLAIN DOWN"];};
if (_inVehicle) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_42"), "PLAIN DOWN"];};
if (_onLadder) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_21", "PLAIN DOWN"];};
if (player getVariable["combattimeout", 0] >= time) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_43"), "PLAIN DOWN"];};

if(_abort) exitWith {
cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};

_requireplot = DZE_requireplot;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "requireplot")) then {
_requireplot = getNumber(configFile >> "CfgVehicles" >> _classname >> "requireplot");
};
 
_isAllowedUnderGround = 1;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
_isAllowedUnderGround = getNumber(configFile >> "CfgVehicles" >> _classname >> "nounderground");
};
 
_offset =  getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
if((count _offset) <= 0) then {
_offset = [0,1.5,0];
};
 
_isPole = (_classname == "Plastic_Pole_EP1_DZ");
 
_distance = DZE_PlotPole select 0;
_needText = localize "str_epoch_player_246";
 
if(_isPole) then {
_distance = DZE_PlotPole select 1;
};
 
// check for near plot
_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
_findNearestPole = [];
 
{
if (alive _x) then {
_findNearestPole set [(count _findNearestPole),_x];
};
} foreach _findNearestPoles;
 
_IsNearPlot = count (_findNearestPole);
 
// If item is plot pole and another one exists within 45m
if(_isPole and _IsNearPlot > 0) exitWith {  DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };
 
if(_IsNearPlot == 0) then {
 
// Allow building of plot
_canBuildOnPlot = true;
 
} else {
// Since there are plots nearby we check for ownership and then for friend status
 
// check nearby plots ownership and then for friend status
_nearestPole = _findNearestPole select 0;
 
// Find owner
_ownerID = _nearestPole getVariable["CharacterID","0"];
 
// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
 
// check if friendly to owner
if(dayz_characterID == _ownerID) then {  //Keep ownership
// owner can build anything within his plot except other plots
if(!_isPole) then {
_canBuildOnPlot = true;
};
 
} else {
// disallow building plot
_canBuildOnPlot = false;
};
};
 
// _message
if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format["Hay un plot cerca, no puedes plantar aqui"], "PLAIN DOWN",3]; };

 


///////////////////////////////////deploy objet start here
if (false) then {
    cutText [format["Estas en combate, no puedes construir."], "PLAIN DOWN"];
} else {    
    player playActionNow "Medic";
    r_interrupt = false;
    player removeWeapon "ItemShovel";
    _dis=10;
    _sfx = "repair";
    [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
    [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
    sleep 6;
 
 
    _object = "BeltBuckle_DZE" createVehicle (position player);    
    _object setVariable ["ObjectID", "1", true];
    _object setVariable ["ObjectUID", "1", true];
    _stone = "MAP_R2_Boulder1" createVehicle (position player);
    _stone setVariable ["ObjectID", "1", true];
    _stone setVariable ["ObjectUID", "1", true];
    _sand = "MAP_barrel_sand" createVehicle (position player);
    _sand setVariable ["ObjectID", "1", true];
    _sand setVariable ["ObjectUID", "1", true];
    _chily = "MAP_P_cihly3" createVehicle (position player);
    _chily setVariable ["ObjectID", "1", true];
    _chily setVariable ["ObjectUID", "1", true];
    _cart = "Land_Wheel_cart_EP1" createVehicle (position player);
    _cart setVariable ["ObjectID", "1", true];
    _cart setVariable ["ObjectUID", "1", true];
 
    player reveal _object;
 
    cutText [format["Muy bien, con piedra y agua puedes hacer ladrillos y mortero!"], "PLAIN DOWN"];
 
    r_interrupt = false;
    player switchMove "";
    player playActionNow "stop";
 
    sleep 10;
 
    cutText [format["Los barriles spawneados no se guardan con el restart!"], "PLAIN DOWN"];
 
};

 

Link to comment
Share on other sites

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
  • Discord

×
×
  • Create New...