Jump to content

Spawnpoints


Overkillz

Recommended Posts

Hey dear guys, Im trying to create a change spawn point.

Well, some maps from race gamemode has more than 1 spawn, then Im trying to do that when the player press f1 move him to another one. Well, i started the code first outputting X, Y, Z, well, as it didnt work i came here to request what could be the problem.

function nombreas() 
    local aSpawnPoints = getElementsByType( "spawnpoint" ) 
      
    for i, pSpawnPoint in ipairs( aSpawnPoints ) do 
        local fX, fY, fZ = tonumber( getElementData( pSpawnPoint, "posX" ) ), tonumber( getElementData( pSpawnPoint, "posY" ) ), tonumber( getElementData( pSpawnPoint, "posZ" ) ) 
        local spawnX = math.random( 1, #fX ) 
        local spawnY = math.random( 1, #fY ) 
        local spawnZ = math.random( 1, #fZ ) 
        outputChatBox("Spawn X"..spawnX) 
        outputChatBox("Spawn Y"..spawnY) 
        outputChatBox("Spawn Z"..spawnZ) 
    end 
end 
bindKey ( "F1", "down", nombreas ) 

Thanks for your time.

Link to comment

I did a script similar to this..

local posicoes = 
    { 
        { 816.59997558594, -7209.2998046875, 32.799999237061 }, 
        { 707.20001220703, -7272.6000976563, 32.700000762939 }, 
        { 710.5, -7412.8999023438, 32.799999237061 }, 
        { 798.70001220703, -7654, 32.5 }, 
        { 816.09997558594, -7471.3999023438, 30 }, 
        { 812.40002441406, -7321.6000976563, 32.799999237061 }, 
    } 
     
function PosicaoPlayer ( thePlayer, command ) 
    local azar = math.random ( #posicoes ) 
    local veh = getPedOccupiedVehicle(thePlayer) 
        if (veh) then 
            setElementPosition(veh, unpack ( posicoes [ azar ] ) ) 
        else 
            setElementPosition(thePlayer, unpack ( posicoes [ azar ] ) ) 
        end  
            outputChatBox ( "#FFFFFF[#00FF00Tele#FFFFFF] ".. getPlayerName(thePlayer) .." #FFFFFFFoi para a pista SpeedWay fazer drift! (#00FF00/drift#FFFFFF)", root, 0, 255, 0, true ) 
end 
addCommandHandler ( "drift", PosicaoPlayer  ) 

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