NameThatGuy Posted July 31, 2011 Share Posted July 31, 2011 Hi, I got a problem with gates, because I can't really script, but i'm learning aswell. Anyways, I made 3 gates that I want to react on name, but what kind of script should I do? I already got the .lua file but I have no idea what to do with it so it opens when I get close to it. If you got problems to understand my english, please let me know Link to comment
bandi94 Posted July 31, 2011 Share Posted July 31, 2011 createMarker -- create a marker "onMarkerHit"--when player hit the marker getPlayerName -- to check player name moveObject --to open the gate "onMarkerLeave"-- when the player left the marker moveObject --to close the gate Link to comment
NameThatGuy Posted July 31, 2011 Author Share Posted July 31, 2011 Thanks alot, but how do I format it within the coordinates etc. Link to comment
NotAvailable Posted July 31, 2011 Share Posted July 31, 2011 --Client side: Only you can see it opening --Server side: Everybody can see it opening marker = createMarker(0,0,3,"cylinder", 3, 255, 200, 0, 140, getRootElement()) -- Create the marker at the middle of GTA gate = createObject(980, 0, 0, 3, 0, 0, 0) -- create the gate when the resource starts function moveGate() -- create the moving gate function moveObject(gate, 1000, 0, 0, 5) -- move it 5 units higher in 1 second (1000ms) setTimer(moveObject, 5000, 1, gate, 0, 0, 3) -- move it back after 5 seconds end addCommandHandler("meep", moveGate) Link to comment
NameThatGuy Posted July 31, 2011 Author Share Posted July 31, 2011 Thanks, Jesse. But where do I put my coordinates? x: 1119.2196044922 y: -1161.8154296875 z: 25.339630126953 and can I repeat this to get 2 more gates in one script, if then, how? Link to comment
bandi94 Posted July 31, 2011 Share Posted July 31, 2011 @ Jesseunit why you create a marker if you use comand (/meep) ? @ NameThatGuy you wanna the gate to open whit code ( exp you need to type in chat /meep or check the player name ) Link to comment
NameThatGuy Posted July 31, 2011 Author Share Posted July 31, 2011 But when I start the map editor, I don't know how to start his script, I made like this; folder "mygate" > "mygate.lua" and I pasted his script into it and started the map editor and made a gate, but I have no idea how to test it.. btw, i'm using 1.1 Link to comment
bandi94 Posted July 31, 2011 Share Posted July 31, 2011 bk you need to put your cordinates tell me you wanna the gate to open whit code ( exp you need to type in chat /meep or check the player name ) and i make it for you and i show you where you need to put your cordinates and .. Link to comment
NameThatGuy Posted July 31, 2011 Author Share Posted July 31, 2011 Uhm, I mean, how do I put the script into my gate and how is it supposed to know my coordinates? Link to comment
bandi94 Posted July 31, 2011 Share Posted July 31, 2011 gate = createObject(980, x, y, z, rx, ry, rz) -- 980 it id of object(gate) x,y,z is cordinates of gate ,rx,ry,rz is rotation of gate function moveGate() -- create the moving gate function moveObject(gate, 1000, x, y, z) -- 1 second (1000ms) x,y,z is the cordinates when gate is opened setTimer(moveObject, 5000, 1, gate, x, y, z) -- move it back after 5=(5000ms) seconds, x,y,z is cordinates when the gate is closed end addCommandHandler("meep", moveGate)-- to open the gate you need to write in chat /meep you need to ad this in a .lua file in meta you put server side start script start play mode go to gate and write in chat /meep and the gate open and after 5s after opened it close (its btert to usemarker bk if you stay in gate and the 5 sec passed then the gate will close and you get stuck) in map editor put your gate when you whant and se ethe cordinates when the gate is in colsed posotion and again when is opened position Link to comment
NameThatGuy Posted July 31, 2011 Author Share Posted July 31, 2011 Hi, i'm back, I edited a little so it now looks like this; --Client side: Only you can see it opening --Server side: Everybody can see it opening -- Create the marker at the middle of GTA gate = createObject(980, 1119.2196044922, -1161.8154296875, 25.339630126953, 0, 0, 0) -- create the gate when the resource starts function moveGate() -- create the moving gate function moveObject(gate, 1000, 1, 1119.2196044922, -1161.8154296875, 23.339630126953, 0, 0, 0) -- move it 5 units higher in 1 second (1000ms) setTimer(moveObject, 5000, 1, gate, 1119.2196044922, -1161.8154296875, 25.339630126953, 0, 0, 0) -- move it back after 3 seconds end addCommandHandler("meep", moveGate) and I removed the from the meta.xml and replaced it with Anyway, now I managed to get the script working on the gate, but the gate disappears and never comes back. It doesn't move a little, it just completely disappear so I have to restart it all the time. Any thoughts? Link to comment
bandi94 Posted July 31, 2011 Share Posted July 31, 2011 you added "1" at moveObject affter 1000 and also i modified 1000 to 3000 and 5000 to 6000 for smother move --Client side: Only you can see it opening --Server side: Everybody can see it opening -- Create the marker at the middle of GTA gate = createObject(980, 1119.2196044922, -1161.8154296875, 25.339630126953, 0, 0, 0) -- create the gate when the resource starts function moveGate() -- create the moving gate function moveObject(gate, 3000, 1119.2196044922, -1161.8154296875, 23.339630126953, 0, 0, 0) -- move it 5 units higher in 1 second (1000ms) setTimer(moveObject, 6000, 1, gate, 1119.2196044922, -1161.8154296875, 25.339630126953, 0, 0, 0) -- move it back after 3 seconds end addCommandHandler("meep", moveGate) Link to comment
NameThatGuy Posted July 31, 2011 Author Share Posted July 31, 2011 Thanks man, you're the best! But it only moved halfway and then it disappeared, how to fix this? Link to comment
bandi94 Posted July 31, 2011 Share Posted July 31, 2011 try this --Client side: Only you can see it opening --Server side: Everybody can see it opening -- Create the marker at the middle of GTA gate = createObject(980, 1119.2196044922, -1161.8154296875, 25.339630126953, 0, 0, 0) -- create the gate when the resource starts function moveGate() -- create the moving gate function moveObject(gate, 3000, 1119.2196044922, -1161.8154296875, 23.339630126953) -- move it 5 units higher in 1 second (1000ms) setTimer(moveObject, 6000, 1, gate,3000, 1119.2196044922, -1161.8154296875, 25.339630126953) -- move it back after 3 seconds end addCommandHandler("meep", moveGate) Link to comment
NameThatGuy Posted July 31, 2011 Author Share Posted July 31, 2011 Nice, but it didn't work, it moves halfway down but now it moves up atleast I need help to get it all the way down to the ground and then up again Link to comment
bandi94 Posted July 31, 2011 Share Posted July 31, 2011 i don't know why its not working if you wanna i can make it whit a marker when you go in front of the gate its open when you left the gate its close ... or see if somebody can fix it Link to comment
NameThatGuy Posted July 31, 2011 Author Share Posted July 31, 2011 i don't know why its not working if you wanna i can make it whit a marker when you go in front of the gate its open when you left the gate its close ... or see if somebody can fix it Yes, please, I would appreciate it Link to comment
NotAvailable Posted August 1, 2011 Share Posted August 1, 2011 local enterGate = createObject(980, 1245.5443115234, -767.16320800781, 91.422187805176, 0, 0, 0) local marker = createMarker(1245.5930175781,-767.2734375,91.150520324707,"Cylinder", 10, 255, 0, 0, 0) function gates() local guy = getLocalPlayer() if (getPlayerName(guy) == "NameThatGuy" ) then moveObject(enterGate, 1000, 1245.5443115234, -767.16320800781, 88.272178649902) else outputChatBox("* You are not cool enough to open this gate", 255, 0, 0, false) end end addEventHandler("onClientMarkerHit", marker, gates) function close() moveObject(enterGate, 1000, 1245.5443115234, -767.16320800781, 91.422187805176) end addEventHandler("onClientMarkerLeave", marker, close) The gate is located @MAddogs mansion, LS 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