deletedacc Posted March 15, 2020 Share Posted March 15, 2020 Hi I created a map with the MTA editor map. And now I have the map file with no changes. I want to upload the map player after he logs in and the player where I want to be spawned. Summary of Questions: First question: How do I load the map for the player after login? second Question: How do I determine the player's spawn location? Link to comment
Addlibs Posted March 16, 2020 Share Posted March 16, 2020 (edited) 18 hours ago, DANFOR said: How do I determine the player's spawn location? This is a question for you. How do you want to the spawn location chosen? At random? If so, you'll want to use math.random between 1 and the number of spawn points you have, and then take the coordinates for that index. E.g. local spawns = { {x1, y1, z1}, {x2, y2, z2}, ... } -- later in the code when you're actually spawning local spawnIndex = math.random(1, #spawns) -- select a random index between 1 and number of spawns local spawnX, spawnY, spawnZ = spawns[spawnIndex][1], spawns[spawnIndex][2], spawns[spawnIndex][3] -- collect it's first, second and third parameters (x, y and z position) Edited March 16, 2020 by MrTasty Link to comment
deletedacc Posted March 16, 2020 Author Share Posted March 16, 2020 3 hours ago, MrTasty said: This is a question for you. How do you want to the spawn location chosen? At random? If so, you'll want to use math.random between 1 and the number of spawn points you have, and then take the coordinates for that index. E.g. i inserted that the code you say to me but when i go to my server i'm see a black/blank page . what i can do ? i just want say : when player join load the map and spawn the player in the map . please help me thanks Link to comment
iwalidza Posted March 16, 2020 Share Posted March 16, 2020 addEventHandler("onPlayerJoin",root, function() spawnPlayer(source,0,0,10) end ) Quote second Question: How do I determine the player's spawn location? 1 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