Need help to my first plugin ^^
#1
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 :

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
Reply
Thanks given by:


Messages In This Thread
Need help to my first plugin ^^ - by Infinity-Codeur - 02-16-2015, 04:14 AM
RE: Need help to my first plugin ^^ - by xoft - 02-16-2015, 04:29 AM
RE: Need help to my first plugin ^^ - by NiLSPACE - 02-16-2015, 05:06 AM
RE: Need help to my first plugin ^^ - by xoft - 02-16-2015, 05:14 AM



Users browsing this thread: 2 Guest(s)