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 - [R3V]Kelvin

#1
Snippet Showroom / Steam-like Notifications
Oct 21, 2024, 08:30 AM

This is a snippet I had worked on in September 2020 that I lost track of and recently found motivation to start working on it again.

As per usual, installation, documentation and more can be found on project's own GitHub repository: https://github.com/sfwidde/vcmp-steam-like-notifications

The code targets Squirrel but can be adapted to any language supporting streams in VC:MP.

Thanks.
#2
Quote from: MEGAMIND on Oct 04, 2024, 09:45 AMis it right  or em a not aware of docs? wiki
Here is plugin's full documentation: https://github.com/sfwidde/vcmp-latest-features-for-squirrel
The plugin does not call any sort of custom events at all. However, what you want to do is achievable manually. Here's a quick example which worked for me pretty good:
// Grab internal function from sqlatestfeatures plugin.
local fn = SetVehicle3DArrowEnabled;
// Overwrite SetVehicle3DArrowEnabled function with our own.
function SetVehicle3DArrowEnabled(vehicleId, playerToShowId, enable)
{
// Call internal plugin function.
fn(vehicleId, playerToShowId, enable);
// Call our custom event.
onVehicle3DArrowSet(FindVehicle(vehicleId), FindPlayer(playerToShowId), enable);
}

/* CVehicle, CPlayer/null, bool */
function onVehicle3DArrowSet(vehicle, playerToShow, enable)
{
print("3D arrow " + (enable ? "enabled" : "disabled") + " " +
"for vehicle " + GetVehicleNameFromModel(vehicle.Model) + " (ID: " + vehicle.ID + "), " +
"which is shown to " + (playerToShow ? playerToShow.Name : "everyone") + ".");
}
which will call onVehicle3DArrowSet custom event every time you call SetVehicle3DArrowEnabled.

Also thanks @habi2 for providing a correct example on the usage of this function.
#3
v1.1.0 Update (2024-09-03)
  • Added missing functions 'SetVehicleEngineEnabled' and 'IsVehicleEngineEnabled'.
  • Code reutilization, possibly improving performance and decreasing binary size slightly.

Updated binaries
#4
v1.0.2 Update (2024-08-25)
  • Fixed inconsistency with 'KillPlayer'.
  • Fixed 'SetPlayerCameraPos' bug when certain values for 'interpTimeMS' were used.
  • 'SetVehicleBonnetOpen' and 'SetVehicleBootOpen' now accept negative integers as a valid vehicle ID.
  • Few other minor improvements.

v1.0.3 Update (2024-08-25)
  • Fixed an internal issue with non-static functions that would make this plugin incompatible with other plugins on Linux, causing various issues like server crashing in certain scenarios, or SQLatestFeatures functions not being loaded at all.

Updated binaries
#5


Hi
With VC:MP's latest update (v0.4.7), there are new functionalities that were added to the server through the new plugin SDK. Unfortunately, official Squirrel module has not been updated in a while (6 years!), making these features inaccessible for Squirrel server developers. So, as a temporary solution to this problem, I've decided to make this plugin so that they can enjoy from these features on their servers too!

Downloads, documentation and more can be found here:
https://github.com/sfwidde/vcmp-latest-features-for-squirrel
#6
Started this project in 2021 or 2022 to learn to attach my own C/C++ functions into Squirrel but I've never promoted it anywhere until today; so, instead of letting it go to waste I have thought of sharing it here in case anyone finds it useful.
https://github.com/sfwidde/vcmp-sqlite