Vercetti1010 Posted February 12, 2008 Share Posted February 12, 2008 hello. i have quite a problem here. I am trying to make area51 gated and the gates me movable by a command. the problem is, i dont know how to tell the game which object to move. its almost difficult explaining the problem really. basically what i am aiming to do is incoprporate this into our admin scripts so that admins can fly in and out and open and shut gates while players flying in will blow up and they cant open the gates. i have a good plan going here. for opening of gates, i will use moveObject (cant tell the game which object to move though) i will use createexplosion to make well..explosions at the player if they are not an admin. basically i need to define which object needs to be moved. can someone give me a hand? Link to comment
SpInKsTaR Posted February 12, 2008 Share Posted February 12, 2008 http://development.mtasa.com/index.php?title=MoveObject Example 2 Might help you Link to comment
Quest Posted February 12, 2008 Share Posted February 12, 2008 When you do createObject do this gate1 = createObject and then gate2 = createObject . That is how you would label them, then do: moveObject ( gate1, 3000, x, y, z ). And do the same for gate2 for the position you want the object to move. Hope that helps Link to comment
Vercetti1010 Posted February 12, 2008 Author Share Posted February 12, 2008 still not working. i get an error loading the script. here is the script here. can anyone tell me how to fix it? function gateOneOpen ( thePlayer ) createObject ( 986, 96.790939, 1921.111084, 18.860405, [ 1.570796, 0.000000, 0.000000 ] ) gateOneClosed = createObject ( 986, 96.790939, 1921.111084, 18.860405, [ 1.570796, 0.000000, 0.000000 ] ) moveObject ( gateOneClosed, 3000, 96.940948, 1925.990845, 18.860405, [ 1.570796, 0.000000, 0.000000 ] ) outputChatBox ( "Gate one opening", thePlayer, 255, 0, 0 ) end function gateOneClose ( thePlayer ) createObject ( 986, 96.940948, 1925.990845, 18.860405, [ 1.570796, 0.000000, 0.000000 ] ) gateOneOpened = createObject ( 986, 96.940948, 1925.990845, 18.860405, [ 1.570796, 0.000000, 0.000000 ] ) moveObject ( gateOneOpened, 3000, 96.790939, 1921.111084, 18.860405, [ 1.570796, 0.000000, 0.000000 ] ) outputChatBox ( "Gate one closing", thePlayer, 255, 0, 0 ) end addCommandHandler ( "gateoneopen", gateOneOpen ) addCommandHandler ( "gateoneclose", gateOneClose ) Link to comment
Quest Posted February 13, 2008 Share Posted February 13, 2008 You need to label each one of the moving parts. I see that you are creating new objects instead of moving them. Something like this I think: function Load( name ) if name ~= getThisResource() then return else gate1 = createObject ( 986, 96.790939, 1921.111084, 18.860405, [ 1.570796, 0.000000, 0.000000 ] ) end end function gateOneOpen ( thePlayer ) moveObject ( gate1, 3000, 96.940948, 1925.990845, 18.860405, [ 1.570796, 0.000000, 0.000000 ] ) outputChatBox ( "Gate one opening", thePlayer, 255, 0, 0 ) end function gateOneClose ( thePlayer ) moveObject ( gate1, 3000, 96.940948, 1925.990845, 18.860405, [ 1.570796, 0.000000, 0.000000 ] ) outputChatBox ( "Gate one closing", thePlayer, 255, 0, 0 ) end addEventHandler ( "onResourceStart", getRootElement(), Load) addCommandHandler ( "gateoneopen", gateOneOpen ) addCommandHandler ( "gateoneclose", gateOneClose ) I haven't tested, but by the looks of it it should work. Link to comment
Vercetti1010 Posted February 13, 2008 Author Share Posted February 13, 2008 hmm....i get a script error that says this: unexpected symbol near "[" Link to comment
Jumba' Posted February 13, 2008 Share Posted February 13, 2008 Hey Quest, what's the [ and ] for? Does it mean like optional or soemthing? Link to comment
Quest Posted February 13, 2008 Share Posted February 13, 2008 Actually he had them in there, I don't use them. But math wise it shouldn't have any effect on it, I don't think. But then again, they could screw it up. Link to comment
Vercetti1010 Posted February 13, 2008 Author Share Posted February 13, 2008 its in the syntax but the server thinks it is an invalid character Link to comment
Jumba' Posted February 13, 2008 Share Posted February 13, 2008 The stuff aenclosed in [ and ] are optional, you dont have to put the [ ], it just tells you that those arguments can be left blank. Link to comment
Vercetti1010 Posted February 13, 2008 Author Share Posted February 13, 2008 i figured it out, thanks for all your help 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