GetPlayerDrunkLevel
From SA-MP Wiki
(Difference between revisions)
Revision as of 21:40, 10 February 2013 Smithy (Talk | contribs) (Revert - I made a mistake D:) ← Previous diff |
Current revision Connor Mead (Talk | contribs) |
||
Line 1: | Line 1: | ||
{{Scripting}} | {{Scripting}} | ||
- | {{Title}} | ||
{{0.3Added|function|}} | {{0.3Added|function|}} | ||
Line 29: | Line 28: | ||
[[Category:Scripting Functions]] | [[Category:Scripting Functions]] | ||
+ | [[fr:GetPlayerDrunkLevel]] | ||
[[nl:GetPlayerDrunkLevel]] | [[nl:GetPlayerDrunkLevel]] |
Current revision
Description:
Checks the player's level of drunkenness. If the level is less than 2000, the player is sober. The player's level of drunkness goes down slowly automatically (26 levels per second) but will always reach 2000 at the end (in 0.3b it will stop at zero). The higher drunkenness levels affect the player's camera, and the car driving handling. The level of drunkenness increases when the player drinks from a bottle (You can use SetPlayerSpecialAction to give them bottles).
(playerid)
playerid | The player you want to check the drunkenness level of. |
Return Values:
An integer with the level of drunkenness of the player.
public OnPlayerStateChange(playerid, oldstate, newstate) { if(newstate == PLAYER_STATE_DRIVER && GetPlayerDrunkLevel(playerid) > 1999) { SendClientMessage(playerid,0xFFFFFFFF,"Don't drink and drive!"); RemovePlayerFromVehicle(playerid); } }
TIP: You can use ApplyAnimation to apply a drunk animation.
[edit]
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- SetPlayerDrunkLevel: Set a player's drunk level.