This repository has no licence file. It is public to read, but that alone does not give permission to reuse it.
Install with sampctl
sampctl package install MoonLightHowling999/New-OMP-Callbacks
Run this in your project folder. sampctl downloads the package and what it depends on.
Adds its include files, with the libraries it depends on, to the Pawn compiler in your browser, ready to include in a script.
Depends on 1 package
README.md
New-OMP-Callbacks
New custom callbacks!
Originally by Emmet_, updated for Open.MP compatibility
New Callbacks
| Callback | Description |
|---|---|
OnPlayerPause(playerid) | Player tabbed out or went AFK |
OnPlayerResume(playerid, time) | Player came back, time is how long they were gone (ms) |
OnPlayerHoldingKey(playerid, keys) | Fires every 200ms while a key is held |
OnPlayerReleaseKey(playerid, keys, time) | Key released, time is how long it was held |
OnPlayerFall(playerid, Float:damage) | Player took fall damage |
OnPlayerPacketLoss(playerid, Float:oldloss, Float:newloss) | Player's packet loss changed |
OnPlayerUseVending(playerid, type) | Player used a vending machine |
OnPlayerCrashVehicle(playerid, vehicleid, Float:damage) | Vehicle took crash damage |
OnPlayerFPSChange(playerid, oldfps, newfps) | Player's FPS changed |
OnPlayerJackVehicle(playerid, targetid, vehicleid) | Player carjacked someone |
OnPlayerEmptyWeapon(playerid, weaponid) | Player fired their last bullet |
OnPlayerFriendlyFire(playerid, targetid, weaponid) | Player shot a teammate |
OnPlayerTargetPlayer(playerid, targetid, weaponid) | Player aimed at another player |
OnPlayerHideCursor(playerid, hovercolor) | Player pressed ESC on a textdraw selection |
OnPlayerAntiReload(playerid, weaponid) | Player fired more shots than the clip holds |
OnPlayerAnimationPlay(playerid, animlib[], animname[]) | An applied animation started playing |
OnPlayerReloadWeapon(playerid, weaponid, ammo) | Player started reloading |
OnPlayerActionChange(playerid, oldaction, newaction) | Player switched between idle, shooting, swimming, skydiving |
OnPlayerRamPlayer(playerid, driverid, vehicleid, Float:damage) | Player got rammed by a vehicle |
OnPlayerSprayAtVehicle(playerid, vehicleid) | Player is spraying a vehicle |
OnPlayerStartBurn(playerid) | Player caught fire |
OnPlayerStopBurn(playerid) | Player stopped burning |
OnPlayerStartAim(playerid, weaponid) | Player entered aim mode |
OnPlayerStopAim(playerid) | Player left aim mode |
OnPlayerUseCamera(playerid) | Player took a photo |
OnPlayerJump(playerid) | Player jumped |
OnPlayerUseGarage(playerid, vehicleid, type) | Player used a Pay'n'Spray or Bomb Shop |
OnVehicleCreated(vehicleid, color1, color2) | Vehicle was created by the server |
Utility Functions
IsPlayerPaused(playerid)
IsPlayerBurning(playerid)
IsPlayerAiming(playerid)
IsPlayerSwimming(playerid)
IsPlayerSkydiving(playerid)
IsPlayerJumping(playerid)
IsPlayerNearVending(playerid, type)
IsPlayerNearGarage(playerid, type)
IsPlayerSprayingVehicle(playerid, vehicleid)
GetPlayerFPS(playerid)
GetPlayerAction(playerid)
GetPlayerPausedTime(playerid)
GetPlayerPacketLoss(playerid)
GetConnectedTime(playerid)
For sampctl users
Add to your pawn.json dependencies:
"MoonLightHowling999/New-OMP-Callbacks"
Then run: sampctl ensure
Usage
Just include it in your gamemode or filterscript and define whichever callbacks you need:
#include <callbacks>
public OnPlayerJump(playerid)
{
SendClientMessage(playerid, 0xCDD5D4, "{CDD5D4}Player %d has jumped", playerid); // show this when somebody jumpps
return 1;
}
public OnPlayerRamPlayer(playerid, driverid, vehicleid, Float:damage)
{
SendClientMessage(playerid, 0xCDD5D4, "{CDD5D4}Player %d has rammed player %d with vehicle %d causing damage %.2f", playerid, driverid, vehicleid, damage); // show this when somebody rams another
return 1;
}
For a more complete example see example.pwn.
[!IMPORTANT]
Notes
- Some callbacks need to be Forward-declared in your own script like so:
// Forwards here
forward OnPlayerBurning(playerid, status);
forward OnPlayerAiming(playerid, weaponid, status);
forward OnPlayerSprint(playerid, status);
- Compatible with other includes that hook
OnPlayerUpdateetc. via ALS - FPS detection uses the drunk level trick, readings are approximate and cap around 200
OnPlayerAntiReloadonly covers weapons in the COLT45–TEC9 rangeOnPlayerUseGaragerelies on camera mode + money deduction, so it can theoretically misfire if something else modifies player money at the same time
Tests:
Credits
Original include by Emmet_.
This page is built from what GitHub publishes about the repository. samp.directory does not host the code. Report a problem with this listing