Sign in to follow this  
Followers 0
Nakama

AddAction - WHY YoU NO WORK

1 post in this topic

Custom action shows on player respawn, after use it kills itself...Not sure why it won't run on MP 

I do have this working in the editor. I however can not seem to get it running server side, I am not sure if this is because I have my event handler set up wrong, any help/information would be appreciated . 

Wasn't sure where to post this, put it in spawning & loadout because the action is meant to work on respawn

Actions.sqf

TAG_showActions = true;
publicVariable "TAG_showActions";
sleep 1;
TAG_showActions_JIP = true;
publicVariable "TAG_showActions_JIP";

TAG_fnc_spawn_Quad = {

	_spawn = "B_G_Quadbike_01_F";
	_posplr = [((getPos player) select 0) + 2, ((getPos player) select 1) + 2, 0];
	_dirplr = getDir player;
	_spwnveh = _spawn createVehicle (_posplr);
    _myHint = format ["Warning: Spawned ATVs DO NOT SAVE after server restart!"];

    GlobalHint = _myHint;

    publicVariable "GlobalHint";

    hintSilent parseText _myHint;

    _pause = time + 30;

    TAG_showActions = false;
};

TAG_fnc_spawn_Boat = {

	_spawn = "C_Rubberboat";
	_posplr = [((getPos player) select 0) + 2, ((getPos player) select 1) + 2, 0];
	_dirplr = getDir player;
	_spwnveh = _spawn createVehicle (_posplr);
    _myHint = format ["Warning: Spawned Boats DO NOT SAVE after server restart!"];

    GlobalHint = _myHint;

    publicVariable "GlobalHint";

    hintSilent parseText _myHint;

    _pause = time + 30;

    TAG_showActions = false;
};

MY_MENU_Vehicles =

[
	["Spawn Vehicle",true],

	["QUAD", [2], "", -5, [["expression", "_thread = 0 spawn TAG_fnc_spawn_Quad;"]], "1", "1"],

	["BOAT", [4], "", -5, [["expression", "_thread = 0 spawn TAG_fnc_spawn_Boat;"]], "1", "1"]
];

player addAction ["Spawn Vehicle", {showCommandingMenu "#USER:MY_MENU_Vehicles";}, [], -99, false, true, "", "TAG_showActions"];

ServerEventHandler.sqf

if (isNil "TAG_showActions") then {TAG_showActions = false};

"TAG_showActions" addPublicVariableEventHandler {_nil = [["Spawn Vehicle", {showCommandingMenu "#USER:MY_MENU_Vehicles";}, [], -99, false, true, "", "TAG_showActions"];};

if (isNil "TAG_showActions_JIP") then {TAG_showActions_JIP = false};

if (TAG_showActions_JIP) then {_nil = ["Spawn Vehicle", {showCommandingMenu "#USER:MY_MENU_Vehicles";}, [], -99, false, true, "", "TAG_showActions"];execVM"Custom\Actions.sqf";};

 

Edited by Nakama

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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.