Hello everyone,
I try to create my first plugin for McServer :p
My project add 2 comands "/getposition" ant "getTp"
/getposition save the x,y,z position of player
/getTp teleport to x,y,z position that have been saved by /getposition
This is my code :
But i have this error when i execute /getposition :
What is the problem with my code ? ^^
Thank in advance
I try to create my first plugin for McServer :p
My project add 2 comands "/getposition" ant "getTp"
/getposition save the x,y,z position of player
/getTp teleport to x,y,z position that have been saved by /getposition
This is my code :
PlayerPos = {} function Initialize(Plugin) PLUGIN = Plugin Plugin:SetName("Position") Plugin:SetVersion(1) --Command cPluginManager.BindCommand("/getposition", "permissionnode", GetPos, " - Get your position") cPluginManager.BindCommand("/getTp", "permissionnode", GetTp, " - Tp to position") LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) return true end function GetPos(Player) PlayerPos = Vector3d(Player:GetPosX(), Player:GetPosY(), Player:GetPosZ()) Player:SendMessage("Position Register") end function GetTp(Player) Player:TeleportToCoords(PlayerPos.x, PlayerPos.y, PlayerPos.z) Player:SendMessage("You have tp into you old position") end
But i have this error when i execute /getposition :
Code:
[19:10:05] LUA: Plugins/Position/Position.lua:14: attempt to call method 'GetPosX' (a nil value)
[19:10:05] Stack trace:
[19:10:05] Plugins/Position/Position.lua(14): (no name)
[19:10:05] Stack trace end
[19:10:05] Error in plugin Position calling function <callback>()
What is the problem with my code ? ^^
Thank in advance