jdmark Posted April 3, 2013 Share Posted April 3, 2013 object = createObject (980, 2813.330078125, -1468.1806640625, 16.254442214966) marker = createMarker(2813.330078125, -1468.1806640625, 16.254442214966, "cylinder", 2, 100, 0, 0, 100) function gate(player) local data = getElementData(player,"job") if (data=="hex") then moveObject(object, 500, 2813.330078125, -1468.1806640625, 16.254442214966) else outputChatBox('Sorry, you can't enter the impound.",player,255,0,0) end addEventHandler("onmarkerhit",gateo) function gatec(player) moveObject(object,2813.330078125, -1468.1806640625, 16.254442214966) end addEventHandler("onmakerleave",gatec) end this is the lua script i made can someone check it please Link to comment
Mega9 Posted April 3, 2013 Share Posted April 3, 2013 object = createObject (980, 2813.330078125, -1468.1806640625, 16.254442214966) marker = createMarker(2813.330078125, -1468.1806640625, 16.254442214966, "cylinder", 2, 100, 0, 0, 100) function gate(player) local data = getElementData(player,"job") if (data=="hex") then moveObject(object, 500, 2813.330078125, -1468.1806640625, 16.254442214966) else outputChatBox("Sorry, you can't enter the impound.",player,255,0,0) -- used both ' and " which broke the function end end addEventHandler("onMarkerHit", marker, gate) -- Case sensitive! function gatec(player) moveObject(object,2813.330078125, -1468.1806640625, 16.254442214966) end addEventHandler("onMarkerLeave", marker, gatec) -- case sensitive as well Link to comment
TAPL Posted April 3, 2013 Share Posted April 3, 2013 Where is the time argument of the function moveObject? Also you should check if the hit element was player using the function getElementType. Link to comment
Mega9 Posted April 3, 2013 Share Posted April 3, 2013 Oh right, that one slipped. Let's see if he can figure it out himself. Link to comment
jdmark Posted April 3, 2013 Author Share Posted April 3, 2013 thank you but what if i want to make the gate open whit a command ? Link to comment
jdmark Posted April 3, 2013 Author Share Posted April 3, 2013 and i wan tto make it only work for the faction hex but where do i need to post that command in the lua? sorry for asking so much never script a gate before Link to comment
Mega9 Posted April 3, 2013 Share Posted April 3, 2013 And how do you get the "faction" name? With getElementData? If so, you've already done it good in first function, apply the same at second function when closing gates. Link to comment
Moderators IIYAMA Posted April 4, 2013 Moderators Share Posted April 4, 2013 I think that will be type() if type(value) =="table" then -- not sure if table is also a type, but yes I think it is. elseif type(value) =="string" then elseif type(value) =="number" then end But hex becomes a number....... or you should first convert it to a string. tostring() tonumber() Link to comment
Mega9 Posted April 4, 2013 Share Posted April 4, 2013 What he meant by hex is a name of gang, not a hex code. Btw. he contacted me via PM where I explained him things he needed. Link to comment
Moderators IIYAMA Posted April 4, 2013 Moderators Share Posted April 4, 2013 ok, my bad. 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