Jump to content

need help here !!!


abdalbaset

Recommended Posts

how i can make this script spawn the player in the close hosptel?

addEventHandler("onResourceStart", resourceRoot, 
    function() 
        for i,player in ipairs(getElementsByType("player")) do 
            spawn(player) 
        end 
    end 
) 
  
function spawn(player) 
    repeat until spawnPlayer ( player, 1186.4000244141, -1325.0999755859, 13.199999809265, 90, math.random(19,25) ) 
     
    fadeCamera(player, true) 
    setCameraTarget(player, player) 
    setPlayerTeam (player, nil) 
end 
  
function spawnWasted(player) 
    repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 0, math.random(19,25)) 
  
    fadeCamera(player, true) 
    setCameraTarget(player, player) 
    setPlayerTeam (player, nil) 
    takePlayerMoney ( player, 150 ) 
end 
  
addEventHandler("onPlayerLogin", root, 
    function() 
        spawn(source) 
    end 
) 
  
addEventHandler("onPlayerWasted", root, 
    function() 
        setTimer(spawnWasted, 1800, 1, source) 
    end 
) 

Link to comment
getDistanceBetweenPoints2D 

You need to have all hospitals position in a table. Then loop through the table and insert the distance between you and the hospital in another table and use table.sort to sort the distances in the table from smaller to bigger.

The first row in the sorted table will be the closest.

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