abdalbaset Posted October 13, 2013 Posted October 13, 2013 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 )
TAPL Posted October 13, 2013 Posted October 13, 2013 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.
abdalbaset Posted October 13, 2013 Author Posted October 13, 2013 what you mean ? ihave to make table for the hospitlas position? expline more plz i dont know alot about LUA so can you make it for me?
Rockero Posted October 14, 2013 Posted October 14, 2013 Use the search, i'm sure you will find what you need here in forums...
TAPL Posted October 14, 2013 Posted October 14, 2013 This is another way to do same thing. https://forum.multitheftauto.com/viewtopic.php?f=91&t=27793
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now