Work In Progress VC:MP Scripting Plugin
vcmp-sqmod / sqmod Goto Github PK
View Code? Open in Web Editor NEWWork In Progress VC:MP Scripting Plugin
License: MIT License
Work In Progress VC:MP Scripting Plugin
License: MIT License
Work In Progress VC:MP Scripting Plugin
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.
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.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.
Syntax:
SqFind.Player.NameContains(negate:<bool>, case-sensitive:<bool>, player_name:<string>);
Usage:
print(SqFind.Player.NameContains(false, false, "dRaKe").Name);
Output:
Drake
Syntax:
GetDistrictName(player.Position);
Output:
<district-name>
Example:
Downtown
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
[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.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.
local test = "a, b, c, d, e";
local sp = split(test, ", ");
sp
should be equal to ["a", "b", "c", "d", "e"]
instead it is ["a", " ", "b", " ", "c", " ", "d", " ", "e"]
.
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.");
}
Input:
SqVehicle.Fix();
Output:
[ERR] the index 'Fix' does not exist
This works perfectly: Filename=script.log, but if a strfttime is used as the name of the log file, it doesn't create that log file: Filename=script_%F.log
SqCore.On().ScriptLoaded.Connect(function() { print(SqServer.GetWorldBounds()); });
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.
local result = db.Query("SELECT * FROM Accounts INNER JOIN Stats ON Accounts.ID = Stats.ID;");
print(result..GetInt("Accounts.ID"));
print(result..GetInt("Stats.ID"));
Produces an error that the column doesn't exist.
it happen randomly
SqCheckpoint.Create([CPlayer] player, [Sphere] bool, [World] int, [Vector3] vector, [Color4] color)
Add an option to send null
as player to create checkpoint for each player.
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.
Just like the main module gives us the option to create commands internally, the same for the IRC would be good as well.
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
.
Code used: https://pastebin.com/EePCSc5L
Output: https://i.imgur.com/ykaftWf.png
Doesn't happen in .GetField or .FieldsArray, only .FieldsTable is being buggy for some reason.
Using the plugin on Windows 7 x64 (04rel006)
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.
Syntax:
db.QueryF
db.InsertF
db.ExecuteF
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.
I fail to see a good answer to the question "why?".
Default is 1, advanced users probably know about the -j
switch anyways.
Setting ErrorHandling to false in INI file does not work
local result = db.Query("SELECT * FROM Accounts;");
print(result.GetInt("ID");
It shouldn't crash, it should rather return a message that the result was not stepped.
blip.Pos = Vector3( xx, xx, xx )
so you dont need delete and re create blip to changing pos
It is colliding with 'Rocket Launcher' weapon identifier.
SqRoutin(this, function() { /* Some code that has an error */ }, 5000, 0)
There won't be an error thrown and the routine handler would stop getting called.
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; });
The syntax should be similar to SqPlayer.Message, SqPlayer.Msg, SqPlayer.MsgP, SqPlayer.MsgEx.
And maybe combine SqIRC.MsgF
too.
function onPlayerPrivateMessage(player, playerTo, message) { SqCore.SetState(0); }
[ERR] Squirrel exception caught (OnPlayerPrivateMessage) event
[INF] Message: wrong number of parameters
Probable cause would be in the destruction method of the vehicle entity while closing/reloading the server.
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",....]
Syntax:
int32 GetWeaponSlot( int WeaponID )
returns the slot which the weapon belongs to ingame.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.