Jump to content

setElementPosition problem


Overkillz

Recommended Posts

Hey guys, I cant stand "for" at scripting due to I cant controll it.

Well, my point is trying to change the position of the player where he spawned increasing the spawn point +1

function nombreas() 
    local aSpawnPoints = getElementsByType( "spawnpoint" ) 
      
    for i, pSpawnPoint in ipairs( aSpawnPoints ) do 
        local fX, fY, fZ, RX, RY,RZ = tonumber( getElementData( pSpawnPoint, "posX" ) ), tonumber( getElementData( pSpawnPoint, "posY" ) ), tonumber( getElementData( pSpawnPoint, "posZ" ) ) 
        local vehicle = getPedOccupiedVehicle(localPlayer) 
        if vehicle then 
            setElementPosition( vehicle, fX,fY,fZ ) 
            outputChatBox("You changed spawn point",255,255,255,true) 
        else 
            outputChatBox("You are not alive",255,255,255,true) 
        end 
         
    end 
     
end 
bindKey ( "2", "down", nombreas ) 

I tried adding to fX,fY,fZ +1 but it didnt work too.

I hope u can help me, thanks for your time

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