![]() |
[New G2O][Shared] Command Handler - Printable Version +- Gothic Online Forums (https://archive.gothic-online.com) +-- Forum: Scripting (English) (https://archive.gothic-online.com/forum-11.html) +--- Forum: Resources (https://archive.gothic-online.com/forum-14.html) +---- Forum: Scripts (https://archive.gothic-online.com/forum-17.html) +---- Thread: [New G2O][Shared] Command Handler (/thread-2089.html) |
[New G2O][Shared] Command Handler - Patrix - 05.06.2017 *Introduction: Info: This script is stable and propably doesn't have any bugs. Hi everyone, i've recently thinking about writing command-handler, but there was one little problem.. Command-handler would be useful in both sites (client and server), so i write it a piece of code, which you can load on both sides. You don't have to load it in both sides, you can load this script freely. Script works perfectly, but i'm thinking on better way, to identify script-side. License Download *List of functions: void addCommand(string or array cmd, void callback) void removeCommand(string or array cmd, [[optional: void callback ]]) Including script in xml: Info: I'm recommending you, to place script in default lib folder. <script src="lib/cmd-handler.nut" type="client" /> <script src="lib/cmd-handler.nut" type="server" /> *Examples: *Adding command(s): Squirrel Script
*Removing command(s): Squirrel Script
RE: [G2O v.0.1.0][Shared] Command Handler - Patrix - 09.06.2017 Script has been updated. I've removed some repeated things in code. RE: [New G2O][Shared] Command Handler - Patrix - 24.09.2017 Thread (not script) has been updated. RE: [New G2O][Shared] Command Handler - Patrix - 05.09.2018 Script has been updated! I've made some simple optimalizations in it, basically i've removed if statement from foreach loop in onPlayerCommand, and remove unnecessary loop. Also i'm now binding specific function based on script side, that's why i don't need if statement. |