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

Messages - EK.IceFlake

#16
Try running test.bat manually and seeing if it exits.
#17
Solved. These functions are available after the server is initialized and not in VcmpPluginInit.
#18
I'm trying to create a C# plugin. I have a PlugunFunctions struct but unfortunately a few functions in it don't work.

If, for example, I execute
pluginFuncs.LogMessage("%s", "Hello World");
it prints Hello World.
If I execute
error = pluginFuncs.GetLastError();
Console.WriteLine(error);
it prints None.

However, if I execute, for example
pluginFuncs.SetMaxPlayers(54);
it causes a segmentation fault somewhere (gdb can't figure it out. it just shows the address of the location)
and if I execute
StringBuilder serverNameBuilder = new StringBuilder(129);
            VcmpError error = pluginFuncs.GetServerName(serverNameBuilder, (UIntPtr) 128);
            Console.WriteLine("Error code: " + error.ToString());
            Console.WriteLine("Server name: " + serverNameBuilder.ToString());
it causes a segmentation fault at strcpy.

Here's the relevant code: https://gist.github.com/iFlake/d0bd57a293d92790480535483de84e74

Any idea? I'm summoning @Stormeus since they're working on VC.Net.

Thanks.
#19
General Discussion / Re: How Open Self MYSQL
Aug 16, 2018, 09:48 AM
You're installing Apache and PHP for no good reason. Not good on a Windows machine. Here's what you do to avoid installing Apache and PHP:

Get MySQL server and shell and install them:
- https://dev.mysql.com/downloads/mysql/
- https://dev.mysql.com/downloads/shell/

Open a command prompt instance and type
mysql -u root -p
It will ask you for a password, type the password you specified when installing MySQL

Type the following commands into the shell:
CREATE USER my_user IDENTIFIED BY 'password_goes_here';
CREATE DATABASE my_database;
GRANT ALL PRIVILEGES ON my_database.* TO my_user;
#20
General Discussion / Re: Javascript plugin
Aug 08, 2018, 04:59 PM
Quote from: NewK on Aug 07, 2018, 01:49 PM
Quote from: EK.IceFlake on Aug 07, 2018, 01:13 PMIt'd be nice, but one of the main advantages of JavaScript is the number of libraries there are out there. Most of the libraries that deal with IO stuff won't work because they rely on Node.JS's API.
No, that's not one of the main advantages of javascript, that's one of the main advantages of node.js. Do not mix up the 2, those are 2 very different things. Javascript is not node.js and node.js is not javascript. Node.js is simply a set of C++ APIs that are made available to a javascript context running on top of V8. I never claimed this to be a node.js plugin, I said this is a javascript plugin, as in, actual ecmascript.  Think of it this way: Nodejs is a set of C++ APIs exposed to a javascript context running on V8. This plugin is a set of Java APIs exposed to a javascript context running on V8. Java was used to rely on the already existing VCMP Java plugin to expose VCMP functionality and to share the same codebase so it's easier to maintain in the future.
I'm aware of that, yeah. But the majority of JavaScript libraries that support networking or disk IO are made for node.js. So you won't really get much benefit in using this. ECMAScript by itself is a terrible language. There was this infamous picture which I can't find right now that shows what happens when you're using some operands with different types.

But yeah, overall, it'll still be better than what we currently have.
#21
General Discussion / Re: Javascript plugin
Aug 07, 2018, 01:13 PM
It'd be nice, but one of the main advantages of JavaScript is the number of libraries there are out there. Most of the libraries that deal with IO stuff won't work because they rely on Node.JS's API.
#22
Support / Re: readinistring
Jul 22, 2018, 08:23 AM
Quote from: Doom_Kill3R on Jul 22, 2018, 07:50 AM
Quote from: Stormeus on Jul 21, 2018, 07:37 PMIf you're going to the effort of writing Squirrel code in an INI file, why not just get rid of the INI part and use dofile?

He means since you are saving the data in ini as pure squirrel code, you can directly use dofile to load all the CreateObject statements from the ini file instead of reading them from ini as strings and then executing them/creating objects with them.

try
dofile("objects.ini")and it should load all the objects

You can't dofile an ini, it'll cause errors. You should save them to a .nut file.
#23
Client Scripting / Cursor system
Jul 19, 2018, 02:38 PM
Here's a cursor system you can use to manage your cursors

Cursor <- {
    "Obtain": function () {
        ++this.Cursors;
        this.Refresh();
    },
    "Release": function () {
        --this.Cursors;
        this.Refresh();
    },

    "ObtainSmart": function (wref) {
        this.Obtain();

        local routine;
        routine = ::Routine(function () {
            if (wref.ref() == null) {
                this.Release();
                routine.Destroy();
            }
        }, 0, 0, this);
    },

    "Refresh": function () {
        ::GUI.SetMouseEnabled(this.Cursors > 0)
    }

    "Cursors": 0
}

You can use Cursor.Obtain() to obtain a cursor and Cursor.Release() to release a cursor. When the total cursor count is 0 the cursor automatically gets destroyed.



Ok that's normal and boring stuff. What's cool is Cursor.ObtainSmart(). Let's say you have a widget class has some elements in it. You construct that class when you want to create that widget and delete all references to it when you want to destroy it. Now squirrel doesn't support a class destructor. This means that you can't release your cursor! But this cursor system will still help you. If you obtain a smart cursor using:
Cursor.ObtainSmart(this.weakref());the cursor will automatically be released once all references to your class have been removed.



Dependencies:



[spoiler=MIT]Copyright © 2018  Fleka

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.[/spoiler]
#24
Quote from: vitogta on Jul 19, 2018, 10:42 AM
Quote from: . on Jul 19, 2018, 10:01 AMWhat plugin is this? Because we have two SQL related plugins. MySQL and SQLite. And I can't find it in neither of them.
He should be asking about FreeSQLQuery of SQLite.
If you don't free your queries, every query will cause your server's memory usage to increase a little. After a while, you will run out of memory.
#25
Quote from: Athanatos on Jul 06, 2018, 08:49 AMDoes this result in any error or crash? If no, then that issue should not be important.
Doesn't matter. It exists and needs to be dealt with.
#27
Quote from: Stormeus on Jul 07, 2018, 05:25 PM
Quote from: EK.IceFlake on Jul 07, 2018, 07:28 AMWhen you modify something, you gain copyright over what you've created. It also inherits the original copyright which is why there's the apache license notice included in the original header file.

That's not really how copyright works, but it doesn't really matter since this is compatible with the Apache License we use for the SDK anyway.

If you extend some GPL'd software with your own code, your code is under your copyright. You can even put it under a proprietary license. However, you aren't allowed to link them together in that case, since they're incompatible. But like you said, in this case, the MIT license is compatible with the Apache license. So, in this case, it's perfectly alright for this code to have both licenses + copyright notices.
#28
Quote from: Athanatos on Jul 07, 2018, 06:50 AM#   Copyright © 2018  FlekaNo shit. You just modified the SDK. You don't deserve any copyright stuff.

?

When you modify something, you gain copyright over what you've created. It also inherits the original copyright which is why there's the apache license notice included in the original header file.

It's the MIT license anyways, which means you can do whatever you want with it.
#29
This is the VCMP SDK in yaml format made so that you can parse it easily in order to generate bindings to it.

https://pastebin.com/Z350QSYp

Some names might be changed, but the order remains the same so they should still work.

-- Update: Removed redundant const ... notation.
-- Update: Made return types easier to parse.
-- Update: Standardize enumerator formats.
-- Update: Make constant-size lists easier to parse.
-- Update: Make dynamic-size lists easier to parse.
-- Update: Made strings easier to parse. Fixed length of string in struct PluginInfo.
-- Update: Made format strings easier to parse. Made PluginFuncs and PluginCalls separate from Structs.
#30
Support / Re: Other error
Jul 06, 2018, 07:57 AM
Quote from: Doom_Kill3R on Jul 06, 2018, 06:36 AMThis is an English forum and keep your conversations in English.

As for you @UrbanY, Your scripts are based on version 03 which had server-sided UIs. They are deprecated now and will not work on the newer versions. Either stick around on 03 or create proper client side scripts on the latest version.
https://forum.vc-mp.org/?topic=2.0