Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - EK.IceFlake

#21
I was trying out IRC and found out that it still uses the old Bind event API:
base.Bind(SqIrcEvent.Connect, this, this.OnConnected);I would've expected something like this:
base.On.Connected.Connect(this.OnConnected, this);
#22
Description
I have some code:
class IInventoryTab
{
    Container    = null;

    Item         = null;
    Value        = null;

    constructor (parent, position_reference = null, item = "", value = "")
    {
        local _this = this;

        this.Container    = GUIWindow(VectorScreen(0, 0), VectorScreen(280, 32), Color(0, 0, 0, 0))
            .CRemoveFlags(GUI_FLAG_SCROLLABLE | GUI_FLAG_WINDOW_TITLEBAR | GUI_FLAG_WINDOW_CLOSEBTN | GUI_FLAG_WINDOW_RESIZABLE | GUI_FLAG_SHADOW | GUI_FLAG_BORDER)
            .CAddFlags(GUI_FLAG_MOUSECTRL)
            .SetParent(parent)
            .On("HoverOver", function () { _this.Container.Color = Color(255, 255, 255, 192); })
            .On("HoverOut", function () { _this.Container.Color = Color(0, 0, 0, 0); });
       
        if (position_reference != null) this.Container.Insert(InsertLocation.Below, position_reference);
       
        this.Item         = GUILabel(VectorScreen(0, 0), Color(200, 200, 200), item)
            .SetParent(this.Container)
            .SetTypeface("lato", 11, Color(200, 200, 200))
            .Float(FloatLocation.CenterLeft)
            .Offset(VectorScreen(8, 0));
       
        this.Value        = GUILabel(VectorScreen(0, 0), Color(200, 200, 200), value)
            .SetParent(this.Container)
            .SetTypeface("lato", 11, Color(200, 200, 200))
            .Float(FloatLocation.CenterRight)
            .Offset(VectorScreen(-8, 0));
    }
}

Whenever I hover over the window it becomes white but the label disappears. It's not cammoflauged because when I hover out it becomes transparent again but this time the label isn't visible.
If I comment the part of the code that changes the window's color, the label doesn't disappear:
            .On("HoverOver", function () { /*_this.Container.Color = Color(255, 255, 255, 192);*/ })
            .On("HoverOut", function () { /*_this.Container.Color = Color(0, 0, 0, 0);*/ });

Reproducible
Always :(

What you were doing when the bug happened
Making a window that changes its color on hover

What you think caused the bug
Incomplete rerendering

:edit: Another bug report claimed it was it applying its alpha to all its children. That was the case and a workaround for anyone who is frustrated by this is to recolor all children after setting its color.
#23
Would be nice if we'd have some client-side storage-limited IO locked to the store folder.

null IO.WriteFile(string path_relative_to_the_store_directory, array<int> buffer);
array<int> IO.ReadFile(string path_relative_to_the_store_directory);

:edit: Files in store are cleared if they do not exist in the server's store directory every rejoin. Maybe VCMP/04beta/serverdata/ip-port.
:edit: Stream functionality like file in sqstdlib would be even better due to efficiency.
#24
Description
Whenever I try to disable the frame limiter it snaps back on like what happens when you try to enable widescreen.

Reproducible
Always.

What you were doing when the bug happened
I was lagging and remembered that my frame limiter keeps turning on a few updates ago and tried to disable it again but this time it failed to disable.

What you think caused the bug
Some offsets got messed up.
#25
It would be cool if UID was hashed with the server's IP and port as it would prevent people from capturing others' UIDs and using them to log in to their accounts and potentially wreck havoc.
#26
Description
Whenever I shoot a grenade, it lands right in front of my character after the last update

Reproducible
Always

What you were doing when the bug happened
Shooting a grenade

What you think caused the bug
The fix that prevented move states from being desynced when holding the sprint key while holding certain weapons.
#27
How would we go about using prepared statements with SQLite?
#28
I've used this account system on two servers so it must be useful. https://pastebin.com/Zf9kHyhc
I have ported this over from Innovation Fantasy for export and thus there may be residual bugs from the porting process. Reply here if you find any.

You can register player variables using RegisterPlayerVariable(variable, value = null).
For example: RegisterPlayerVariable("Kills", 0);

This will take care of loading and saving it for you.
Use that created variable like this:

player.Kills = 10;
++player.Kills;
if (player.Kills == 1000) player.Cash += 100000;
#29
The title is enough: Getting an unoccupied slot in a vehicle using .Occupant causes a crash
#30
Off-Topic General / Wtf are these traps
May 24, 2017, 05:16 PM
When trying to reverse engineer squirrel bytecode I get some traps

Are they to simply make life hard for reverse engineers or do they serve some actual purpose?
#31
General Discussion / [Suggestion] GUIHtmlView
May 19, 2017, 04:21 PM
Would be very nice... no need to script complicated animations or bang your head trying to calculate complicated math.
An added option to connect to a website would be an added bonus - /forum could now show the actual forum instead of providing a link to it.
#32
Client Scripting / Client side routines
May 12, 2017, 02:10 PM
A very simple routine handler I made for a server I am working on. It can be found here: https://pastebin.com/VfC1qeVz
Using it is very simple
1. Add this to Script::ScriptProcess
    foreach (routine in ::Routines)
    {
        routine.Execute();
    }

2. Now create some routines. This is the syntax: Routine(function event, integer interval, integer iterations, env environment = null)
Here is an example:
Routine(function ()
{
    Console.Print("Hi");
}, 1000, 2);

I have purposely left out the ability to call the function with parameters. This is because this functionality doesn't fit well and can be achieved easily:
local hello = "Hello";
Routine(function ()
{
    Console.Print(hello);
}, 1000, 2);

You can manipulate a timer if you capture the object returned by instantiating it:
local routine = Routine(...);
Here is the documentation:
function event - The event which gets called
integer interval - The interval in which to call it
integer repeats - The amount of times it has repeated
integer repeat - The amount of times it should repeat
env environment - The environment with which to call the function
integer offset - The time to offset the next call from

null Execute() - Execute the event if it needs to
null Destroy() - Destroy the routine

Also, I am well aware of this: https://forum.vc-mp.org/?topic=2748.0
However,
  • It is never a bad idea to have a copylefted version
  • This one is an object-oriented one
  • I like to have my own code in my stuff

[spoiler=CLNS]CLNS
You may use and redistribute this license, however, changing it is not allowed.

This software comes with NO WARRANTIES, read section 2.

PREAMBLE:
      This is a copyleft license--
      While most software licenses are designed to take away your freedom, this license, on the contrary, will preserve your freedom, even when redistributed.
      To preserve its and your freedom, any user or contributor to this software must retain the freedoms of this license.
      The freedoms provided by this license are:
            Every user is permitted to use or modify this software in any way
            Every user is permitted to override any technical limitations, including overriding activation features
            Every user is permitted to decompile or disassemble this software
            Every contributor is permitted to commercialize this software
            Every contributor is permitted to apply technical limitations to this software
      Please read this agreement carefully

TERMS AND CONDITIONS:
1>    Definitions:
       1>   "Technical limitation" means preventing an action without legal intervention.
       2>   "User" means any person using the front-end.
       3>   "Contributor" means any person using the source code or developing directly on the binaries.
       4>   "You" means any user or contributor.
       5>   "Deriative" means any work based on this software.
       6>   "This software" means any work distributed under this license.
       6>   "You" means the licensee of this software.
       7>   "Including" implies 'but not limited to'.
       8>   All definitions are case-insensitive.
       9>   All definitions are plurality-insensitive.
2>    No liablity:
       1>   This software is provided without any warranties, implied or otherwise.
       2>   The authors of this software are not liable for any losses or lost profits that occur by the use of this product, directly or otherwise.
       3>   You agree to indemnify the authors of this software free from any liabilities you cause.
3>    Application:
       1>   This license applies to any user or contributor of this software.
       2>   This license grants you explicit permission to use, modify and/or redistribute this software.
       2>   This license may be revoked by removing all copies and traces of the software.
4>    Scope:
       1>   This license applies to the source code, its binaries and any deriatives.
       2>   Additional license terms may apply.
       3>   Additional license terms may not conflict with this license.
       4>   This license will not apply and you will not be allowed to use this software if any law forces you to override it in any way.
5>    Freedoms
       1>   You are permitted to modify this software, by source if available, binary or otherwise.
       2>   You are permitted to override any technical limitations in this software, including activation/commercialization features.
       3>   You are permitted to commercialize this software.
       4>   You are permitted to apply technical limitations to this software and they will not carry any legal protection.
6>    Human rights
       1>   This software may not be used to or to support human trafficking.
       2>   This software may not be used to discriminate or to support discrimination on the basis of age, sex, racial origin, nationality, religion, sexuality or relationship.
7>    Legal measures
       1>   You are not permitted to use any legal measures, including patents or trademarks, to override this license.[/spoiler]
#33
Well I have this code: https://pastebin.com/E6uCwF4S
and it an error which it claims to be on line 50
if (player.World == this.world && player.Position.DistanceTo(this.position) < this.maxdist) withindist = true;

=>Location: NATIVE

=>Line: -1

=>Function: unknown

]

Traceback:

[

=> [1] NATIVE (-1) [unknown]

=> [2] /home/ogpbot/OGP_User_Files/es/scripts/streamer.nut (50) [unknown]

]

Which I'm guessing is due to player.Position.DistanceTo
What should I do with this?
#34
Bugs and Crashes / [Bug] Don't enough worlds
May 11, 2017, 03:50 PM
Description
I can't set a player's world to a value higher than 65535. Doing so would be the equivalent of <specified value> % 65536. On the VCMP blog is advertised 2^32/2-1.

Reproducible
Always

What you were doing when the bug happened
Testing worlds

What you think caused the bug
Using uint16 somewhere instead of int32 and int32 elsewhere.

Note
Summoning @. because this was on his plugin. It might be an integer overflow due to him using uint16 instead of an issue with the actual server.
#35
I am very eagerly hoping that the reference counter does that for us. Because I expect better from you.

Does it?
#36
To can override the Max Limit.

By the way, what is the max limit for checkpoints and spheres?
#37
Bug Reports / State not setting properly
May 06, 2017, 04:49 AM
Exec("Creating custom events", function ()
{
    SqCore.On().CPlayerRequestSpawn    <- SqCreateSignal();
    SqCore.On().CPlayerSpawned         <- SqCreateSignal();
});

SqCore.On().CPlayerRequestSpawn.Connect(function (player)
{
    player.Message(MessageType.Information, "V0t? U Request Spown?");
    SqCore.SetState(false);
});
            local last_state = SqCore.GetState();
            SqCore.SetState(1);

            SqCore.On().CPlayerRequestSpawn.Emit(player);

            local return_state = SqCore.GetState();
            SqCore.SetState(last_state);

            if (return_state == false || return_state == 0) return;
It doesn't feel much like returning for some reason...
::edit:: it was CPlayerRequestSpawn.Emit.
Fixed.
#38
Well...
if (player.Vehicle == null)works for determining if a player is on foot

But
player.Vehicle = null;causes this error:
[ERR] the index 'Vehicle' does not exist
I suggest you make player.Vehicle = ??? to be an alias of player.Embark(???);
#39
Well...
was making a custom class system.
skin.position    = Vector3(stmt.GetValue("position_x"), stmt.GetValue("position_y"), stmt.GetValue("position_z"));
And apparently:
print(skin.position);[USR] 0.000000,556.091003,11.098300

DB Browser for SQLite shows the correct value for it (-768.839, 556.091 and 11.0983)

A workaround would be to 5000 + position and then position - 5000, but it's exactly that - a workaround - and I don't like workarounds.
#40
Bug Reports / Stream not sending
May 05, 2017, 05:02 AM
    player.StartStream();
    player.StreamInt(CLIENT_STREAMS.SelectClass);
    player.StreamByte(1);
    player.FlushStream(true);

    player.StartStream();
    player.StreamInt(CLIENT_STREAMS.UpdateClass);
    player.StreamString("Sasuke");
    player.StreamString("Sakura Chan");
    player.FlushStream(true);
function Server::ServerData(stream)
{
    local identifier = stream.ReadInt();

    switch (identifier)
    {
        case ServerDataType.SelectClass:
            Binarify(stream.ReadByte()) ? SpawnScreenLabel.Create() : SpawnScreenLabel.Destroy();
            break;

        case ServerDataType.UpdateClass:
            SpawnScreenLabel.LabelValueTeam    = stream.ReadString();
            SpawnScreenLabel.LabelValueSkin    = stream.ReadString();
            break;
       
        default:
            Console.Print("[#33CC33]System internal         [#FFFFFF]| [#FF0000]Error: [#FFFFFF]Unrecognized stream identifier [#33CC33]" + type + "[#FFFFFF].")
            break;
    }
}

Nothing happens. Console.Print doesn't output anything when made to test if Server::ServerData is being called.