Solved Teleport not work, called from mysql

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

jomjonejame

Member
Jan 26, 2017
54
1
8
29
:emoji_pray: It does not teleport player, Help me plz :emoji_pray:

Database
Captureaaaaaaaaaaaaaaa.PNG


Teleport Player ( Problem )
code_language.skript:
set {_GuildID::*} to objects in column "guild_id" from result of query "SELECT * FROM `guild_players` WHERE `username` = '%player%'"
set {_Location::*} to objects in column "location" from result of query "SELECT * FROM `guild` WHERE `id` = '%{_GuildID::*}%'"
set {_loc} to "%{_Location::*}%"

teleport the player to {_loc}
message "{@prefix} &bTeleport Player to Guild Home"


SetHome ( not problem )
code_language.skript:
set {_loc} to "%location of player%"
set {_GuildID::*} to objects in column "guild_id" from result of query "SELECT * FROM `guild_players` WHERE `username` = '%player%'"
update "UPDATE `guild` SET `location` = '%{_loc}%' WHERE `id` = '%{_GuildID::*}%'"
message "{@prefix} &bSetHome"
 
You need to parse that data into a location back again, here are two examples:

code_language.skript:
set {_result} to result of query "SELECT `x`, `y`, `z`, `world` FROM `locations` WHERE `user`='Abwasserrohr' " and close

set {_x} to the first element out of objects in column "x" from {_result}
set {_x} to {_x} parsed as number
set {_y} to the first element out of objects in column "y" from {_result}
set {_y} to {_y} parsed as number
set {_z} to the first element out of objects in column "z" from {_result}
set {_z} to {_z} parsed as number
set {_world} to the first element out of objects in column "world" from {_result}

set {_location} to location at {_x}, {_y}, {_z} in "%{_world}%" parsed as world

teleport player to {_location}

or smaller, that could work too:

"x, y, z in world"
code_language.skript:
set {_loc} to "0, 0, 0 in myworld"
set {_location} to "%location at %{_loc}%%" parsed as world
 
Last edited by a moderator:
Status
Not open for further replies.