Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: EK.IceFlake on Oct 09, 2016, 02:33 PM

Title: String not sending properly in stream
Post by: EK.IceFlake on Oct 09, 2016, 02:33 PM
    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
Title: Re: String not sending properly in stream
Post by: EK.IceFlake on Oct 09, 2016, 03:18 PM
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
Title: Re: String not sending properly in stream
Post by: jWeb on Oct 09, 2016, 03:19 PM
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 (https://bitbucket.org/stormeus/0.4-squirrel/src/a1e803fee8807cf21139c1809f8800da73f32504/CallbackHandler.cpp?at=newapi&fileviewer=file-view-default#CallbackHandler.cpp-657). How did you manage to fart the rest of the parameters and what they mean is beyond me.
Title: Re: String not sending properly in stream
Post by: EK.IceFlake on Oct 09, 2016, 03:51 PM
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 (https://bitbucket.org/stormeus/0.4-squirrel/src/a1e803fee8807cf21139c1809f8800da73f32504/CallbackHandler.cpp?at=newapi&fileviewer=file-view-default#CallbackHandler.cpp-657). 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