Jump to content

[HELP] Garage gate based on account name


Recommended Posts

Client;

    local gate = createObject(17951, 1556.36, -2348.79, 13.54, 0, 0, 180) 
    local marker = createMarker(1554, -2348.79, 12.54, "cylinder", 2, 255, 255, 255, 255) 
    local garage = createObject(17950, 1560.36, -2348.79, 13.54, 0, 0, 90) 
      
    function moveGate() 
         if getAccountName(getPlayerAccount(player)) == "Florjan22" then 
              moveObject(gate, 5000, 1556.36, -2348.79, 16.54) 
        end 
    end 
    addEventHandler("onMarkerHit", marker, moveGate) 
      
    function moveBack() 
         moveObject(gate, 5000, 1556.36, -2348.79, 13.54) 
    end 
    addEventHandler("onMarkerLeave", marker, moveBack) 

It doesn't move when I enter the marker :/

Link to comment
function moveGate() 
         if getAccountName(getPlayerAccount(source)) == "Florjan22" then 
              moveObject(gate, 5000, 1556.36, -2348.79, 16.54) 
        end 
    end 
    addEventHandler("onPlayerMarkerHit", marker, moveGate) 

EDIT: Changed 'onPlayerMarkerHit' so it only activates when a player enters. In your function you forgot to define 'player' in the function.

Link to comment

It does nothing :( doesn't work, I go in marker and I'm logged in and won't work.

    local gate = createObject(17951, 1556.36, -2348.79, 13.54, 0, 0, 180) 
    local marker = createMarker(1554, -2348.79, 12.54, "cylinder", 2, 255, 255, 255, 255) 
    local garage = createObject(17950, 1560.36, -2348.79, 13.54, 0, 0, 90) 
      
    function moveGate() 
         if getAccountName(getPlayerAccount(source)) == "Florjan22" then 
              moveObject(gate, 5000, 1556.36, -2348.79, 16.54) 
        end 
    end 
    addEventHandler("onPlayerMarkerHit", marker, moveGate) 
      
    function moveBack() 
         if getAccountName(getPlayerAccount(source)) == "Florjan22" then 
              moveObject(gate, 5000, 1556.36, -2348.79, 13.54) 
        end 
    end 
    addEventHandler("onPlayerMarkerHit", marker, moveBack) 

Link to comment

--serverSide ,

local gate = createObject(17951, 1556.36, -2348.79, 13.54, 0, 0, 180) 
    local marker = createMarker(1554, -2348.79, 12.54, "cylinder", 2, 255, 255, 255, 255) 
    local garage = createObject(17950, 1560.36, -2348.79, 13.54, 0, 0, 90) 
addEventHandler ( 'onMarkerHit', marker, 
function ( hitElement ) 
if ( getElementType ( hitElement ) == 'player' and not isPedInVehicle ( hitElement )) then 
if ( getAccountName(getPlayerAccount(hitElement)) == 'Florjan22') then 
    moveObject(gate, 5000, 1556.36, -2348.79, 16.54) 
       end 
  end 
end 
) 
  
addEventHandler ( 'onMarkerLeave', marker, 
function ( LeaveElement ) 
      if ( getElementType ( LeaveElement ) == 'player' and not isPedInVehicle ( LeaveElement )) then 
      if ( getAccountName(getPlayerAccount(LeaveElement)) == 'Florjan22') then 
       moveObject(gate, 5000, 1556.36, -2348.79, 13.54) 
     end 
  end 
end 
) 

Edited ,

Edited by Guest
Link to comment

It still doesn't go up, neither down. I get in the marker and nothing happens. No errors and stuff.

server:

    local gate = createObject(17951, 1556.36, -2348.79, 13.54, 0, 0, 180) 
        local marker = createMarker(1554, -2348.79, 12.54, "cylinder", 2, 255, 255, 255, 255) 
        local garage = createObject(17950, 1560.36, -2348.79, 13.54, 0, 0, 90) 
    addEventHandler ( 'onPlayerMarkerHit', marker, 
    function ( ) 
    if ( getAccountName(getPlayerAccount(source)) == 'Florjan22') then 
        moveObject(gate, 5000, 1556.36, -2348.79, 16.54) 
        end 
    end 
    ) 
      
    addEventHandler ( 'onPlayerMarkerLeave', marker, 
    function ( ) 
          if ( getAccountName(getPlayerAccount(source)) == 'Florjan22') then 
           moveObject(gate, 5000, 1556.36, -2348.79, 13.54) 
       end 
    end 
    ) 

Link to comment
It still doesn't go up, neither down. I get in the marker and nothing happens. No errors and stuff.

server:

    local gate = createObject(17951, 1556.36, -2348.79, 13.54, 0, 0, 180) 
        local marker = createMarker(1554, -2348.79, 12.54, "cylinder", 2, 255, 255, 255, 255) 
        local garage = createObject(17950, 1560.36, -2348.79, 13.54, 0, 0, 90) 
    addEventHandler ( 'onPlayerMarkerHit', marker, 
    function ( ) 
    if ( getAccountName(getPlayerAccount(source)) == 'Florjan22') then 
        moveObject(gate, 5000, 1556.36, -2348.79, 16.54) 
        end 
    end 
    ) 
      
    addEventHandler ( 'onPlayerMarkerLeave', marker, 
    function ( ) 
          if ( getAccountName(getPlayerAccount(source)) == 'Florjan22') then 
           moveObject(gate, 5000, 1556.36, -2348.79, 13.54) 
       end 
    end 
    ) 

I have Edited My Post , Copy it again ,

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