Jump to content

if check dont work


mjau

Recommended Posts

Posted

hi i have a problem with my code it should not warp the player if he is in a vehicle but it does anyway

heres my code

function warpPlayerIntoAndro(hitElement, dimensionMatch) 
    outputDebugString("Warp function triggered") 
    if not dimensionMatch then return end    
    if getElementType(hitElement) == "vehicle" then  
    cancelEvent() 
    else 
    setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11 ) 
    end 
    end 

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted
function warpPlayerIntoAndro(hitElement, dimensionMatch) 
    outputDebugString("Warp function triggered")  
    if getElementType(hitElement) == "player" then 
    setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11 ) 
    end 
end 

No need for all this, try that.

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted

still warps me to nowhere when im in a vehicle and tirgger that function

Edit with nowhere i mean everything disappears

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted
function warpPlayerIntoAndro(hitElement, dimensionMatch) 
    outputDebugString("Warp function triggered") 
    if isPedInVehicle(hitElement) then return end 
    setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11 ) 
end 

Try that.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

kk ehh now it says an error about bad ped pointer and instead of putting me in nowhere it puts me VERY high p in the air and drops me down

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted
function warpPlayerIntoAndro(hitElement, dimensionMatch) 
    outputDebugString("Warp function triggered") 
    if getElementType( hitElement ) ~= "player" then return end 
    if isPedInVehicle(hitElement) then return end 
    setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11 ) 
end 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted

That's not possible, /debugscript works when in vehicle or when on foot.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
xD the debugstring i added in the script it should out put warp function activated but it only does that when im in a vehicle
n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted

since this is goin to be release on community ill upload the whole code

function createAndroMarker(thePlayer) 
vehicle = getPedOccupiedVehicle(thePlayer) 
x,y,z = getElementPosition( vehicle ) 
theMarker = createMarker ( x, y + 5, z - 2, "cylinder", 20.5, 0, 0, 255, 170 ) 
setTimer ( removeMarker, 7000, 1 ) 
addEventHandler( "onMarkerHit", theMarker, warpPlayerIntoAndro ) 
end 
addCommandHandler("marker", createAndroMarker) 
  
function warpPlayerIntoAndro(hitElement, dimensionMatch) 
    outputDebugString("Warp function triggered") 
    if getElementType(hitElement) ~= "player" then return end 
    if isPedInVehicle(hitElement) then return end 
    setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11 ) 
end 
  
function removeMarker() 
destroyElement ( theMarker ) 
end 

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted
function createAndroMarker(thePlayer) 
vehicle = getPedOccupiedVehicle(thePlayer) 
x,y,z = getElementPosition( vehicle ) 
theMarker = createMarker ( x, y + 5, z, "cylinder", 20.5, 0, 0, 255, 170 ) 
setTimer ( removeMarker, 7000, 1 ) 
addEventHandler( "onMarkerHit", theMarker, warpPlayerIntoAndro ) 
end 
addCommandHandler("marker", createAndroMarker) 
  
function warpPlayerIntoAndro(hitElement, dimensionMatch) 
    outputDebugString("Warp function triggered") 
    if getElementType(hitElement) ~= "player" then return end 
    if isPedInVehicle(hitElement) then removePedFromVehicle(hitElement) end 
    setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11 ) 
end 
  
function removeMarker() 
destroyElement ( theMarker ) 
end 

Try that.

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

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