MiniGoveya Posted January 25, 2011 Posted January 25, 2011 Hello, im making this script but i dont know how to make the open door function and i too think that the mostly part of this script is wrong, then, my question is, can u help me saying the wrong things and tell me how can i make the open door function?. local progress = 0; door = createObject(1497, 2476.6862792969,-1657.423828125, 12.327535629272, 0, 0) function markers() marker1 = createMarker( 2485.6589355469, -1682.5872802734, 13.686952590942, 'corona', 5.0, 255, 0, 0, 0 ) marker2 = createMarker( 2493.4475097656, -1675.3487548828, 13.686952590942, 'corona', 5.0, 255, 0, 0, 0 ) marker3 = createMarker( 2493.1372070313, -1665.1042480469, 13.686952590942, 'corona', 5.0, 255, 0, 0, 0 ) marker4 = createMarker( 2492.8647460938, -1656.109375, 13.686952590942, 'corona', 5.0, 255, 0, 0, 0 ) end function marker1() if(marker1 == 0) then if(progress == 0) then progress = 1 else progress = 0 end end end addEventHandler ( "onResourceStart", getRootElement(), marker1 ) function marker2 () if(marker2 == 0) then if(progress == 1) then progress = 2 else progress = 0 end end end addEventHandler( "onResourceStart", getRootElement(), marker2 ) function marker3() if(marker3 == 0) then if(progress == 2) then progress = 3 else progress = 0 end end end addEventHandler( "onResourceStart", getRootElement(), marker3 ) function marker4() if(marker4 == 0) then if(progress == 3) then progress = 0 open door else progress = 0 end end end addEventHandler( "onResourceStart", getRootElement(), marker4 ) Putting the same script on MTA Script Editor the following lines are wrong: -49 -50 -52 -53 -54 Ty for advance.
eAi Posted January 25, 2011 Posted January 25, 2011 How about not repeating the same bad code over and over again? Get one marker working, then the others. But basically, read the wiki, your code makes no sense at all. "if(marker1 == 0) then" means nothing - an element is never going to be 0. Why do you expect 'open door' to work?
MiniGoveya Posted January 25, 2011 Author Posted January 25, 2011 I hope that the function of 'open door' work so that when I pass by the 'markers' in a row, the door opens.
proracer Posted January 25, 2011 Posted January 25, 2011 The function "open door" does not exist unfornunately.
MiniGoveya Posted January 25, 2011 Author Posted January 25, 2011 i know i know, but is there any way to do it opens?
proracer Posted January 25, 2011 Posted January 25, 2011 function openCarDoors() local createVeh = createVehicle(411, 1000, 1000, 1000) -- just thrown random coordinates --- setVehicleDoorState(createVeh, 2, 1) -- opens front left door --- end addEventHandler ("onResourceStart", getResourceRootElement(), openCarDoors) Not tested.
FFS-Racing Posted January 25, 2011 Posted January 25, 2011 I bet he meant some gate or door opening on hitting a marker, rather than getting his vehicle doors opened. Pick whatever would suit you the best: moveObject destroyElement setElementCollisionsEnabled & setElementAlpha
Castillo Posted January 26, 2011 Posted January 26, 2011 function openCarDoors() local createVeh = createVehicle(411, 1000, 1000, 1000) -- just thrown random coordinates --- setVehicleDoorState(createVeh, 2, 1) -- opens front left door --- end addEventHandler ("onResourceStart", getResourceRootElement(), openCarDoors) Not tested. lol, you really got him wrong.. i don't get how you can understand something like this when he actually wants to move a object o_O
proracer Posted January 26, 2011 Posted January 26, 2011 function openCarDoors() local createVeh = createVehicle(411, 1000, 1000, 1000) -- just thrown random coordinates --- setVehicleDoorState(createVeh, 2, 1) -- opens front left door --- end addEventHandler ("onResourceStart", getResourceRootElement(), openCarDoors) Not tested. lol, you really got him wrong.. i don't get how you can understand something like this when he actually wants to move a object o_O I thought by "opening doors" I instantly thought it's a vehicle.My bad then.
MiniGoveya Posted January 26, 2011 Author Posted January 26, 2011 IQ door: Door. 4 markers. When you touch all markers in a certain sequence, the door opens *happy*
50p Posted January 27, 2011 Posted January 27, 2011 How about changing function names to something else than variable names?
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