-ffs-AbodyRulez Posted August 31, 2013 Share Posted August 31, 2013 I made a script to move an object from point A to point B, it works well when addEventHander is attached to root, but i don't want this moving object(event) to be seen by anyone else but the one who triggered event, so i tried replacing getRootElement() with getLocalPlayer() but its not working, any help? marker = createMarker(-840.2998046875, -3680.599609375, 44.299999237061) hitPlayer = getLocalPlayer() function shadesMagic(hitPlayer, matchingDimension) if marker == hitPlayer or matchingDimension then block_1 = createObject(3095,-808.7998046875,-3623.5,52.200000762939,0,146.99157714844,0) moveObject(block_1,600,-835.7998046875,-3623.5,43.200000762939,0,33.00842285156,0) end end addEventHandler("onClientMarkerHit", getLocalPlayer(), shadesMagic) Link to comment
Sora Posted August 31, 2013 Share Posted August 31, 2013 (edited) Try triggering a function like this -- server side triggerClientEvent(source,"sth",source) -- client side addEvent("sth",true) addEventHandler("sth",root, function () marker = createMarker(-840.2998046875, -3680.599609375, 44.299999237061) hitPlayer = getLocalPlayer() function shadesMagic(hitPlayer, matchingDimension) -- if marker == hitPlayer or matchingDimension then this makes no sense block_1 = createObject(3095,-808.7998046875,-3623.5,52.200000762939,0,146.99157714844,0) moveObject(block_1,600,-835.7998046875,-3623.5,43.200000762939,0,33.00842285156,0) -- end end addEventHandler("onClientMarkerHit", marker, shadesMagic) end) Edited August 31, 2013 by Guest Link to comment
-ffs-AbodyRulez Posted August 31, 2013 Author Share Posted August 31, 2013 Bad argument @ triggerClientEvent [expected string at argument 1, got nil] Link to comment
Sora Posted August 31, 2013 Share Posted August 31, 2013 Bad argument @ triggerClientEvent [expected string at argument 1, got nil] i put source as an example , you should define the player Link to comment
-ffs-AbodyRulez Posted August 31, 2013 Author Share Posted August 31, 2013 (edited) You lost me -- if marker == hitPlayer or matchingDimension then this makes no sense if marker == hitplayer or matchingDimension == true How come it makes no sense? Edited August 31, 2013 by Guest Link to comment
Sora Posted August 31, 2013 Share Posted August 31, 2013 You lost me What's the player defined in your script? if the player was defined as player then change this triggerClientEvent(source,"sth",source) to triggerClientEvent(player,"sth",player) clear example : addCommandHandler("sth", function (player) triggerClientEvent(player,"sth",player) end) Link to comment
-ffs-AbodyRulez Posted August 31, 2013 Author Share Posted August 31, 2013 Got it, i'll try Link to comment
Xperia Posted September 1, 2013 Share Posted September 1, 2013 Do you want to move a object when somebody hit the marker? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now