VoidGenerator (obsolete)
#8
Before player spawn you must:
1. Get SpawnX
2. Get SpawnZ
3. Load chunk.
4. Detect (get) free height (SpawnY) bloks for spawn player.
5. Teleport player to SpawnX, SpawnY, SpawnZ.
Sample code:

-- ...
    -- Get world default spawn point
    local world = cRoot:Get():GetWorld("world2");
    local SpawnX = world:GetSpawnX();
    local SpawnZ = world:GetSpawnZ();

    -- Get player last bed position
    local PlayerX = (-8);
    local PlayerZ = 3;

    local OnAllChunksAvailable = function()
      console_log(func_name .." -> chunks redy for player ID ".. a_player:GetUniqueID(), 1);
      a_player:MoveToWorld("world2");
      local ret1, SpawnY = obj_world:TryGetHeight(SpawnX, SpawnZ);
      a_player:TeleportToCoords(SpawnX, SpawnY , SpawnZ);
      a_player:SetGameMode(1);
    end

    world:ChunkStay({{PlayerX, PlayerZ}, {SpawnX, SpawnZ}}, OnChunkAvailable, OnAllChunksAvailable);

-- ...
Reply
Thanks given by:


Messages In This Thread
VoidGenerator (obsolete) - by DiamondToaster - 04-11-2015, 10:56 AM
RE: VoidGenerator - by Aberts10 - 09-18-2015, 08:11 AM
RE: VoidGenerator - by DiamondToaster - 09-18-2015, 09:10 AM
RE: VoidGenerator - by NiLSPACE - 09-23-2015, 09:45 PM
RE: VoidGenerator - by DiamondToaster - 09-24-2015, 05:54 AM
RE: VoidGenerator - by Seadragon91 - 09-24-2015, 05:58 AM
RE: VoidGenerator - by xoft - 09-24-2015, 06:24 AM
RE: VoidGenerator - by DrMasik - 09-24-2015, 08:47 AM



Users browsing this thread: 1 Guest(s)