Jump to content

Moving objects


Vercetti1010

Recommended Posts

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

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 :D

Link to comment

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...