Jump to content

onMarkerHit Problem


fem_luna

Recommended Posts

Hello MTA Community,

i have a Problem with onMarkerHit

Here the code:

 

AdminbaseAllowedNames={
["Lorenzo"]=true,}

GoInAdminbaseMarker=createMarker(-2039.7,216.6,34.8,"cylinder",2,255,125,0,140)

function TeleportInAdminbase_Func(player)
    if AdminbaseAllowedNames[getPlayerName(player)]then
        if isElementWithinMarker(player,GoInAdminbaseMarker)then
            if getPedOccupiedVehicle(player)==true then
                setElementFrozen(player,true)
                setTimer(setElementFrozen,200,1,player,false)
                setElementPosition(player,-2023.3,295.7,895)
            else
                setElementPosition(player,-2023.3,295.7,894.6)
            end
        end
    else
        outputChatBox("You dont have permissions!",player,255,0,0)
    end
end
addEventHandler("onMarkerHit",GoInAdminbaseMarker,TeleportInAdminbase_Func)

if a player in vehicle then a problem with: if AdminbaseAllowedNames[getPlayerName(player)]then

Link to comment
 AdminbaseAllowedNames={["Lorenzo"]=true}

GoInAdminbaseMarker=createMarker(-2039.7,216.6,34.8,"cylinder",2,255,125,0,140)

function TeleportInAdminbase_Func(element)
    if (getElementType(element) == "player" or getElementType(element) == "vehicle") then
        local player = getElementType(element) == "player" and element or getVehicleController(element);

        if (player and AdminbaseAllowedNames[getPlayerName(player)]) then
            if isElementWithinMarker(player,GoInAdminbaseMarker)then
                if getPedOccupiedVehicle(player)==true then
                    setElementFrozen(player,true)
                    setTimer(setElementFrozen,200,1,player,false)
                    setElementPosition(player,-2023.3,295.7,895)
                else
                    setElementPosition(player,-2023.3,295.7,894.6)
                end
            end
        else
            outputChatBox("You dont have permissions!",player,255,0,0)
        end
    end
end
addEventHandler("onMarkerHit",GoInAdminbaseMarker,TeleportInAdminbase_Func) 

 

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