Giter VIP home page Giter VIP logo

sqmod's Introduction

VCMP-SqMod

Work In Progress VC:MP Scripting Plugin

sqmod's People

Contributors

dizzaster avatar dracc avatar islc avatar omairmunir0 avatar thekakan avatar vancityspiller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sqmod's Issues

Unable to select() on IRC session

While closing the server in linux with CTRL+C [ERR] Unable to select() on IRC session appears and then it gets freezed and nothing happens. I have to kill the screen or close the ssh session to close the server.
Also, it happens sometimes but most of the times.

Improvement on SqForeach

Adding support for 'continue' like behavior.

SqForeach.Player.Active( function( this, pPlayer ) {
if( !pPlayer.Spawned ) return true; // Works as continue like in native foreach
return false; // Works as break like in native foreach
} );

SqFind.... returns null in every case.

SqFind.Player.NameContains(false, "partial_player_name");

Even if the full name is used, it still returns null.
Not only for .NameContains(), it's the same for each of the available options.

SqPlayer.Find(player_id) works but SqPlayer.Find(full_player_name) returns null, again.

Add case insensitive option to SqFind....

Syntax:
SqFind.Player.NameContains(negate:<bool>, case-sensitive:<bool>, player_name:<string>);

Usage:
print(SqFind.Player.NameContains(false, false, "dRaKe").Name);

Output:
Drake

Crashing if an IRC session is invalid.

PlayerDestroyed contains a message for the IRC that the player left the server and when we reload or stop the server, it tends to crash: terminate called after throwing an instance of 'Sqrat::Exception'.

The issue occurs because the IRC module is being terminated before the player is destroyed and thus the IRC session becomes invalid.

[DBG] Signaling outside plug-ins to release their resources
[SQMOD] Terminating: Squirrel IRC Module
[ERR] Invalid IRC session

Exception caught in PlayerDisembark event.

[ERR] Program exception caught (OnPlayerExitVehicle) event
[INF] Message: vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)

Produces when a player is embarked in a vehicle and the server is reloaded/shutdown.

SqRoutine.Terminate() doesn't remove the specific routine.

SqRoutine.Create(this, function() { print("test") }, 5000, 1).SetTag("test");
SqRoutine.FindByTag("test").Terminate();

The above only suspends the routine and doesn't totally remove the routine.

EDIT: And actually even if a routine has done its work, it still doesn't get removed.

Add (header, payload) parameters to SqPlayer.TrackPosition.

Syntax: SqPlayer.TrackPosition(number_of_position_changes, header, payload);
Event: PlayerPosition(player, header, payload);

Example of usage:
player.TrackPosition(1, 1, "cmd_heal");

function onPlayerPosition(player, header, payload)
{
if(payload == "cmd_heal") player.Message("Healing failed.");
}

`make` doesn't create output folders

Cloning and building this project for the first time is rendered a pain as Makefile doesn't include any instructions to create the output folders.

Environment:
Debian GNU/Linux testing
gcc 8.3.0
g++ 8.3.0
GNU make 4.2.1


Edit: After reading through Makefile it became apparent that make all or make folders would create all necessary folders.
Easy fix for this issue would be to move https://github.com/iSLC/VCMP-SqMod/blob/d3e6adea147f5b2cae5119ddd6028833aa625c09/Makefile#L192 to line 147.

Add an Include function to load scripts only once.

The syntax would be: Include([string] script_path, [bool] execute);

The execute parameter can be used to execute the file immediately or wait until all other scripts have been compiled and then execute it.

SqCmd.Manager specifier wierd problem.

SqCommand.Create("setlevel", "is|i", ["player_name/id", "level"]);

If the first argument is sent as string, the second argument accepts integer.
But if the first argument is sent as integer, the second argument doesn't accept any kind of input.

It returns SqCmdErr.UnsupportedArg to the global function BindOnFail.

SqCore.SetState sometimes doesn't affect

SqCore.SetState( 0 );

This is supposed to stop the event from moving downwards

local PlayerBanned = player.IsBanned();
if( PlayerBanned ) {
player.Kick();
SqCore.SetState( 0 );
return true;
}

Even with this code it SOMETIMES goes without cancelling.

Possibility to execute all scripts from a directory.

Add a feature to scan a folder for existing scripts.

CompileDir=path/to/dir
ExecuteDir=path/to/dir

Preferably, also include filename filtering to be able to load only files with a certain name and extension.

CompileDir=path/to/dir/*_lib.nut
ExecuteDir=path/to/dir/cmd*.*nut

The filtering feature is debatable depending on how much work it needs to be implemented.

Crashes while reloading the server.

This occurs because the commands in the CmdManager aren't removed after the server is reloaded and so when it tries to create the commands with same name, it tends to crash.

A simple command to reproduce would be:
SqCmd.Create("r").BindExec(this, function (Instance, Args) { SqCore.Reload(true); return true; });

PlayerPrivateMessage parameter problem.

function onPlayerPrivateMessage(player, playerTo, message) { SqCore.SetState(0); }

[ERR] Squirrel exception caught (OnPlayerPrivateMessage) event
[INF] Message: wrong number of parameters

Add a function to get the list of commands as string and array.

Syntax:
SqCommand.List(); // Should return a string with all the commands.
SqCommand.Collect(); // Should return an array with all the commands.

Example of usage:
print(SqCommand.List());
print(SqCommand.Collect());

Output:
cmd1, cmd2, cmd3,.....
["cmd1", "cmd2", "cmd3",....]

Possibility of enabling error reporting on specific routines

Add another Boolean member to Routine::Instance which cam be used to signal the sq_call function used during execution that the error handling should be enabled or not. Currently it uses the global option which tends to spam the console when enabled.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.