Jump to content

gate help


Nexsus12

Recommended Posts

i need help with this how can i make when im near the doors to open it automactly and how to make it just for one user heres my code

gate = createObject (3095,941.900390625,1689.400390625,19.299999237061,270,0,0) 
                    
function OpenGates (thePlayer) 
    moveObject (gate1,3000,941.90002441406,1689.4000244141,27.700000762939) 
    end 
    addCommandHandler( "open",OpenGates ) 
              
function CloseGates (thePlayer) 
    moveObject (gate1,3000,941.900390625,1689.400390625,19.299999237061) 
    end 
addCommandHandler("close",CloseGates) 

Link to comment
i need help with this how can i make when im near the doors to open it automactly and how to make it just for one user heres my code

You need to use colshapes to detect when you're near. As to activating it for specific user only, it depends on the type of that user.

Link to comment

I can't place the colshape for you because I don't know where are those coordinates you provided in here. I see only the numbers. You need to do it for yourself from the game. I can only hint you what functions you should use.

https://wiki.multitheftauto.com/wiki/Client_Scripting_Functions#Collision_shape_functions - create a collision shape with one of these. I suggest you to use rectangle.

https://wiki.multitheftauto.com/wiki/Client_Scripting_Events#Colshape_events - these event can help you to check when your player is near the gate. Good luck.

Link to comment

if you want ACL , Here is a code. it uses markerhit functions. make sure to change coordinates and the ACL Name and make sure to move your self to the ACL That you have put. and make sure gate coordinates is the same with marker coordinates.

local gate = createObject(985, 263.9, -1333.5, 53.251480102539, 0, 0, 35) 
local marker = createMarker(264.177734375, -1333.2490234375, 53.251480102539, "cylinder", 8, 0, 0, 0, 0) 
  
function moveGate(psource) 
     local Nexususergroup = getAccountName(getPlayerAccount(psource)) 
     if isObjectInACLGroup("user."..Nexususergroup, aclGetGroup("Nexus")) then 
          moveObject(gate, 1000, 263.9, -1333.5, 46) 
     end 
end 
addEventHandler("onMarkerHit", marker, moveGate) 
  
function move_back_gate() 
     moveObject(gate, 1000, 263.9, -1333.5, 53.251480102539) 
end 
addEventHandler("onMarkerLeave", marker, move_back_gate) 
  

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