Chaoss
The real MVP
Scripted gates are a perk that we offer to players that show support to MTA:RP through donation. Therefore we charge VIP Points for gates to be added to the server.
Our current gate scripter is MTA | Legend(dsmoked), as you can see these requests are not being completed in a timely matter. On behalf of the staff here at MTA:RP we apologize for any inconvenience this may have caused you. We want all of our players to get the quality service that they so deserve, which is why I will be looking for another person that has knowledge on gate scripting.
Don't know how to script gates? I have included a lua file that has details on how to make them. You simply need to fill in the blanks for the gates.
This is a example from a gate on Richmond. Everything with "--" is commented out and there to help you understand how it works.
If you are interested in helping out with gates you can send me a PM here on the forums. But make sure you know what you are doing before talking to me about it. Test your scripts locally first!
I don't have time to go through all the gate requests myself, so that's why I am spending the time to help you understand how they are done. If you have questions you can reply below and I will get to answering them. Chances are, someone else has the same question to ask.
Thanks for reading.
Our current gate scripter is MTA | Legend(dsmoked), as you can see these requests are not being completed in a timely matter. On behalf of the staff here at MTA:RP we apologize for any inconvenience this may have caused you. We want all of our players to get the quality service that they so deserve, which is why I will be looking for another person that has knowledge on gate scripting.
Don't know how to script gates? I have included a lua file that has details on how to make them. You simply need to fill in the blanks for the gates.
This is a example from a gate on Richmond. Everything with "--" is commented out and there to help you understand how it works.
Code:
local objectID = 980 --Place the object ID here
local originalX,originalY,originalZ = 282.39999389648,-1319.9000244141,55.639999389648 --Place the coords of the gate here
local rotationX,rotationY,rotationZ = 0,358.70007324219,34.5 --Place the rotations of the gate here
local moveX,moveY,moveZ = 282.39999389648,-1319.9000244141,50 --Place the coords to move the gate to here
local moveRotX,moveRotY,moveRotZ = 0,0,0 --Place the rotations for the gate here (if you do not want it to rotate, put: 0,0,0)
local keyID = 576 --Put the ID of the house here! Note: This only works for houses, not for bussinesses
local timeToMoveGate = 2000 --Put the time it takes to open/close the gate here (in milliseconds)
local timeToStayOpen = 4000 --Put the time that the gate stays open until it closes (in milliseconds)
local command = "gate" --Put the command name you want to use here
local distanceFromGate = 25 --Put the minimal distance from the gate to open it here
--#######################################################
--#### DO NOT EDIT ANYTHING BELOW HERE ####
--#######################################################
local gateState = false --Leave this at false, you don't need to edit this
thisGate = createObject(objectID,originalX,originalY,originalZ,rotationX,rotationY,rotationZ) --Creates the object and names it 'thisGate'
exports.pool:allocateElement(thisGate) --Let's just leave this here, okay?
local function resetGateState() --Function to reset the state of the gate
gateState = false --Sets the gate state to closed
end
local function closeThisGate() --Function to close the gate
moveObject(thisGate,timeToMoveGate,originalX,originalY,originalZ,0 - moveRotX,0 - moveRotY,0 - moveRotZ) --Moves the gate back to the original position
setTimer(resetGateState,timeToStayOpen,timeToMoveGate) --Resets the state of the gate after the gate has moved back to it's original position
end
local function useGate(thePlayer, commandName) --Function that triggers the gate
local posX,posY,posZ = getElementPosition(thePlayer) --Gets the position of the gate
local distance = getDistanceBetweenPoints3D(originalX,originalY,originalZ,posX,posY,posZ) --Gets the distance between the player and the original position of the gate
if(distance <= distanceFromGate and gateState == false and exports.global:hasItem(thePlayer, 4, keyID)) then --Checks if the player is near enough and if the gate is not open/opening/closing
gateState = false --Sets the gate to open/opening/closing
moveObject(thisGate,timeToMoveGate,moveX,moveY,moveZ,moveRotX,moveRotY,moveRotZ) --Moves the object to the location that is wanted
setTimer(closeThisGate,timeToMoveGate + timeToStayOpen,1) --Sets the times to close the gate again
end
end
addCommandHandler(command, useGate)
If you are interested in helping out with gates you can send me a PM here on the forums. But make sure you know what you are doing before talking to me about it. Test your scripts locally first!
I don't have time to go through all the gate requests myself, so that's why I am spending the time to help you understand how they are done. If you have questions you can reply below and I will get to answering them. Chances are, someone else has the same question to ask.
Thanks for reading.