Giter VIP home page Giter VIP logo

new-sa-mp-callbacks's Introduction

New-SA-MP-callbacks

This is a collection of useful callbacks for SA-MP, that works with every SA-MP version.

List of Callbacks

The following callbacks are included with this library:

// Called when a player pauses their game.
forward OnPlayerPause(playerid);

// Called when a player resumes their game.
forward OnPlayerResume(playerid, time);

// Called when a player starts holding a key.
forward OnPlayerHoldingKey(playerid, keys);

// Called when a player releases a key.
forward OnPlayerReleaseKey(playerid, keys, time);

// Called when a player falls and loses damage.
forward OnPlayerFall(playerid, Float:damage);

// Called when a player experiences packet loss.
forward OnPlayerPacketLoss(playerid, Float:oldloss, Float:newloss);

// Called when a player crashes their vehicle.
forward OnPlayerCrashVehicle(playerid, vehicleid, Float:damage);

// Called when a player uses a vending machine.
forward OnPlayerUseVending(playerid);

// Called when a player's FPS change.
forward OnPlayerFPSChange(playerid, oldfps, newfps);

// Called when a player jacks another player's vehicle.
forward OnPlayerJackVehicle(playerid, targetid, vehicleid);

// Called when a player completely uses up all ammo in their weapon.
forward OnPlayerEmptyWeapon(playerid, weaponid);

// Called when a player shoots another player in their team.
forward OnPlayerFriendlyFire(playerid, targetid, weaponid);

// Called when a player aims at another player.
forward OnPlayerTargetPlayer(playerid, targetid, weaponid);

// Called when a player explicitly disables textdraw selection mode.
forward OnPlayerHideCursor(playerid, hovercolor);

// Called when a player shoots more ammo than their weapon's clip can hold.
forward OnPlayerAntiReload(playerid, weaponid);

// Called when an animation is finished.
forward OnPlayerAnimationPlay(playerid, animlib[], animname[]);

// Called when a player is reloading their weapon.
forward OnPlayerReloadWeapon(playerid, weaponid, ammo);

// Called when a player starts or stops burning from fire.
forward OnPlayerBurn(playerid, status);

// Called when a player starts or stops aiming a weapon.
forward OnPlayerAiming(playerid, weaponid, status);

// Called when a player's action changes.
forward OnPlayerActionChange(playerid, oldaction, newaction);

// Called when a player rams another player.
forward OnPlayerRamPlayer(playerid, driverid, vehicleid, Float:damage);

// Called when a player uses a camera to take a picture.
forward OnPlayerUseCamera(playerid);

// Called when a player sprays a spraycan towards a vehicle.
forward OnPlayerSprayAtVehicle(playerid, vehicleid);

// Called when a player jumps by pressing the jump key.
forward OnPlayerJump(playerid);

// Called when a player starts or stops sprinting.
forward OnPlayerSprint(playerid, status);

Functions

External functions for this library:

// Returns 1 if the player is paused.
stock IsPlayerPaused(playerid);

// Returns 1 if the player is holding the key.
stock IsPlayerHoldingKey(playerid, keys);

// Returns 1 if the player is skydiving.
stock IsPlayerSkydiving(playerid);

// Returns 1 if the player is swimming.
stock IsPlayerSwimming(playerid);

// Returns 1 if the player is burning.
stock IsPlayerBurning(playerid);

// Returns 1 if the player is aiming.
stock IsPlayerAiming(playerid);

// Returns 1 if the player is jumping.
stock IsPlayerJumping(playerid);

// Returns 1 if the player is sprinting.
stock IsPlayerSprinting(playerid);

// Returns 1 if the player is near any vending machine.
stock IsPlayerNearVending(playerid);

// Returns 1 if the player is spraying at a vehicle with a spraycan.
stock IsPlayerSprayingVehicle(playerid, vehicleid);

// Returns the player's action.
stock GetPlayerAction(playerid);

// Returns the player's packet loss.
stock Float:GetPlayerPacketLoss(playerid);

// Returns the time that the player has been paused.
stock GetPlayerPausedTime(playerid);

// Returns the player's FPS amount.
stock GetPlayerFPS(playerid);

Example

public OnPlayerResume(playerid, time)
{
    new
        str[48];

    format(str, sizeof(str), "You've been paused for %d milliseconds.", time);
    return SendClientMessage(playerid, -1, str);
}

public OnPlayerCrashVehicle(playerid, vehicleid, Float:damage)
{ 
    SendClientMessage(playerid, 0xFF0000FF, "You have crashed your vehicle!");
    SendClientMessage(playerid, 0xFF0000FF, "Learn how to drive, please!");
    return 1;
}

new-sa-mp-callbacks's People

Contributors

emmet-jones avatar lordzy avatar

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.