Hi guys,
i hope you can help me. Iam trying to rebuild a function from c++ to B4A but i dont know why it doesnt work
Here the C++ Function
And Here my try in B4A:
It throws the following error:
I hope you can help me :s
best regards,
voiD
i hope you can help me. Iam trying to rebuild a function from c++ to B4A but i dont know why it doesnt work
Here the C++ Function
B4X:
unsigned char[] RCON_Command(std::string Command, int ServerData)
{
unsigned char Packet[static_cast<unsigned char>((13 + Command.length())) + 1];
Packet[0] = Command.length() + 9; //Packet Size (Integer)
Packet[4] = 0; //Request Id (Integer)
Packet[8] = ServerData; //SERVERDATA_EXECCOMMAND / SERVERDATA_AUTH (Integer)
for (int X = 0; X < Command.length(); X++)
{
Packet[12 + X] = System::Text::Encoding::Default->GetBytes(Command[X])[0];
}
return Packet;
And Here my try in B4A:
B4X:
Sub Button1_Click
Dim SERVERAUTH() As Byte
Dim rCON As String = "flo1993lol"
SERVERAUTH(0) = rCON.Length + 13
SERVERAUTH(4) = 0
SERVERAUTH(8) = SERVERDATA_AUTH
SERVERAUTH(12) = rCON.GetBytes("ascii")
AStreams.Write(SERVERAUTH)
ToastMessageShow("Finisched",True)
End Sub
It throws the following error:
B4A line: 80
SERVERAUTH(12) = rCON.GetBytes(\
javac 1.7.0_17
src\b4a\example\main.java:386: error: inconvertible types
_serverauth[(int) (12)] = (byte)(_rcon.getBytes("ascii"));
^
required: byte
found: byte[]
1 error
I hope you can help me :s
best regards,
voiD