blanic 0 Posted October 28, 2010 My script works fine, even in multiplayer, but it only affects the person who uses it. It is a spike strip, but only disables the person who drops it not anyone that just drives across it. Any help would be great, i know its not going global not sure how to do this. What this does is sees if you use the inventory item of spike strip and if on USE then activates. It is in its own .sqf _art = _this select 0; if (_art == "use") then { _item = _this select 1; _class = _item call INV_getitemClassName; [_item, -1] call INV_AddInventoryItem; _pos = [(position player select 0) + (sin(getdir player)*2), (position player select 1) + (cos(getdir player)*2), 0]; _obj = _class createvehicle [0, 0, 0]; _obj setdir getdir player; _obj setpos _pos; _vcl = nearestobject [player,"LandVehicle"]; call compile format['_obj setvehicleinit "this setvehiclevarname ""%1%2""; %1%2 = this"; processinitcommands', player, _class]; (format ["if (local server) then {publicarbeiterarctionarray = publicarbeiterarctionarray + [ [%1%2, %1] ];};", player, _class]) call broadcast; _obj setDammage 1; while{!alive _obj} do { if((vehicle player != player) and (player distance _obj < 3)) then { (vehicle player) setDammage .6; (vehicle player) setVelocity [0, -2, 0]; (vehicle player) setfuel 0; deletevehicle _obj; Sleep 6; (vehicle player) setfuel 0.2; }; }; }; Share this post Link to post Share on other sites
blanic 0 Posted October 30, 2010 anyone have any ideas? should I call this as a public variable? Share this post Link to post Share on other sites
shuko 59 Posted October 30, 2010 Of course it only works for the player since only the user runs the script and the script only checks if that player drives close enough. There are few ways fix it. I'd probably move the checking to server side, replacing the while !alive -loop with just a pubvar with the object, which server catches. On the server you can either create a trigger or make a spawn wait until any players' vehicle is close enough: {(vehicle _x) iskindof "LandVehicle" && _x distance obj < 3} count playableunits > 0 Share this post Link to post Share on other sites
blanic 0 Posted October 31, 2010 well i think i kinda got it, problem is if you place more than 1 then it will only work for the 1, instead of multiple ones. Really thought I would have found a spikestrip .sqf somewhere. Share this post Link to post Share on other sites