Teleport to Spawn if lastBed doesnt exist
#7
(05-14-2017, 04:22 AM)Seadragon91 Wrote: Do you want to read the spawn position from the world ini?
If yes you could directly use the functions: GetSpawnX, GetSpawnY and GetSpawnZ from cWorld.

if not about world spawn.The error means that WorldIni is not initialized. Post the code where you are initializing WorldIni.

Edit: Ah sorry didn't saw the whole code in first post, will look at it.

Server Start Log

Code:
[20:41:41] --- Started Log ---
[20:41:41] Cuberite Jenkins clang x64 Release (master) build id: #578
[20:41:41] from commit id: c83b051c1a3e68fc9315ffffb277dc3da86cf02a built at: Thu  8 Sep 21:30:46 UTC 2016
[20:41:41] Creating new server instance...
[20:41:41] Reading server config...
[20:41:41] Starting server...
[20:41:41] Compatible clients: 1.8.x, 1.9.x, 1.10.x
[20:41:41] Compatible protocol versions 47, 107, 108, 109, 110, 210
[20:41:41] WebServer: The server will run in unsecured HTTP mode.
[20:41:41] Put a valid HTTPS certificate in file 'webadmin/httpscert.crt' and its corresponding private key to 'webadmin/httpskey.pem' (without any password) to enable HTTPS support
[20:41:41] Loaded 465 crafting recipes
[20:41:41] Loaded 22 furnace recipes and 56 fuels
[20:41:41] Loaded 88 brewing recipes
[20:41:41] -- Loading Plugins --
[20:41:41] Initialised Core v.15
[20:41:41] Initialized TransAPI v.1
[20:41:41] Initialized ChatLog v.3
[20:41:41] Initialised Test1 v.1
[20:41:41] -- Loaded 4 Plugins --
[20:41:42] Did not find an acceptable spawnpoint. Generated a random spawnpoint position at {0.00, 168.00, 0.00}
[20:41:42] WebAdmin is running on port(s) 8080
[20:41:42] Startup complete, took 1662ms!


Code with GetSpawn


PHP Code:
local SpawnX world:GetSpawnX()
local SpawnY world:GetSpawnY()
local SpawnZ world:GetSpawnZ()
Player.TeleportToCoords(SpawnXSpawnYSpawnZ

Error with GetSpawn

Code:
[20:39:31] WorldSpawnX:-2.1523170155827 WorldSpawnY:65 WorldSpawnZ:-32.89404058136
[20:39:31] LUA: Plugins/Test1/main.lua:37: error in function 'TeleportToCoords'.
    argument #1 is 'number'; 'cEntity' expected.

[20:39:31] Stack trace:
[20:39:31]   [C](-1): TeleportToCoords
[20:39:31]   Plugins/Test1/main.lua(37): (no name)
[20:39:31] Stack trace end
[20:39:31] Error in <attached> calling function <callback>()


What i can do? Huh
Reply
Thanks given by:


Messages In This Thread
RE: Teleport to Spawn if lastBed doesnt exist - by moiko89 - 05-14-2017, 04:41 AM



Users browsing this thread: 2 Guest(s)