OnPlayerStateChange
From SA-MP Wiki
(Difference between revisions)
Revision as of 12:50, 24 January 2014 Smithy (Talk | contribs) ← Previous diff |
Revision as of 22:17, 31 January 2014 Connor Mead (Talk | contribs) Next diff → |
||
Line 31: | Line 31: | ||
[[Category:Scripting Callbacks]] | [[Category:Scripting Callbacks]] | ||
+ | |||
+ | [[fr:OnPlayerStateChange]] |
Revision as of 22:17, 31 January 2014
Description:
This callback is called when a player changes state.
(playerid, newstate, oldstate)
playerid | The ID of the player that changed state. |
newstate | The player's new state. |
oldstate | The player's previous state. |
Return Values:
This callback does not handle returns.
public OnPlayerStateChange(playerid, newstate, oldstate) { if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver { new vehicleid = GetPlayerVehicleID(playerid); AddVehicleComponent(vehicleid, 1010); // Add NOS to the vehicle } return 1; }
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnPlayerInteriorChange: Called when a player changes interior.
Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- GetPlayerState: Get a player's current state.
- GetPlayerSpecialAction: Get a player's current special action.
- SetPlayerSpecialAction: Set a player's special action.