Jump to content

Edited


Shidony

Recommended Posts

1: I doubt it sets position, there's no such function: "setInPosition", it's "setElementPosition".

2: Your player argument is 'hitElement', but in "setElementFrozen" you're using "thePlayer".

3: "Unfreeze" function will never work, as you're not passing any player argument.

Link to comment

Try this, not tested.

local BankEnter = createMarker(-2455.0500,503.7387,30.0776, "corona", 1.0, 255, 255, 255, 255) 
local BankExit = createMarker(324.01458740234, 110.85294342041, 1007.9656982422, "corona", 1.0, 255, 255, 255, 255) 
local thePlayer = getLocalPlayer() 
addEventHandler("onMarkerHit", BankEnter, 
function(hitElement) 
    if (getElementType(hitElement) == "vehicle") then return end 
    setElementFrozen( thePlayer, true ) 
    setTimer( Unfreeze, 10000, 1, "Text" ) 
    outputChatBox("You enter the bank", 255, 0, 0, false) 
    setInPosition(hitElement, 325.62298583984, 114.32950592041, 1007.9656982422, 0) 
end) 
  
addEventHandler("onMarkerHit", BankExit, 
function(hitElement) 
    if (getElementType(hitElement) == "vehicle") then return end 
    setElementPosition(hitElement, -2452.828125, 504.38671875, 30.081373214722, 0) 
end) 
  
function Unfreeze() 
    setElementFrozen( thePlayer, false ) 
end 

EDIT: If it's a client script, you will need to remove "local thePlayer = getLocalPlayer()" and add "thePlayer" into the correct areas.

Link to comment

I change my script to:

local BankEnter = createMarker(-2455.0500,503.7387,30.0776, "corona", 1.0, 255, 255, 255, 255) 
local BankExit = createMarker(324.01458740234, 110.85294342041, 1007.9656982422, "corona", 1.0, 255, 255, 255, 255) 
      
addEventHandler("onMarkerHit", BankEnter, 
function(hitElement) 
    if (getElementType(hitElement) == "vehicle") then return end 
    setElementFrozen ( hitElement, true ) 
    setTimer( Unfreeze, 10000, 1, "Text" ) 
    outputChatBox("You enter the bank", 255, 0, 0, false) 
    setInPosition(hitElement, 325.62298583984, 114.32950592041, 1007.9656982422, 0) 
end) 
      
addEventHandler("onMarkerHit", BankExit, 
function(hitElement) 
    if (getElementType(hitElement) == "vehicle") then return end 
    setInPosition(hitElement, -2452.828125, 504.38671875, 30.081373214722, 0) 
end) 
      
function Unfreeze() 
    setElementFrozen ( sourcePlayer, false ) 
end 
      

And i repeat that the problem is the freeze :) the setInPosition is working.

Link to comment
local BankEnter = createMarker(-2455.0500,503.7387,30.0776, "corona", 1.0, 255, 255, 255, 255) 
local BankExit = createMarker(324.01458740234, 110.85294342041, 1007.9656982422, "corona", 1.0, 255, 255, 255, 255) 
      
addEventHandler("onMarkerHit", BankEnter, 
function(hitElement) 
    if (getElementType(hitElement) == "vehicle") then return end 
    setElementFrozen ( hitElement, true ) 
    setTimer( Unfreeze, 10000, 1, hitElement ) 
    outputChatBox("You enter the bank", 255, 0, 0, false) 
    setElementPosition(hitElement, 325.62298583984, 114.32950592041, 1007.9656982422, 0) 
     --or YOur function setInPosition 
end) 
      
addEventHandler("onMarkerHit", BankExit, 
function(hitElement) 
    if (getElementType(hitElement) == "vehicle") then return end 
    setElementPosition(hitElement, -2452.828125, 504.38671875, 30.081373214722, 0) 
    --or YOur function setInPosition 
end) 
      
function Unfreeze(thePlayer) 
    setElementFrozen ( thePlayer, false ) 
end 
      

Your errors is:

1: I doubt it sets position, there's no such function: "setInPosition", it's "setElementPosition".

2: Your player argument is 'hitElement', but in "setElementFrozen" you're using "thePlayer".

3: "Unfreeze" function will never work, as you're not passing any player argument.

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