xstreme Posted June 6, 2015 Report Share Posted June 6, 2015 hey guys... so im trying to make a script which i will release on here once its going... will be quite a great feature but i cant give much away just yet. i have everything running but am stuck on one MP issue... i am going to use a example below thats not from the script to achieve what i need to achieve. so i spawn a vehicle server side from a script in @epochhive\addons to a marker on map which disappears after restart (perfect for my script) spanwed like this: works great... if(isServer) then { "TRUCK" addPublicVariableEventHandler {_this select 1 call Spawn_ATruck}; Spawn_ATruck = { private["_spawnPos","_spawnDir","_veht"]; _veht = createVehicle["B_Truck_01_mover_F", getMarkerPos "vehspawn", [], 0, "NO_COLLIDE"]; _veht allowDamage false; _veht call EPOCH_server_setVToken; _veht call EPOCH_server_vehicleInit; clearItemCargoGlobal _veht; clearWeaponCargoGlobal _veht; clearMagazineCargoGlobal _veht; _vehm allowDamage true; }; }; My Question: How do i addAction to this spawned vehicle... and once a local player activates this action it removes the action for everyone..removeAction (global). I understand that i can create a function something along the lines of.... xs_fnc_truck_addAction = { _veht = (_this select 0); _veht addaction ["bla bla", "blah.sqf"] }; and then use bis_fnc_mp but what would be the correct way of making the function where to place and where and how do i go about adding it to the truck etc? Link to comment Share on other sites More sharing options...
0 Suppe Posted June 7, 2015 Report Share Posted June 7, 2015 Link to comment Share on other sites More sharing options...
0 Suppe Posted June 10, 2015 Report Share Posted June 10, 2015 This make no sence. Link to comment Share on other sites More sharing options...
0 Halvhjearne Posted June 10, 2015 Report Share Posted June 10, 2015 wouldnt it be easier (not to mention a lot more secure than using bis_fnc_mp) to set a variable within the object that the client can check for? you could also use a pvevent for this, but again i dont see the point in so much network traffic for such a simple thing. Link to comment Share on other sites More sharing options...
0 xstreme Posted June 10, 2015 Author Report Share Posted June 10, 2015 thats simple add actions... im talking addactions that once activated will broadcast/remove action globally using bis_fnc_mp... the vehicle is spawned from the script on the server and needs the action added to it... anyone have any experience with this? Link to comment Share on other sites More sharing options...
0 xstreme Posted June 10, 2015 Author Report Share Posted June 10, 2015 i should also note... i can add a action via a trigger to the server spawned vehicle with this below code... expActiv="{_x addAction [""Action Name"",""script.sqf"", [],1,false,false,"""",""((_target distance _this) <8) and [triggername,_this] call bis_fnc_inTrigger""];} forEach (entities ""B_Truck_01_mover_F"")"; but as we all know addaction is local and bis_fnc_mp can make it broadcast globally... so when a player activates this trigger all i need is for it to remove the action for everyone including jip does anybody know how to correctly use bis_fnc_mp to remove the action globally? Link to comment Share on other sites More sharing options...
0 xstreme Posted June 13, 2015 Author Report Share Posted June 13, 2015 yeh thats why all i need is a way to add the action the the spawned vehicle on the server side script... and then to remove it globally... is it to much? just to explain wait im trying to achieve: the vehicle spawns... a action is added to it for example saying Start Mining... it executes a script and the truck starts mining. Now i want that action removed globally so no one else can make the truck start mining (executing the script again and again and again). Remove Action is local but there must be a way to remove it globally on a server side script. i know igiload uses actions that remove/change globally if a vehicle is loaded etc maybe i need to look into this? or are they using variables? all though there script is client side.... Link to comment Share on other sites More sharing options...
0 Halvhjearne Posted June 13, 2015 Report Share Posted June 13, 2015 on client: H_allowed_mining = false; player addAction ["Dummy Action","dummy.sqf",[],1, true, true, "", "H_allowed_mining"]; the addaction will not show, cause H_allowed_mining is false ... on server: H_allowed_mining = true; publicVariable "H_allowed_mining"; addaction will now show on all clients ... again on server: H_allowed_mining = false; publicVariable "H_allowed_mining"; addaction will NOT show on any clients after this, but can be re-enabled by repeating the above ... or to allow it on a client you desire: H_allowed_mining = false; (owner _player) publicVariableClient "H_allowed_mining"; this will obviusly require that the server knows who _player is, but lets say we determined that before this point, then ONLY the player saved as the variable _player will have the action shown ... this wont exactly remove the action, but it will hide it so the player cannot use it (which is basicly the same, from a players pov). Link to comment Share on other sites More sharing options...
0 xstreme Posted June 13, 2015 Author Report Share Posted June 13, 2015 Yes that's perfect thank you time to wrap up the script Link to comment Share on other sites More sharing options...
Question
xstreme
hey guys...
so im trying to make a script which i will release on here once its going... will be quite a great feature but i cant give much away just yet.
i have everything running but am stuck on one MP issue...
i am going to use a example below thats not from the script to achieve what i need to achieve.
so i spawn a vehicle server side from a script in @epochhive\addons to a marker on map which disappears after restart (perfect for my script)
spanwed like this: works great...
Link to comment
Share on other sites
8 answers to this question
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now