[Include] New SA-MP callbacks!
#1

New SA-MP callbacks

Here is a collection of useful callbacks for scripters to use. Ideas for new callbacks are welcome!

Callback list
pawn Code:
OnPlayerPause(playerid)
Description: Called when a player is paused.

OnPlayerResume(playerid, time)
Description: Called when a player has resumed.

OnPlayerHoldingKey(playerid, keys)
Description: Called when a player begins holding a specific key.

OnPlayerReleaseKey(playerid, keys)
Description: Called when a player releases a key.

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

OnPlayerPacketLoss(playerid, Float:newpacket, Float:oldpacket)
Description: Called when a player experiences packet loss.

OnPlayerUseVending(playerid, type)
Description: Called when a player uses a vending machine.

OnPlayerCrashVehicle(playerid, vehicleid, Float:damage)
Description: Called when a player crashes a vehicle.

OnPlayerFPSChange(playerid, oldfps, newfps)
Description: Called when a player's FPS rate changes.

OnPlayerJackVehicle(playerid, targetid, vehicleid)
Description: Called when a player jacks another player'
s vehicle.

OnPlayerEmptyWeapon(playerid, weaponid)
Description: Called when a player depletes all ammo in a weapon.

OnPlayerFriendlyFire(playerid, targetid, weaponid)
Description: Called when a player shoots at a teammate.

OnPlayerTargetPlayer(playerid, targetid, weaponid)
Description: Called when a player targets a player with their weapon.

OnPlayerHideCursor(playerid, hovercolor)
Description: Called when a player cancels textdraw selection.

OnPlayerAntiReload(playerid, weaponid)
Description: Called when a player shoots without reloading their weapon.

OnPlayerAnimationPlay(playerid, animlib[], animname[])
Description: Called when an animation is played.

OnPlayerReloadWeapon(playerid, weaponid, ammo)
Description: Called when a player reloads their weapon.

OnPlayerActionChange(playerid, oldaction, newaction)
Description: Called when a player's action change (see action list).

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

OnPlayerSprayAtVehicle(playerid, vehicleid)
Description: Called wehn a player is spraying at a vehicle.

OnPlayerStartBurn(playerid)
Description: Called when a player is burning from fire.

OnPlayerStopBurn(playerid)
Description: Called when a player stops burning.

OnPlayerStartAim(playerid, weaponid)
Description: Called when a player is aiming a weapon.

OnPlayerStopAim(playerid)
Description: Called when a player stops aiming.

OnPlayerUseCamera(playerid)
Description: Called when a player snaps a picture with a camera (weapon ID: 43).

OnPlayerJump(playerid)
Description: Called when a player jumps (SHIFT key).

OnPlayerUseGarage(playerid, vehicleid, type)
Description: Called when a player uses a Pay'
n'Spray or bomb shop.

OnVehicleCreated(vehicleid, color1, color2)
Description: Called when a vehicle is created by the server.
Function list
Code:
IsPlayerPaused(playerid)
Description: Returns 1 if the player is paused.

IsPlayerSkydiving(playerid);
Description: Returns 1 if the player is skydiving.

IsPlayerSwimming(playerid)
Description: Returns 1 if the player is swimming.

IsPlayerBurning(playerid)
Description: Returns 1 if the player is burning.

IsPlayerAiming(playerid)
Description: Returns 1 if the player is aiming a weapon.

IsPlayerJumping(playerid)
Description: Returns 1 if the player is jumping.

IsPlayerNearVending(playerid, type)
Description: Returns 1 if the player is near the specified vending machine type.

IsPlayerSprayingVehicle(playerid, vehicleid)
Description: Returns 1 if the player is spraying the specified vehicle with a spraycan (weapon ID: 41).

IsPlayerNearGarage(playerid, type)
Description: Returns 1 if the player is near the specified garage type.

GetPlayerAction(playerid)
Description: Returns the player's current action.

Float:GetPlayerPacketLoss(playerid)
Description: Returns the player's packet loss.

GetPlayerPausedTime(playerid)
Description: Returns the time the player has been paused (in milliseconds).

GetPlayerFPS(playerid)
Description: Returns the player's FPS.
Action types for GetPlayerAction and OnPlayerActionChange:

pawn Code:
#define PLAYER_ACTION_NONE      0
#define PLAYER_ACTION_SHOOTING  1
#define PLAYER_ACTION_SWIMMING  2
#define PLAYER_ACTION_SKYDIVING 3
Garage types for OnPlayerUseGarage and IsPlayerNearGarage:

pawn Code:
#define GARAGE_BOMBSHOP         1
#define GARAGE_PAYNSPRAY        2
Vending machine types for OnPlayerUseVending and IsPlayerNearVending:

pawn Code:
#define VENDING_TYPE_SPRUNK     1
#define VENDING_TYPE_CANDY      2
Code examples
pawn Code:
public OnPlayerUseGarage(playerid, type)
{
    if(type == GARAGE_PAYNSPRAY)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You have been charged $100 for respraying your vehicle.");
        PlayerInfo[playerid][pMoney] -= 100;
    }
    else if(type == GARAGE_BOMBSHOP)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You have been charged $500 for using the bomb shop.");
        PlayerInfo[playerid][pMoney] -= 500;
    }
    return 1;
}
pawn Code:
public OnPlayerResume(playerid, time)
{
    new
        string[48];

    format(string, sizeof(string), "You've been paused for %i milliseconds.", time);
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
}
pawn Code:
public OnPlayerActionChange(playerid, oldaction, newaction)
{
    if (newaction == PLAYER_ACTION_SHOOTING)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You are now shooting a weapon.");
    }
    else if (newaction == PLAYER_ACTION_SKYDIVING)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You are now skydiving.");
    }
    else if (newaction == PLAYER_ACTION_SWIMMING)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You are now swimming.");
    }
}
pawn Code:
public OnPlayerStartBurn(playerid)
{
    // Attach a fire particle to this player so other players can see them burning!
    SetPlayerAttachedObject(playerid, 0, 18691, 1);
    return 1;
}

public OnPlayerStopBurn(playerid)
{
    RemovePlayerAttachedObject(playerid, 0);
    SendClientMessage(playerid, COLOR_WHITE, "You have stopped burning.");
    return 1;
}
Download
Pastebin
GitHub
Reply


Messages In This Thread
New SA-MP callbacks! - by Emmet_ - 26.01.2014, 16:01
Re: New SA-MP callbacks! - by Mystique - 26.01.2014, 16:06
Re: New SA-MP callbacks! - by Abagail - 26.01.2014, 16:06
Re: New SA-MP callbacks! - by iZN - 26.01.2014, 16:34
Re: New SA-MP callbacks! - by Niko_boy - 26.01.2014, 16:34
Re: New SA-MP callbacks! - by Jimmy0wns - 26.01.2014, 16:34
Re: New SA-MP callbacks! - by Ryan_Bowe - 26.01.2014, 16:41
Re: New SA-MP callbacks! - by PT - 26.01.2014, 16:52
Re: New SA-MP callbacks! - by Jimmy0wns - 26.01.2014, 16:53
Re: New SA-MP callbacks! - by QuaTTrO - 26.01.2014, 17:21
Re: New SA-MP callbacks! - by Luis- - 26.01.2014, 17:49
Re: New SA-MP callbacks! - by QuaTTrO - 26.01.2014, 17:51
Re: New SA-MP callbacks! - by Pottus - 26.01.2014, 17:53
Re: New SA-MP callbacks! - by Grig - 26.01.2014, 17:55
Re: New SA-MP callbacks! - by RedWingz - 26.01.2014, 18:09
Re: New SA-MP callbacks! - by Edvin - 26.01.2014, 19:14
Re: New SA-MP callbacks! - by kooltuO - 26.01.2014, 21:26
Re: New SA-MP callbacks! - by Emmet_ - 26.01.2014, 21:29
Re: New SA-MP callbacks! - by Patrick - 26.01.2014, 22:25
Re: New SA-MP callbacks! - by Lordzy - 26.01.2014, 23:09
Re: New SA-MP callbacks! - by LikeNPC - 27.01.2014, 03:16
Re: New SA-MP callbacks! - by Ballu Miaa - 27.01.2014, 03:51
Re: New SA-MP callbacks! - by Emmet_ - 27.01.2014, 08:37
Re: New SA-MP callbacks! - by Rube - 27.01.2014, 10:41
Re: New SA-MP callbacks! - by kristo - 27.01.2014, 13:47
Re: New SA-MP callbacks! - by cr33d - 27.01.2014, 14:13
Re: New SA-MP callbacks! - by EmilLykke - 27.01.2014, 14:26
Re: New SA-MP callbacks! - by kooltuO - 28.01.2014, 12:15
Re: New SA-MP callbacks! - by cr33d - 28.01.2014, 18:57
Re: New SA-MP callbacks! - by Emmet_ - 28.01.2014, 19:53
Re: New SA-MP callbacks! - by kN1GhT - 29.01.2014, 09:21
Re: New SA-MP callbacks! - by cr33d - 29.01.2014, 10:21
Re: New SA-MP callbacks! - by Optimus_Sprite - 29.01.2014, 11:55
Re: New SA-MP callbacks! - by Luis- - 29.01.2014, 12:12
Re: New SA-MP callbacks! - by Emmet_ - 29.01.2014, 12:32
Re: New SA-MP callbacks! - by Luis- - 29.01.2014, 12:37
Re: New SA-MP callbacks! - by im - 29.01.2014, 12:49
Re: New SA-MP callbacks! - by xF4Life - 29.01.2014, 21:35
Re: New SA-MP callbacks! - by Emmet_ - 31.01.2014, 20:45
Re: New SA-MP callbacks! - by PT - 01.02.2014, 17:45
Re: New SA-MP callbacks! - by TheFlyer - 01.02.2014, 19:01
Re: New SA-MP callbacks! - by Optimus_Sprite - 02.02.2014, 08:31
Re: New SA-MP callbacks! - by Emmet_ - 02.02.2014, 15:07
Re: New SA-MP callbacks! - by PT - 02.02.2014, 15:41
Re: New SA-MP callbacks! - by Konstantinos - 02.02.2014, 15:45
Re: New SA-MP callbacks! - by DaniceMcHarley - 02.02.2014, 15:57
Re: New SA-MP callbacks! - by Emmet_ - 03.02.2014, 04:07
Re: New SA-MP callbacks! - by GiamPy. - 03.02.2014, 20:55
Re: New SA-MP callbacks! - by Abagail - 09.02.2014, 00:06
Re: New SA-MP callbacks! - by iBeast - 12.02.2014, 09:14
Re: New SA-MP callbacks! - by Emmet_ - 12.02.2014, 09:27
Re: New SA-MP callbacks! - by iBeast - 12.02.2014, 12:22
Re: New SA-MP callbacks! - by Rube - 12.02.2014, 13:15
Re: New SA-MP callbacks! - by Fornew - 12.02.2014, 14:04
Re: New SA-MP callbacks! - by Duke24 - 12.02.2014, 14:14
Re: New SA-MP callbacks! - by Translator - 12.02.2014, 14:21
Re: New SA-MP callbacks! - by Patrick_ - 13.02.2014, 17:08
Re: New SA-MP callbacks! - by Riddick94 - 16.05.2014, 13:41
Re: New SA-MP callbacks! - by Lordzy - 16.05.2014, 13:58
Re: New SA-MP callbacks! - by Emmet_ - 16.05.2014, 19:40
Re: New SA-MP callbacks! - by Riddick94 - 16.05.2014, 22:53
Re : New SA-MP callbacks! - by mirou123 - 17.05.2014, 12:08
Re: Re : New SA-MP callbacks! - by Emmet_ - 17.05.2014, 12:45
Re : Re: Re : New SA-MP callbacks! - by mirou123 - 17.05.2014, 16:55
Re: New SA-MP callbacks! - by iFarbod - 20.05.2014, 08:49
Re: New SA-MP callbacks! - by GeekSiMo - 24.05.2014, 19:04
Re: New SA-MP callbacks! - by Kemtor - 25.05.2014, 13:17
Re: New SA-MP callbacks! - by carl0o0s - 28.05.2014, 10:45
Re: New SA-MP callbacks! - by iFiras - 28.05.2014, 10:51
Re: New SA-MP callbacks! - by DamonD - 31.05.2014, 12:45
Re: New SA-MP callbacks! - by Abagail - 31.05.2014, 23:58
Re: New SA-MP callbacks! - by Translator - 01.06.2014, 10:00
Re: New SA-MP callbacks! - by Emmet_ - 01.06.2014, 12:40
Re: New SA-MP callbacks! - by Inn0cent - 01.06.2014, 17:52
Re: New SA-MP callbacks! - by Luis- - 01.06.2014, 22:01
Re: New SA-MP callbacks! - by Emmet_ - 02.06.2014, 03:04
Re: New SA-MP callbacks! - by Translator - 02.06.2014, 13:06
Re: New SA-MP callbacks! - by Luis- - 02.06.2014, 13:31
Re : New SA-MP callbacks! - by S4t3K - 02.06.2014, 17:26
Re: Re : New SA-MP callbacks! - by Patrick - 02.06.2014, 17:46
Re : New SA-MP callbacks! - by S4t3K - 02.06.2014, 18:09
Respuesta: New SA-MP callbacks! - by Swedky - 03.06.2014, 16:38
Re: New SA-MP callbacks! - by Parallex - 06.06.2014, 08:26
Re: New SA-MP callbacks! - by PT - 06.06.2014, 08:32
Re: New SA-MP callbacks! - by fordawinzz - 06.06.2014, 11:16
Re: New SA-MP callbacks! - by maximthepain - 23.07.2014, 18:47
Re: New SA-MP callbacks! - by Twizted - 23.07.2014, 20:12
Re: New SA-MP callbacks! - by gicu - 15.08.2014, 06:02
Re: New SA-MP callbacks! - by Team_PRO - 15.08.2014, 06:40
Re: New SA-MP callbacks! - by kristo - 15.08.2014, 08:07
Re: New SA-MP callbacks! - by Rudy_ - 19.08.2014, 19:05
AW: New SA-MP callbacks! - by Nils94 - 24.08.2014, 23:20
Re: AW: New SA-MP callbacks! - by Emmet_ - 25.08.2014, 01:36
Re: AW: New SA-MP callbacks! - by Ryan_Bowe - 25.08.2014, 01:40
AW: New SA-MP callbacks! - by Azure - 06.09.2014, 10:31
Re: New SA-MP callbacks! - by Emmet_ - 08.09.2014, 03:02
Re: New SA-MP callbacks! - by Unknown1234 - 29.09.2014, 10:10
Re: New SA-MP callbacks! - by Emmet_ - 30.09.2014, 11:14
Re: New SA-MP callbacks! - by GwENiko - 30.09.2014, 17:00
Re: New SA-MP callbacks! - by Rudy_ - 30.09.2014, 17:05
Re: New SA-MP callbacks! - by Unknown1234 - 30.09.2014, 19:34
Re: New SA-MP callbacks! - by GwENiko - 30.09.2014, 20:06
Re: New SA-MP callbacks! - by Emmet_ - 30.09.2014, 20:18
Re: New SA-MP callbacks! - by GwENiko - 30.09.2014, 20:59
Re: New SA-MP callbacks! - by Emmet_ - 30.09.2014, 21:17
Re: New SA-MP callbacks! - by GwENiko - 30.09.2014, 21:50
Re: New SA-MP callbacks! - by Emmet_ - 30.09.2014, 21:52
Re: New SA-MP callbacks! - by GwENiko - 30.09.2014, 22:37
Re: New SA-MP callbacks! - by SWGamer - 01.10.2014, 11:53
Re: New SA-MP callbacks! - by Emmet_ - 01.10.2014, 19:49
Re: New SA-MP callbacks! - by Evocator - 01.10.2014, 20:36
Re: New SA-MP callbacks! - by Abagail - 01.10.2014, 20:45
Re: New SA-MP callbacks! - by Rudy_ - 02.10.2014, 07:47
Re: New SA-MP callbacks! - by Emmet_ - 02.10.2014, 07:51
Re: New SA-MP callbacks! - by SWGamer - 02.10.2014, 11:14
Re: New SA-MP callbacks! - by gurmani11 - 02.10.2014, 11:26
Re: New SA-MP callbacks! - by Emmet_ - 02.10.2014, 12:21
Re: New SA-MP callbacks! - by PMH - 02.10.2014, 12:41
Re: New SA-MP callbacks! - by Emmet_ - 02.10.2014, 12:46
Re: New SA-MP callbacks! - by Rudy_ - 02.10.2014, 18:04
Re: New SA-MP callbacks! - by Evocator - 02.10.2014, 18:25
Re: New SA-MP callbacks! - by Rudy_ - 02.10.2014, 18:26
Re: New SA-MP callbacks! - by Emmet_ - 03.10.2014, 00:13
Re: New SA-MP callbacks! - by Emmet_ - 10.12.2014, 07:10
Re: New SA-MP callbacks! - by Lordzy - 31.12.2014, 12:58
Re: New SA-MP callbacks! - by Emmet_ - 10.02.2015, 00:46
Re: New SA-MP callbacks! - by Luis- - 10.02.2015, 02:24
Re: New SA-MP callbacks! - by Emmet_ - 13.03.2015, 09:18
Re: New SA-MP callbacks! - by Sellize - 13.03.2015, 09:43
Re: New SA-MP callbacks! - by vannesenn - 13.03.2015, 23:16
Re: New SA-MP callbacks! - by Emmet_ - 16.03.2015, 10:31
Re: New SA-MP callbacks! - by Nabster - 21.03.2015, 16:43
Re: New SA-MP callbacks! - by Emmet_ - 21.03.2015, 16:48
Re: New SA-MP callbacks! - by ToiletDuck - 21.04.2015, 05:34
Re: New SA-MP callbacks! - by N0FeaR - 14.12.2015, 15:04
Re: New SA-MP callbacks! - by blackhawk871 - 16.12.2015, 10:20
Re: New SA-MP callbacks! - by Lucky13 - 24.01.2016, 23:09
Re: New SA-MP callbacks! - by Hellman92 - 20.02.2016, 09:09
Re: New SA-MP callbacks! - by SyS - 20.02.2016, 09:16
Re: New SA-MP callbacks! - by vannesenn - 21.02.2016, 12:06
Re: New SA-MP callbacks! - by Emmet_ - 25.02.2016, 14:09
Re: New SA-MP callbacks! - by Max_Andolini - 25.02.2016, 16:11
Re: New SA-MP callbacks! - by katumas - 25.02.2016, 18:02
Re: New SA-MP callbacks! - by katumas - 26.02.2016, 22:04
Re: New SA-MP callbacks! - by Kar - 28.02.2016, 21:30
Re: New SA-MP callbacks! - by Emmet_ - 29.02.2016, 01:06
Re: New SA-MP callbacks! - by Rocket16 - 29.02.2016, 02:07
Re: New SA-MP callbacks! - by Emmet_ - 29.02.2016, 03:57
Re: New SA-MP callbacks! - by ]Rafaellos[ - 29.02.2016, 05:13
Re: New SA-MP callbacks! - by Emmet_ - 29.02.2016, 05:44
Re: New SA-MP callbacks! - by JokeyL - 29.02.2016, 07:46
Re: New SA-MP callbacks! - by FreAkeD - 29.02.2016, 08:50
Re: New SA-MP callbacks! - by itsCody - 02.03.2016, 03:44
Re: New SA-MP callbacks! - by Crayder - 02.03.2016, 04:21
Re: New SA-MP callbacks! - by vannesenn - 20.05.2016, 17:56
Re: New SA-MP callbacks! - by Donboo - 17.07.2016, 22:28
Re: New SA-MP callbacks! - by Logic_ - 18.07.2016, 06:55
Re: New SA-MP callbacks! - by DRIFT_HUNTER - 18.07.2016, 07:13
Re: New SA-MP callbacks! - by Logic_ - 18.07.2016, 07:18
Re: New SA-MP callbacks! - by iKarim - 18.07.2016, 07:31
Re: New SA-MP callbacks! - by Logic_ - 18.07.2016, 07:36
Re: New SA-MP callbacks! - by iKarim - 18.07.2016, 07:41
Re: New SA-MP callbacks! - by DRIFT_HUNTER - 18.07.2016, 11:36
Re: New SA-MP callbacks! - by Logic_ - 18.07.2016, 13:03
Re: New SA-MP callbacks! - by rt-2 - 29.03.2017, 00:27
Re: New SA-MP callbacks! - by Zorono - 24.05.2017, 17:01
Respuesta: Re: New SA-MP callbacks! - by Eistein - 24.05.2017, 17:41
Re: Respuesta: Re: New SA-MP callbacks! - by Zorono - 24.05.2017, 17:44
Re: New SA-MP callbacks! - by RxErT - 24.05.2017, 18:33
Re: New SA-MP callbacks! - by Zorono - 24.05.2017, 18:41
Re: New SA-MP callbacks! - by RxErT - 24.05.2017, 19:10
Re: New SA-MP callbacks! - by DRIFT_HUNTER - 24.05.2017, 21:48
Re: New SA-MP callbacks! - by Zorono - 24.05.2017, 22:38
Re: Respuesta: Re: New SA-MP callbacks! - by rt-2 - 25.05.2017, 04:09
Re: New SA-MP callbacks! - by RxErT - 25.05.2017, 07:29

Forum Jump:


Users browsing this thread: 4 Guest(s)