Scripting Callbacks
From SA-MP
[edit]
OnGameModeInit
No parameters.
[edit]
OnGameModeExit
No parameters.
[edit]
OnFilterScriptInit
No parameters.
[edit]
OnFilterScriptExit
No parameters.
[edit]
OnPlayerConnect
(playerid)
| playerid | ID of player connecting. |
Tutorial to make Join & Leave messages: http://wiki.sa-mp.com/index.php/Creating_Join_and_Leave_Messages
[edit]
OnPlayerDisconnect
(playerid, reason)
| playerid | ID of player disconnecting. |
Tutorial to make Join & Leave messages: http://wiki.sa-mp.com/index.php/Creating_Join_and_Leave_Messages
[edit]
OnPlayerSpawn
(playerid)
| playerid | ID of player spawning. |
[edit]
OnPlayerDeath
(playerid, killerid, reason)
| playerid | ID of player who died. |
| killer | ID of person who killed playerid. INVALID_PLAYER_ID if the player committed suicide. |
| reason | Unique ID specifying how the player died. Listed on WeaponID. |
[edit]
OnVehicleSpawn
(vehicleid)
| vehicleid | ID of vehicle spawning |
[edit]
OnVehicleDeath
(vehicleid, killerid)
| vehicleid | ID of vehicle which was destroyed |
| killerid | ID of the killer |
[edit]
OnPlayerText
(playerid, text[])
| playerid | ID of player talking |
| text[] | Text which player sent. |
Return 0 to stop processing (i.e. mute the player)
[edit]
OnPlayerCommandText
(playerid, cmdtext[])
| playerid | ID of player who sent command. |
| cmdtext[] | Command text. |
Return 1 if the command has successfully processed. Returning 0 will result in a "SERVER: Unknown Command."-Message.
Notes: This function is called when a player types a message beginning with a forward slash (/).
[edit]
OnPlayerInfoChange
(playerid)
| playerid | ID of player whose info changed |
[edit]
OnPlayerRequestClass
(playerid, classid)
| playerid | ID of player whose requested the class. |
| classid | ID of class which player requested. |
[edit]
OnPlayerEnterVehicle
(playerid, vehicleid, ispassenger)
| playerid | ID of player who entered the vehicle. |
| vehicleid | Vehicle ID which player entered. |
| ispassenger | Boolean or numeric variable indicating if the user is a passenger or driver. 1/True indicates passenger, and 0/False indicates driver. |
[edit]
OnPlayerExitVehicle
(playerid, vehicleid)
| playerid | ID of player who exited the vehicle. |
| vehicleid | Vehicle ID which player exited. |
[edit]
OnPlayerStateChange
(playerid, newstate, oldstate)
| playerid | ID of player whose state changed. |
| newstate | The new state ID. |
| oldstate | The old state ID. |
States - PLAYER_STATE_DRIVER, PLAYER_STATE_ONFOOT,...
Notes: States are detemined by what the player is currently doing, for example: Loading, walking, driving, etc.
[edit]
OnPlayerEnterCheckpoint
(playerid)
| playerid | ID of player who entered a checkpoint. |
[edit]
OnPlayerLeaveCheckpoint
(playerid)
| playerid | ID of player who left a checkpoint. |
[edit]
OnPlayerEnterRaceCheckpoint
(playerid)
| playerid | ID of player who entered a race checkpoint. |
[edit]
OnPlayerLeaveRaceCheckpoint
(playerid)
| playerid | ID of player who left a race checkpoint. |
[edit]
OnRconCommand
(cmd[])
| cmd | The command sent via rcon. |
[edit]
OnPlayerPrivmsg
(playerid, recieverid, text[])
| playerid | ID of player who sent the private message. |
| recieverid | ID of player the private message was sent to. |
| text | The message that was inside the private message. |
[edit]
OnPlayerRequestSpawn
(playerid)
| playerid | The ID of the player requesting to spawn. |
[edit]
OnObjectMoved
(objectid)
| objectid | ID of an object which has reached its target position given by MoveObject. |
[edit]
OnPlayerObjectMoved
(playerid, objectid)
| playerid | The playerid the object is associated with |
| objectid | Called when an object has reached its target position given by MoveObject. |
[edit]
OnPlayerPickUpPickup
(playerid, pickupid)
| playerid | ID of the player who picked up something. |
| pickupid | ID of the pickup. |
[edit]
OnVehiclePaintjob
(vehicleid, paintjobid)
| vehicleid | ID of the vehicle which has been painted. |
| paintjobid | ID of the paintjob the user has applied. (0-5) |
[edit]
OnVehicleRespray
(vehicleid, color1, color2)
| vehicleid | ID of the vehicle which has been resprayed. |
| color1 | Primary Color |
| color2 | Secondary Color |
See Color Chart.
[edit]
OnVehicleMod
(vehicleid, componentid)
| vehicleid | ID of the vehicle which has been painted. |
| componentid | ID of the component which has been applied. |
[edit]
OnPlayerSelectedMenuRow
(playerid, row)
| playerid | The player who selected something. |
| row | The row in the menu the player selected. First row is 0. |
Notes: Never forget to check which menu is currently displayed using GetPlayerMenu.
[edit]
OnPlayerExitedMenu
(playerid)
| playerid | ID of the player who cancelled the menu without selecting anything. |
[edit]
OnPlayerInteriorChange
(playerid, newinteriorid, oldinteriorid)
| playerid | ID of the player who changed Interior. |
| newinteriorid | The ID of the interior the player has changed to. |
| oldinteriorid | The ID of the interior the player comes from. |
[edit]
OnPlayerKeyStateChange
(playerid, newkeys, oldkeys)
| playerid | ID of the player who pressed a key. |
| newkeys | The sum of the IDs of keys currently pressed - see here. |
| oldkeys | The sum of the IDs of keys last pressed - see here. |
