11-29-2015, 07:58 PM
(This post was last modified: 11-29-2015, 08:15 PM by DaPorkchop.)
Now getting constant errors which say nothing more than "Something went wrong while executing command "/serverchange"". Added some random messages, they show up, but the error remains and I don't get teleported or even kicked off the server.
EDIT: my test server (www.daporkchop.tk) has the plugin installed, /serverchange is enabled by default
PHP Code:
function Initialize(Plugin)
Plugin:SetName("BungeeTest")
Plugin:SetVersion(1)
-- Hooks
PLUGIN = Plugin -- NOTE: only needed if you want OnDisable() to use GetName() or something like that
-- Command Bindings
cPluginManager.BindCommand("/serverchange", "test.node", ServerChange, " - Description of command")
LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
return true
end
function StringLenToASCII(Player,a_String)
local StringLen = tostring(string.len(a_String));
local t = {
["1"] = "\0\1",
["2"] = "\0\2",
["3"] = "\0\3",
["4"] = "\0\4",
["5"] = "\0\5",
["6"] = "\0\6",
["7"] = "\0\7",
["8"] = "\0\8",
["9"] = "\0\9",
["10"] = "\0\10",
["11"] = "\0\11",
["12"] = "\0\12",
["13"] = "\0\13",
["14"] = "\0\14",
["15"] = "\0\15",
["16"] = "\0\16",
["17"] = "\0\17",
["18"] = "\0\18",
["19"] = "\0\19",
["20"] = "\0\20",
["21"] = "\0\21",
["22"] = "\0\22",
["23"] = "\0\23",
["24"] = "\0\24",
["25"] = "\0\25",
["26"] = "\0\26",
["27"] = "\0\27",
["28"] = "\0\28",
["29"] = "\0\29",
["30"] = "\0\30",
}
if(t[StringLen] == Nil) then
LOG("The server name is incompatible with this plugin! Please make sure it is 30 characters or less!");
Player:SendMessageFailure("The server name is incompatible with this plugin! Please make sure it is 30 characters or less!");
return false
else
return t[StringLen]
end
end
function ServerChange(a_Script,a_Player)
local server = "www.daporkchop.tk";
a_Player:SendMessageInfo("Will it work?")
a_Player:GetClientHandle():SendPluginMessage("BungeeCord", "\0\7Connect" .. StringLenToASCII(a_Player,server) .. server);
a_Player:SendMessageInfo("I'm not sure.")
end
function OnDisable()
LOG(PLUGIN:GetName() .. " is shutting down...")
end
EDIT: my test server (www.daporkchop.tk) has the plugin installed, /serverchange is enabled by default