Jump to content

[HELP] Looking for a gate that opens Script Codes


Recommended Posts

Posted

Hi, i made an base with some gates ofcourse. :wink:

And i got the MTASA script program but i need the Script for the moving gates i got the X Y Z coordinates already of the gates

I only need the code.

Does someone know it.

I would really appreciate that. :wink:

Posted
function createTheGate ()
myGate = createObject ( MyObjectID, myGateX, MyGateY, MyGateZ )
end
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate )
 
 
function openMyGate ( )
moveObject ( myGate, 3000, NEWX, NEWY, NEWZ )
setTimer ( movingMyGateBack, 5000, 1 )
end
addCommandHandler("openmodgate",openMyGate)
 
function movingMyGateBack ()
moveObject ( myGate, 3000, myGateX, MyGateY, MyGateZ )
end

Here, this should work.

put to myGateX,myGateY,MyGateZ Your gate coords.

and to newX,newY,newZ your gate position what it should be when it is open.

Regards

Taalasmaa ;)

Posted
function createTheGate ()
myGate = createObject ( MyObjectID, myGateX, MyGateY, MyGateZ )
end
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate )
 
 
function openMyGate ( )
moveObject ( myGate, 3000, NEWX, NEWY, NEWZ )
setTimer ( movingMyGateBack, 5000, 1 )
end
addCommandHandler("openmodgate",openMyGate)
 
function movingMyGateBack ()
moveObject ( myGate, 3000, myGateX, MyGateY, MyGateZ )
end

Here, this should work.

put to myGateX,myGateY,MyGateZ Your gate coords.

and to newX,newY,newZ your gate position what it should be when it is open.

Regards

Taalasmaa

didnt work this is what i did:

function createTheGate ()
 
        myGate = createObject ( MyObjectID, 2490.4057617188, 1055.2071533203,58.293659210205 )
 
end
 
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate )
 
 
 
 
 
function openMyGate ( )
 
moveObject ( myGate, 3000, 2490.1667480469, 1056.8166503906, 58.293659210205 )
 
setTimer ( movingMyGateBack, 5000, 1 )
 
end
 
addCommandHandler("openmodgate",openMyGate)
 
 
 
function movingMyGateBack ()
 
moveObject ( myGate, 3000, 2490.4140625, 1055.1296386719, 58.293659210205 )
 
end

Posted
You forgot to replace "MyObjectID" in line 3 with the actual model id of the gate object.

hmm... i got no errors id changed but when i do the command: /openmodgate the gate does not move?

Heres the code:

function createTheGate ()
 
        myGate = createObject ( object (airportgate) (1), 1485.0126953125, -2474.8330078125, 15.328079223633 )
 
end
 
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate )
 
 
 
 
 
function openMyGate ( )
 
moveObject ( myGate, 3000, 1473.4616699219, -2475.0349121094, 15.328079223633 )
 
setTimer ( movingMyGateBack, 5000, 1 )
 
end
 
addCommandHandler("openmodgate",openMyGate)
 
 
 
function movingMyGateBack ()
 
moveObject ( myGate, 4000, 1485.0126953125, -2474.8330078125, 15.328079223633 )
 
end

Posted
You forgot to replace "MyObjectID" in line 3 with the actual model id of the gate object.

hmm... i got no errors id changed but when i do the command: /openmodgate the gate does not move?

Heres the code:

function createTheGate ()
 
        myGate = createObject ( object (airportgate) (1), 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- This isnt ID
 
end
 
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate )
 
 
 
 
 
function openMyGate ( )
 
moveObject ( myGate, 3000, 1473.4616699219, -2475.0349121094, 15.328079223633 )
 
setTimer ( movingMyGateBack, 5000, 1 )
 
end
 
addCommandHandler("openmodgate",openMyGate)
 
 
 
function movingMyGateBack ()
 
moveObject ( myGate, 4000, 1485.0126953125, -2474.8330078125, 15.328079223633 )
 
end

WTF? object (airportgate) (1) this is far away from ID!

You need to put object ID into it

EXAMPLE:

<object id="object (ws_apgate) (1)" model="988" interior="0" dimension="0" posX="2304.0385742188" posY="-16.302129745483" posZ="25.484375" rotX="0" rotY="0" rotZ="90" /> -- in map file the ID is model so in this case 988 --

That is the ID!

So it should be like

myGate = createObject ( 988, 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- this is right ID
-- If i use object id 988 you can change that 988 to your own ID --

Posted
You forgot to replace "MyObjectID" in line 3 with the actual model id of the gate object.

hmm... i got no errors id changed but when i do the command: /openmodgate the gate does not move?

Heres the code:

function createTheGate ()
 
        myGate = createObject ( object (airportgate) (1), 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- This isnt ID
 
end
 
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate )
 
 
 
 
 
function openMyGate ( )
 
moveObject ( myGate, 3000, 1473.4616699219, -2475.0349121094, 15.328079223633 )
 
setTimer ( movingMyGateBack, 5000, 1 )
 
end
 
addCommandHandler("openmodgate",openMyGate)
 
 
 
function movingMyGateBack ()
 
moveObject ( myGate, 4000, 1485.0126953125, -2474.8330078125, 15.328079223633 )
 
end

WTF? object (airportgate) (1) this is far away from ID!

You need to put object ID into it

EXAMPLE:

<object id="object (ws_apgate) (1)" model="988" interior="0" dimension="0" posX="2304.0385742188" posY="-16.302129745483" posZ="25.484375" rotX="0" rotY="0" rotZ="90" /> -- in map file the ID is model so in this case 988 --

That is the ID!

So it should be like

myGate = createObject ( 988, 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- this is right ID
-- If i use object id 988 you can change that 988 to your own ID --

thankyou man im new to scripting ;)

Posted
You forgot to replace "MyObjectID" in line 3 with the actual model id of the gate object.

hmm... i got no errors id changed but when i do the command: /openmodgate the gate does not move?

Heres the code:

function createTheGate ()
 
        myGate = createObject ( object (airportgate) (1), 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- This isnt ID
 
end
 
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate )
 
 
 
 
 
function openMyGate ( )
 
moveObject ( myGate, 3000, 1473.4616699219, -2475.0349121094, 15.328079223633 )
 
setTimer ( movingMyGateBack, 5000, 1 )
 
end
 
addCommandHandler("openmodgate",openMyGate)
 
 
 
function movingMyGateBack ()
 
moveObject ( myGate, 4000, 1485.0126953125, -2474.8330078125, 15.328079223633 )
 
end

WTF? object (airportgate) (1) this is far away from ID!

You need to put object ID into it

EXAMPLE:

<object id="object (ws_apgate) (1)" model="988" interior="0" dimension="0" posX="2304.0385742188" posY="-16.302129745483" posZ="25.484375" rotX="0" rotY="0" rotZ="90" /> -- in map file the ID is model so in this case 988 --

That is the ID!

So it should be like

myGate = createObject ( 988, 1485.0126953125, -2474.8330078125, 15.328079223633 ) -- this is right ID
-- If i use object id 988 you can change that 988 to your own ID --

when i make a moving gate the rotation is the default one. you know how to fix the rotation.

Posted

when i make a moving gate the rotation is the default one. you know how to fix the rotation.

create

myGate = createObject(myID, 1485.0126953125, -2474.8330078125, 15.328079223633, 0, 0, myROTATION)

Posted

when i make a moving gate the rotation is the default one. you know how to fix the rotation.

create

myGate = createObject(myID, 1485.0126953125, -2474.8330078125, 15.328079223633, 0, 0, myROTATION)

thanks!

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...