Jump to content

O.o Please help


Shux

Recommended Posts

So i have this code, and the problem is, the gate doesn't open when the player hits it , can someone help please?

local EPAGate = createObject(980, 1024.0999755859, -368.60000610352, 75.699996948242, 0, 0, 358.73950195313) 
local EPAMark = createMarker( 1023.9000244141, -367.70001220703, 73.699996948242, "corona", 5, 255, 255, 255, 255 ) 
  
addEventHandler ("onClientMarkerHit", EPAMark, 
function(hitPlayer, matchingDimension) 
if isElementWithinMarker(hitPlayer, EPAMark) and getTeamName(getPlayerTeam(hitPlayer) == "Elite Police Academy" )  then 
moveObject ( EPAGate, 2000, 1024.0999755859, -368.60000610352, 81.099998474121, 0, 0, 358.73950195313) 
end 
end) 
  
addEventHandler ("onClientMarkerLeave", EPAMark, 
function(hitPlayer, matchingDimension) 
if getTeamName(getPlayerTeam(hitPlayer) == "Elite Police Academy" ) then 
moveObject ( EPAGate, 2000, 1024.0999755859, -368.60000610352, 75.699996948242, 0, 0, 358.73950195313) 
end 
end) 

Link to comment
  • Other Languages Moderators

I don't see a reason to put it client side. Moreover desync may occur.

Try:

Server Side:

local EPAGate = createObject(980, 1024.0999755859, -368.60000610352, 75.699996948242, 0, 0, 358.73950195313) 
local EPAMark = createMarker(1023.9000244141, -367.70001220703, 73.699996948242, "corona", 5, 255, 255, 255, 255) 
  
addEventHandler("onMarkerHit", EPAMark, 
function(hitPlayer) 
    if getElementType(hitPlayer) == "player" then 
        local team = getPlayerTeam(hitPlayer) 
        if (team and getTeamName(team) == "Elite Police Academy")  then 
            moveObject(EPAGate, 2000, 1024.0999755859, -368.60000610352, 81.099998474121, 0, 0, 358.73950195313) 
        end 
    end 
end) 
  
addEventHandler("onMarkerLeave", EPAMark, 
function(hitPlayer) 
    if getElementType(hitPlayer) == "player" then 
        local team = getPlayerTeam(hitPlayer) 
        if (team and getTeamName(team) == "Elite Police Academy")  then 
            moveObject(EPAGate, 2000, 1024.0999755859, -368.60000610352, 75.699996948242, 0, 0, 358.73950195313) 
        end 
    end 
end) 

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