String not sending properly in stream

Started by EK.IceFlake, Oct 09, 2016, 02:33 PM

Previous topic - Next topic

EK.IceFlake

    function onclientscriptdata(player, cint, cbyte, cfloat, cstring)
    {
        if (cint == 0)
        {
            Stream.StartWrite();
            Stream.WriteString("INIT");
            Stream.WriteInt(1);
            Stream.SendStream(player);
        }
        else if (cint == 2)
        {
            local left = cstring[0] == 'L';
            print(cstring);
            local passwd = cstring.slice(1, cstring.len());
            print(passwd);
            print("lefty:"+left);
        }
        else if (cint == 3)
        {
            ::KickPlayer(player);
        }
    }
        local message = Stream();
        message.WriteInt(2);
        print((::IscheckedCheckbox(Server.LHC) ? "L" : "R") + Server.PWD.Text);
        message.WriteString((::IscheckedCheckbox(Server.LHC) ? "L" : "R") + Server.PWD.Text);
        Server.SendData(message);
Typing "printing to debug log" in Server.PWD
MSG: Rprinting to debug log
[SCRIPT]  ting to debug log
[SCRIPT]  ing to debug log
[SCRIPT]  lefty:false

Thanks for help e.e

EK.IceFlake

#1
More information: I found out that the number of characters lost changes when I change the int send
:edit: This only happens when I read a byte or float when one isn't present

jWeb

#2
What dafuq just happened? :-\

*Wipes mouth after puking from that code.

Missing portions of the code, context, intention and altered syntax/signature, weird style. How do you expect anyone to understand anything here?

`onclientscriptdata` is only called with a player instance. How did you manage to fart the rest of the parameters and what they mean is beyond me.

EK.IceFlake

Quote from: jWeb on Oct 09, 2016, 03:19 PMWhat dafuq just happened? :-\

*Wipes mouth after puking from that code.

Missing portions of the code, context, intention and altered syntax/signature, weird style. How do you expect anyone to understand anything here?

`onclientscriptdata` is only called with a player instance. How did you manage to fart the rest of the parameters and what they mean is beyond me.
Never mind I solved the issue read my reply above e.e