xeon17 Posted February 15, 2014 Share Posted February 15, 2014 Hello , how can i spawn player when he die on 3 place's. When he die it should spawn him on some of the spawnpoints from the table. local mySpawnTable = { {331.06286621094, 1855.9083251953, 7.828125}, {216.45199584961, 1822.6893310547, 6.4140625}, {211.66558837891, 1810.6231689453, 21.8671875} } function makePlayerSpawn (player) local spawnPoint = mySpawnTable[math.random(#mySpawnTable)] -- random spawnpoint spawnPlayer(player,spawnPoint[1],spawnPoint[2],spawnPoint[3]) end But how ? Link to comment
cheez3d Posted February 15, 2014 Share Posted February 15, 2014 local spawnLocations = { {331.06286621094,1855.9083251953,7.828125}, {216.45199584961,1822.6893310547,6.4140625}, {211.66558837891,1810.6231689453,21.8671875} } local respawnPlayer = function() local chosenSpawnLocation = math.random(1,#spawnLocations) spawnPlayer(source,spawnLocations[chosenSpawnLocation][1],spawnLocations[chosenSpawnLocation][2],spawnLocations[chosenSpawnLocation][3]) end addEventHandler("onPedWasted",root,respawnPlayer) Link to comment
xeon17 Posted February 15, 2014 Author Share Posted February 15, 2014 No work , nothing in debug Link to comment
Smart. Posted February 15, 2014 Share Posted February 15, 2014 https://wiki.multitheftauto.com/wiki/OnPedWasted is only triggered when a ped die, I think you want https://wiki.multitheftauto.com/wiki/OnPlayerWasted local spawnLocations = { {331.06286621094,1855.9083251953,7.828125}, {216.45199584961,1822.6893310547,6.4140625}, {211.66558837891,1810.6231689453,21.8671875} } local respawnPlayer = function() local chosenSpawnLocation = math.random(1,#spawnLocations) spawnPlayer(source,spawnLocations[chosenSpawnLocation][1],spawnLocations[chosenSpawnLocation][2],spawnLocations[chosenSpawnLocation][3]) end addEventHandler("onPlayerWasted",root,respawnPlayer) Link to comment
xeon17 Posted February 15, 2014 Author Share Posted February 15, 2014 Hm , its work but i have a problem it spawn me frist on some of the place's from the table , and after on a spawnpoint from play resource or map resource . Please help , i tryed to set off the play resource but no worked Link to comment
xeon17 Posted February 15, 2014 Author Share Posted February 15, 2014 FORGOT WHAT I SAID , I FIXED THE PROBLEM AND NOW WORKING GREAT ! THANKS GUYS <3 Link to comment
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