Jump to content

Map and spawn players


deletedacc

Recommended Posts

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
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 by MrTasty
Link to comment
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

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