golanu21 Posted March 10, 2013 Share Posted March 10, 2013 function crmarker (player, cmd, x1, x2, x3 ) local x, y, z = getLocalPlayer (player) if cmd == "createmarker" then x1 = tonumber( x1 ) x2 = tonumber( x2 ) x3 = tonumber( x3 ) if x1 then if x2 then if x3 then marker1 = createMarker ( x, y, z, "cylinder", 255, 0, 0 ) marker2 = createMarker ( x1, x2, x3, "cylinder", 255, 0, 0 ) else outputChatBox ("[invalid Syntax]: /crmarker [x1], [x2], [x3] ", player, 255, 0, 0 ) end end end end end addCommandHandler("createmarker", crmarker) Link to comment
DNL291 Posted March 10, 2013 Share Posted March 10, 2013 function crmarker (player, cmd, x1, x2, x3 ) local x, y, z = getElementPosition(player) if x1 and x2 and x3 then marker1 = createMarker ( x, y, z, "cylinder", 255, 0, 0 ) marker2 = createMarker ( tonumber(x1), tonumber(x2), tonumber(x3), "cylinder", 255, 0, 0 ) else outputChatBox ("[invalid Syntax]: /crmarker [x1], [x2], [x3] ", player, 255, 0, 0 ) end end addCommandHandler("createmarker", crmarker) Link to comment
golanu21 Posted March 10, 2013 Author Share Posted March 10, 2013 how i make when i enter in marker1 to teleport me to marker2 ? ?? Link to comment
DNL291 Posted March 10, 2013 Share Posted March 10, 2013 Try this: function crmarker (player, cmd, x1, x2, x3 ) local x, y, z = getElementPosition(player) if x1 and x2 and x3 then px, py, pz = x1, x2, x3 marker1 = createMarker ( x, y, z, "cylinder", 255, 0, 0 ) marker2 = createMarker ( tonumber(px), tonumber(py), tonumber(pz), "cylinder", 255, 0, 0 ) else outputChatBox ("[invalid Syntax]: /crmarker [x1], [x2], [x3] ", player, 255, 0, 0 ) end end addCommandHandler("createmarker", crmarker) addEventHandler("onMarkerHit", root, function(hitPlayer) if isElement(marker1) and (source == marker1) then if (getElementType(hitPlayer) == "player") then local vehicle = getPedOccupiedVehicle(hitPlayer) if vehicle then setElementPosition(vehicle, px, py, pz) else setElementPosition(hitPlayer, px, py, pz) end end end end ) Link to comment
golanu21 Posted March 10, 2013 Author Share Posted March 10, 2013 [10:52:51] WARNING: check\server.lua:20: Bad argument @ 'setElementPosition' [Expected number at argument 2, got nil] Link to comment
DNL291 Posted March 10, 2013 Share Posted March 10, 2013 I fixed this and edited my post. 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