Getting the thing in there in the way I put in my previous post... yeah that doesn't work. Figured out it was because those are ascii encoded characters.... I think. That's my best guess. So I went and reworked the code and made a "switch statement". New relevant code:
It works! This means I'm limiting a servers name in bungeecord to at most 30 characters, but 1) not many people would find a problem with that and 2) at a simple request, I can increase that to w/e number is needed relatively easily.
I did it with string.len instead of just indexes because I forgot about indexes and coded it that way. Hehe...
By the way, if I understand this right, that means that the second part is literally {NULL} {Start Of Heading} {Connect} {NULL} {Enquiry for 5, Shift out for 14} {Server name} which I find really funny if that's the case. I'd love any explanation/correction about this if it isn't just careful "bit hacking".
Edit: Fixed the code box
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 = "TestServer1"; a_Player:GetClientHandle():SendPluginMessage("BungeeCord", "\0\7Connect" .. StringLenToASCII(a_Player,server) .. server); end
It works! This means I'm limiting a servers name in bungeecord to at most 30 characters, but 1) not many people would find a problem with that and 2) at a simple request, I can increase that to w/e number is needed relatively easily.
I did it with string.len instead of just indexes because I forgot about indexes and coded it that way. Hehe...
By the way, if I understand this right, that means that the second part is literally {NULL} {Start Of Heading} {Connect} {NULL} {Enquiry for 5, Shift out for 14} {Server name} which I find really funny if that's the case. I'd love any explanation/correction about this if it isn't just careful "bit hacking".
Edit: Fixed the code box