introduce OnPlayerFirstSpawn( p ), OnPlayerMoveMode( p, t ) ... move animation to /features/animations.pwn

This commit is contained in:
Lorenc Pekaj 2018-09-26 14:04:39 +10:00
parent b1ed0babba
commit 4bf6b8f33e
8 changed files with 163 additions and 155 deletions

View File

@ -26,3 +26,9 @@
- Called when a player successfully logs into their account
- `OnHouseOwnerChange( houseid, ownerid )`
- Called when the ownership of a home is changed
- `OnPlayerFirstSpawn( playerid )`
- Called when a player spawns for the first time
- `OnPlayerMovieMode( playerid, toggled )`
- Called when player toggles movie mode

View File

@ -19,7 +19,6 @@
#include "irresistible\cnr\ammunation.pwn"
#include "irresistible\cnr\irresistibleguard.pwn"
#include "irresistible\cnr\player_settings.pwn"
#include "irresistible\cnr\animation.pwn"
// static cnr features
#include "irresistible\cnr\static\_cnr_static.pwn"

View File

@ -25,6 +25,7 @@
#include "irresistible\cnr\features\random_messages.pwn"
#include "irresistible\cnr\features\chuffsec.pwn"
#include "irresistible\cnr\features\gps.pwn"
#include "irresistible\cnr\features\animations.pwn"
// #include "irresistible\cnr\features\pilot.pwn"
// #include "irresistible\cnr\features\fishing.pwn"
// #include "irresistible\cnr\features\vote.pwn"

View File

@ -1,6 +1,6 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Steven Howard
* Developed by Lorenc Pekaj, Steven Howard
* Module: cnr/features/animation.pwn
* Purpose: all animation and/or action commands
*/
@ -8,48 +8,91 @@
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Macros ** */
#define PreloadAnimationLibrary(%0,%1) \
ApplyAnimation( %0, %1, "null", 0.0, 0, 0, 0, 0, 0 )
/* ** Variables ** */
static stock
Text: g_AnimationTD = Text: INVALID_TEXT_DRAW,
bool: p_InAnimation [ MAX_PLAYERS char ]
;
/* ** Hooks ** */
hook OnPlayerConnect( playerid )
hook OnScriptInit( )
{
PreloadAnimationLibrary( playerid, "MISC" );
g_AnimationTD = TextDrawCreate( 220.000000, 141.000000, "PRESS ~r~~h~~k~~PED_SPRINT~~W~ TO STOP THE ANIMATION" );
TextDrawBackgroundColor( g_AnimationTD, 80 );
TextDrawFont( g_AnimationTD, 3 );
TextDrawLetterSize( g_AnimationTD, 0.310000, 1.200000 );
TextDrawColor( g_AnimationTD, -1 );
TextDrawSetOutline( g_AnimationTD, 1 );
TextDrawSetProportional( g_AnimationTD, 1 );
TextDrawUseBox( g_AnimationTD, 1 );
TextDrawBoxColor( g_AnimationTD, 117 );
TextDrawTextSize( g_AnimationTD, 418.000000, 0.000000 );
return 1;
}
hook OnPlayerSpawn( playerid )
hook OnPlayerDisconnect( playerid, reason )
{
if ( justConnected{ playerid } == true )
{
justConnected{ playerid } = false;
StopAudioStreamForPlayer( playerid );
p_InAnimation{ playerid } = false;
return 1;
}
// Preload all animations
PreloadAnimationLibrary( playerid, "DANCING" );
PreloadAnimationLibrary( playerid, "PED" );
PreloadAnimationLibrary( playerid, "PAULNMAC" );
PreloadAnimationLibrary( playerid, "INT_OFFICE" );
PreloadAnimationLibrary( playerid, "BEACH" );
PreloadAnimationLibrary( playerid, "SWEET" );
PreloadAnimationLibrary( playerid, "SNM" );
PreloadAnimationLibrary( playerid, "COP_AMBIENT" );
PreloadAnimationLibrary( playerid, "ON_LOOKERS" );
PreloadAnimationLibrary( playerid, "SHOP" );
PreloadAnimationLibrary( playerid, "RAPPING" );
PreloadAnimationLibrary( playerid, "DEALER" );
PreloadAnimationLibrary( playerid, "STRIP" );
PreloadAnimationLibrary( playerid, "RIOT" );
PreloadAnimationLibrary( playerid, "BLOWJOBZ" );
PreloadAnimationLibrary( playerid, "CRACK" );
PreloadAnimationLibrary( playerid, "GYMNASIUM" );
PreloadAnimationLibrary( playerid, "ROB_BANK" );
PreloadAnimationLibrary( playerid, "BOMBER" );
PreloadAnimationLibrary( playerid, "CARRY" );
PreloadAnimationLibrary( playerid, "VENDING" );
PreloadAnimationLibrary( playerid, "CASINO" );
PreloadAnimationLibrary( playerid, "GANGS" );
PreloadAnimationLibrary( playerid, "INT_HOUSE" );
#if defined AC_INCLUDED
hook OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart )
#else
hook OnPlayerDeath( playerid, killerid, reason )
#endif
{
if ( p_InAnimation{ playerid } == true ) {
TextDrawHideForPlayer( playerid, g_AnimationTD );
p_InAnimation{ playerid } = false;
}
return 1;
}
return Y_HOOKS_CONTINUE_RETURN_1;
hook OnPlayerMovieMode( playerid, bool: toggled )
{
if ( toggled && IsPlayerUsingAnimation( playerid ) ) {
TextDrawShowForPlayer( playerid, g_AnimationTD );
} else {
TextDrawHideForPlayer( playerid, g_AnimationTD );
}
return 1;
}
hook OnPlayerFirstSpawn( playerid )
{
// Preload all animations
PreloadAnimationLibrary( playerid, "DANCING" );
PreloadAnimationLibrary( playerid, "PED" );
PreloadAnimationLibrary( playerid, "PAULNMAC" );
PreloadAnimationLibrary( playerid, "INT_OFFICE" );
PreloadAnimationLibrary( playerid, "BEACH" );
PreloadAnimationLibrary( playerid, "SWEET" );
PreloadAnimationLibrary( playerid, "SNM" );
PreloadAnimationLibrary( playerid, "COP_AMBIENT" );
PreloadAnimationLibrary( playerid, "ON_LOOKERS" );
PreloadAnimationLibrary( playerid, "SHOP" );
PreloadAnimationLibrary( playerid, "RAPPING" );
PreloadAnimationLibrary( playerid, "DEALER" );
PreloadAnimationLibrary( playerid, "STRIP" );
PreloadAnimationLibrary( playerid, "RIOT" );
PreloadAnimationLibrary( playerid, "BLOWJOBZ" );
PreloadAnimationLibrary( playerid, "CRACK" );
PreloadAnimationLibrary( playerid, "GYMNASIUM" );
PreloadAnimationLibrary( playerid, "ROB_BANK" );
PreloadAnimationLibrary( playerid, "BOMBER" );
PreloadAnimationLibrary( playerid, "CARRY" );
PreloadAnimationLibrary( playerid, "VENDING" );
PreloadAnimationLibrary( playerid, "CASINO" );
PreloadAnimationLibrary( playerid, "GANGS" );
PreloadAnimationLibrary( playerid, "INT_HOUSE" );
PreloadAnimationLibrary( playerid, "MISC" );
PreloadAnimationLibrary( playerid, "POOL" );
return 1;
}
hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
@ -67,28 +110,9 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
SetPlayerSpecialAction( playerid, 0 );
}
}
return 1;
}
/* ** Functions ** */
stock IsPlayingAnimation( playerid, library[ ], animation[ ] )
{
if ( IsPlayerConnected( playerid ) )
{
static
animlib[ 32 ], animname[ 32 ];
GetAnimationName( GetPlayerAnimationIndex( playerid ), animlib, 32, animname, 32 );
return strmatch( library, animlib ) && strmatch( animation, animname );
}
return 0;
}
stock PreloadAnimationLibrary( playerid, animlib[ ] )
return ApplyAnimation( playerid, animlib, "null", 0.0, 0, 0, 0, 0, 0 );
/* ** Commands ** */
CMD:anims( playerid, params[ ] ) return cmd_animlist( playerid, params );
CMD:animlist( playerid, params[ ] )
@ -304,3 +328,67 @@ CMD:fiddle( playerid, params[ ] )
CreateLoopingAnimation( playerid, "INT_HOUSE", "wash_up", 4.0, 1, 0, 0, 0, 0 );
return 1;
}
/* ** Functions ** */
stock CreateLoopingAnimation( playerid, animlib[ ], animname[ ], Float:Speed, looping, lockx, locky, lockz, lp, specialaction=0 )
{
if ( !IsPlayerConnected( playerid ) ) return 0;
// else if ( p_InAnimation{ playerid } ) return SendError( playerid, "You cannot use this command since you're playing an animation." );
else if ( IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You cannot use this command inside a vehicle." );
else if ( !IsPlayerSpawned( playerid ) ) return SendError( playerid, "You cannot use this command since you're not spawned." );
// else if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this command since you're jailed." );
else if ( IsPlayerTazed( playerid ) ) return SendError( playerid, "You cannot use this command since you're tazed." );
//else if ( IsPlayerDetained( playerid ) ) return SendError( playerid, "You cannot use this command since you're detained." );
else if ( IsPlayerCuffed( playerid ) ) return SendError( playerid, "You cannot use this command since you're cuffed." );
else if ( IsPlayerTied( playerid ) ) return SendError( playerid, "You cannot use this command since you're tied." );
else if ( IsPlayerKidnapped( playerid ) ) return SendError( playerid, "You cannot use this command since you're kidnapped." );
else if ( IsPlayerGettingBlowed( playerid ) ) return SendError( playerid, "You cannot use this command since you're getting blowed." );
else if ( IsPlayerBlowingCock( playerid ) ) return SendError( playerid, "You cannot use this command since you're giving oral sex." );
else if ( IsPlayerPlayingPoker( playerid ) ) return SendError( playerid, "You cannot use this command since you're playing poker." );
else if ( IsPlayerPlayingPool( playerid ) ) return SendError( playerid, "You cannot use this command since you're playing pool." );
else if ( IsPlayerInWater( playerid ) ) return SendError( playerid, "You cannot use this command since you're in water." );
else if ( IsPlayerMining( playerid ) ) return SendError( playerid, "You cannot use this command since you're mining." );
else if ( IsPlayerBoxing( playerid ) ) return SendError( playerid, "You cannot use this command since you're boxing." );
else if ( IsPlayerInEvent( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an event." );
else if ( GetPlayerAnimationIndex( playerid ) == 1660 ) return SendError( playerid, "You cannot use this command since you're using a vending machine." );
else if ( IsPlayerAttachedObjectSlotUsed( playerid, 0 ) ) return SendError( playerid, "You cannot use this command since you're robbing." );
else if ( IsPlayingAnimation( playerid, "ROB_BANK", "CAT_Safe_Rob" ) ) return SendError( playerid, "You cannot use this command since you're robbing." );
else if ( IsPlayingAnimation( playerid, "GANGS", "smkcig_prtl" ) ) return SendError( playerid, "You cannot use this command since you're smoking." );
else if ( IsPlayerAttachedObjectSlotUsed( playerid, 3 ) ) return SendError( playerid, "You cannot use this command since you're holding a stolen good." );
else if ( GetPlayerState( playerid ) == PLAYER_STATE_ENTER_VEHICLE_DRIVER || GetPlayerState( playerid ) == PLAYER_STATE_ENTER_VEHICLE_PASSENGER ) return SendError( playerid, "You cannot use this command since you're entering a vehicle." );
else if ( GetPlayerState( playerid ) == PLAYER_STATE_EXIT_VEHICLE ) return SendError( playerid, "You cannot use this command since you're exiting a vehicle." );
else
{
SetPlayerSpecialAction( playerid, 0 );
if ( specialaction == 0 ) {
ApplyAnimation( playerid, animlib, "null", 0.0, 0, 0, 0, 0, 0 );
ApplyAnimation( playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp );
} else {
SetPlayerSpecialAction( playerid, specialaction );
}
if ( looping ) // Animations that must be played once.
{
p_InAnimation{ playerid } = true;
if ( !p_inMovieMode{ playerid } ) TextDrawShowForPlayer( playerid, g_AnimationTD );
}
}
return 1;
}
stock IsPlayingAnimation( playerid, library[ ], animation[ ] )
{
if ( IsPlayerConnected( playerid ) )
{
static
animlib[ 32 ], animname[ 32 ];
GetAnimationName( GetPlayerAnimationIndex( playerid ), animlib, 32, animname, 32 );
return strmatch( library, animlib ) && strmatch( animation, animname );
}
return 0;
}
stock IsPlayerUsingAnimation( playerid ) {
return p_InAnimation{ playerid };
}

View File

@ -10,9 +10,6 @@
#include < physics >
#include < progress2 >
/* ** Marcos ** */
#define IsPlayerPlayingPool(%0) (p_isPlayingPool{%0})
/* ** Definitions ** */
#define POCKET_RADIUS 0.09
#define POOL_TIMER_SPEED 30
@ -1411,6 +1408,10 @@ stock Pool_UpdatePlayerCamera( playerid, poolid )
}
}
stock IsPlayerPlayingPool( playerid ) {
return p_isPlayingPool{ playerid };
}
/* ** Commands ** */
CMD:endgame(playerid)
{

View File

@ -12,7 +12,6 @@
#define IsPlayerKidnapped(%1) (p_Kidnapped{%1})
#define IsPlayerBlowingCock(%0) (p_GivingBlowjob{%0})
#define IsPlayerGettingBlowed(%0) (p_GettingBlowjob{%0})
#define IsPlayerMining(%0) (p_isMining{%0})
#define IsPlayerLoadingObjects(%0) (p_pausedToLoad{%0})
#define IsPlayerAdminJailed(%0) (p_AdminJailed{%0} && p_JailTime[%0])
#define GetPlayerXP(%1) (p_XP[%1])
@ -112,7 +111,6 @@ new
bool: p_AdminLog [ MAX_PLAYERS char ],
bool: p_beingSpectated [ MAX_PLAYERS ],
p_whomSpectating [ MAX_PLAYERS ],
bool: p_InAnimation [ MAX_PLAYERS char ],
p_AntiSaveStatsSpam [ MAX_PLAYERS ],
p_AntiMechFixSpam [ MAX_PLAYERS ],
p_AntiMechNosSpam [ MAX_PLAYERS ],
@ -266,3 +264,4 @@ stock IsPlayerJailed( playerid ) return p_Jailed{ playerid };
stock IsPlayerAdminOnDuty( playerid ) return p_AdminOnDuty{ playerid };
stock IsPlayerSpawnProtected( playerid ) return p_AntiSpawnKillEnabled{ playerid };

View File

@ -21,7 +21,6 @@ new
Text: g_MovieModeTD [ 6 ] = { Text: INVALID_TEXT_DRAW, ... },
Text: g_WorldDayTD = Text: INVALID_TEXT_DRAW,
Text: g_AchievementTD [ 4 ] = { Text: INVALID_TEXT_DRAW, ... },
Text: g_AnimationTD = Text: INVALID_TEXT_DRAW,
Text: g_AdminLogTD = Text: INVALID_TEXT_DRAW,
Text: g_ProgressBoxTD = Text: INVALID_TEXT_DRAW,
Text: g_AdminOnDutyTD = Text: INVALID_TEXT_DRAW,
@ -263,17 +262,6 @@ hook OnScriptInit( )
TextDrawSetOutline(g_AdminLogTD, 1);
TextDrawSetProportional(g_AdminLogTD, 1);
g_AnimationTD = TextDrawCreate(220.000000, 141.000000, "PRESS ~r~~h~~k~~PED_SPRINT~~W~ TO STOP THE ANIMATION");
TextDrawBackgroundColor(g_AnimationTD, 80);
TextDrawFont(g_AnimationTD, 3);
TextDrawLetterSize(g_AnimationTD, 0.310000, 1.200000);
TextDrawColor(g_AnimationTD, -1);
TextDrawSetOutline(g_AnimationTD, 1);
TextDrawSetProportional(g_AnimationTD, 1);
TextDrawUseBox(g_AnimationTD, 1);
TextDrawBoxColor(g_AnimationTD, 117);
TextDrawTextSize(g_AnimationTD, 418.000000, 0.000000);
g_AchievementTD[ 0 ] = TextDrawCreate(250.000000, 120.000000, "_");
TextDrawBackgroundColor(g_AchievementTD[ 0 ], 255);
TextDrawFont(g_AchievementTD[ 0 ], 1);

View File

@ -356,6 +356,8 @@ new
Iterator: miningrock< MAX_ROCKS >
;
stock IsPlayerMining( playerid ) return p_isMining{ playerid };
/* ** Weed System ** */
#define MAX_WEED_STORAGE 6
#define MAX_WEED ( 42 )
@ -3806,7 +3808,6 @@ public OnPlayerDisconnect( playerid, reason )
p_drillStrength [ playerid ] = 0;
p_RansomAmount [ playerid ] = 0;
p_RansomPlacer [ playerid ] = INVALID_PLAYER_ID;
p_InAnimation { playerid } = false;
p_LabelColor [ playerid ] = COLOR_GREY;
p_Uptime [ playerid ] = 0;
p_Muted { playerid } = false;
@ -4054,31 +4055,8 @@ public OnPlayerSpawn( playerid )
justConnected{ playerid } = false;
StopAudioStreamForPlayer( playerid );
// Preload all animations
// PreloadAnimationLibrary( playerid, "DANCING" );
// PreloadAnimationLibrary( playerid, "PED" );
// PreloadAnimationLibrary( playerid, "PAULNMAC" );
// PreloadAnimationLibrary( playerid, "INT_OFFICE" );
// PreloadAnimationLibrary( playerid, "BEACH" );
// PreloadAnimationLibrary( playerid, "SWEET" );
// PreloadAnimationLibrary( playerid, "SNM" );
// PreloadAnimationLibrary( playerid, "COP_AMBIENT" );
// PreloadAnimationLibrary( playerid, "ON_LOOKERS" );
// PreloadAnimationLibrary( playerid, "SHOP" );
// PreloadAnimationLibrary( playerid, "RAPPING" );
// PreloadAnimationLibrary( playerid, "DEALER" );
// PreloadAnimationLibrary( playerid, "STRIP" );
// PreloadAnimationLibrary( playerid, "RIOT" );
// PreloadAnimationLibrary( playerid, "BLOWJOBZ" );
// PreloadAnimationLibrary( playerid, "CRACK" );
// PreloadAnimationLibrary( playerid, "GYMNASIUM" );
// PreloadAnimationLibrary( playerid, "ROB_BANK" );
// PreloadAnimationLibrary( playerid, "BOMBER" );
// PreloadAnimationLibrary( playerid, "CARRY" );
// PreloadAnimationLibrary( playerid, "VENDING" );
// PreloadAnimationLibrary( playerid, "CASINO" );
// PreloadAnimationLibrary( playerid, "GANGS" );
// PreloadAnimationLibrary( playerid, "INT_HOUSE" );
// Callback
CallLocalFunction( "OnPlayerFirstSpawn", "d", playerid );
// Jail people that left jailed
if ( p_JailTime[ playerid ] ) // We load this when the player logs in.
@ -4900,11 +4878,6 @@ public OnPlayerDeath( playerid, killerid, reason )
HidePlayerTogglableTextdraws( playerid );
resetPlayerStreaks( playerid );
if ( p_InAnimation{ playerid } == true ) {
TextDrawHideForPlayer( playerid, g_AnimationTD );
p_InAnimation{ playerid } = false;
}
/* ** Tax And Medical Fees ** */
if ( GetPlayerTotalCash( playerid ) > 0 && ! ( IsPlayerInPaintBall( playerid ) || IsPlayerDueling( playerid ) || IsPlayerInEvent( playerid ) ) ) {
ShowPlayerHelpDialog( playerid, 5000, sprintf( "~w~You have paid ~r~$100~w~ in medical fees" ) );
@ -8321,7 +8294,6 @@ CMD:moviemode( playerid, params[ ] )
TextDrawShowForPlayer( playerid, g_CurrentRankTD );
TextDrawShowForPlayer( playerid, g_currentXPTD );
PlayerTextDrawShow( playerid, p_LocationTD[ playerid ] );
if ( p_InAnimation{ playerid } ) TextDrawShowForPlayer( playerid, g_AnimationTD );
PlayerTextDrawShow( playerid, p_ExperienceTD[ playerid ] );
if ( IsDoubleXP( ) ) TextDrawShowForPlayer( playerid, g_DoubleXPTD );
TextDrawShowForPlayer( playerid, g_WebsiteTD );
@ -8347,7 +8319,6 @@ CMD:moviemode( playerid, params[ ] )
PlayerTextDrawHide( playerid, p_ExperienceTD[ playerid ] );
PlayerTextDrawHide( playerid, p_WantedLevelTD[ playerid ] );
TextDrawHideForPlayer( playerid, g_WebsiteTD );
TextDrawHideForPlayer( playerid, g_AnimationTD );
TextDrawHideForPlayer( playerid, g_AdminOnDutyTD );
TextDrawHideForPlayer( playerid, g_DoubleXPTD );
PlayerTextDrawHide( playerid, p_PlayerRankTD[ playerid ] );
@ -8361,6 +8332,7 @@ CMD:moviemode( playerid, params[ ] )
SendServerMessage( playerid, "Movie mode has been toggled." );
}
}
CallLocalFunction( "OnPlayerMovieMode", "dd", playerid, p_inMovieMode{ playerid } );
return 1;
}
@ -11197,7 +11169,7 @@ public OnPlayerDriveVehicle( playerid, vehicleid )
iVehiclePrice
;
if ( p_InAnimation{ playerid } == true ) // cancel animations
if ( IsPlayerUsingAnimation( playerid ) ) // cancel animations
CallLocalFunction( "OnPlayerKeyStateChange", "ddd", playerid, KEY_SPRINT, KEY_SECONDARY_ATTACK );
if ( p_Cuffed{ playerid } ) {
@ -12741,7 +12713,7 @@ public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
// mining
if ( GetPlayerWeapon( playerid ) == WEAPON_SHOVEL )
{
if ( ! p_InAnimation{ playerid } && ! IsPlayerAttachedObjectSlotUsed( playerid, 4 ) && ! IsPlayerAttachedObjectSlotUsed( playerid, 3 ) )
if ( ! IsPlayerUsingAnimation( playerid ) && ! IsPlayerAttachedObjectSlotUsed( playerid, 4 ) && ! IsPlayerAttachedObjectSlotUsed( playerid, 3 ) )
{
foreach(new m : miningrock)
{
@ -20070,52 +20042,6 @@ stock CutSpectation( playerid )
return 1;
}
stock CreateLoopingAnimation( playerid, animlib[ ], animname[ ], Float:Speed, looping, lockx, locky, lockz, lp, specialaction=0 )
{
if ( !IsPlayerConnected( playerid ) ) return 0;
// else if ( p_InAnimation{ playerid } ) return SendError( playerid, "You cannot use this command since you're playing an animation." );
else if ( IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You cannot use this command inside a vehicle." );
else if ( !IsPlayerSpawned( playerid ) ) return SendError( playerid, "You cannot use this command since you're not spawned." );
// else if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this command since you're jailed." );
else if ( IsPlayerTazed( playerid ) ) return SendError( playerid, "You cannot use this command since you're tazed." );
//else if ( IsPlayerDetained( playerid ) ) return SendError( playerid, "You cannot use this command since you're detained." );
else if ( IsPlayerCuffed( playerid ) ) return SendError( playerid, "You cannot use this command since you're cuffed." );
else if ( IsPlayerTied( playerid ) ) return SendError( playerid, "You cannot use this command since you're tied." );
else if ( IsPlayerKidnapped( playerid ) ) return SendError( playerid, "You cannot use this command since you're kidnapped." );
else if ( IsPlayerGettingBlowed( playerid ) )return SendError( playerid, "You cannot use this command since you're getting blowed." );
else if ( IsPlayerBlowingCock( playerid ) ) return SendError( playerid, "You cannot use this command since you're giving oral sex." );
else if ( IsPlayerPlayingPoker( playerid ) ) return SendError( playerid, "You cannot use this command since you're playing poker." );
else if ( IsPlayerPlayingPool( playerid ) ) return SendError( playerid, "You cannot use this command since you're playing pool." );
else if ( IsPlayerInWater( playerid ) ) return SendError( playerid, "You cannot use this command since you're in water." );
else if ( IsPlayerMining( playerid ) ) return SendError( playerid, "You cannot use this command since you're mining." );
else if ( IsPlayerBoxing( playerid ) ) return SendError( playerid, "You cannot use this command since you're boxing." );
else if ( IsPlayerInEvent( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an event." );
else if ( GetPlayerAnimationIndex( playerid ) == 1660 ) return SendError( playerid, "You cannot use this command since you're using a vending machine." );
else if ( IsPlayerAttachedObjectSlotUsed( playerid, 0 ) ) return SendError( playerid, "You cannot use this command since you're robbing." );
else if ( IsPlayingAnimation( playerid, "ROB_BANK", "CAT_Safe_Rob" ) ) return SendError( playerid, "You cannot use this command since you're robbing." );
else if ( IsPlayingAnimation( playerid, "GANGS", "smkcig_prtl" ) ) return SendError( playerid, "You cannot use this command since you're smoking." );
else if ( IsPlayerAttachedObjectSlotUsed( playerid, 3 ) ) return SendError( playerid, "You cannot use this command since you're holding a stolen good." );
else if ( GetPlayerState( playerid ) == PLAYER_STATE_ENTER_VEHICLE_DRIVER || GetPlayerState( playerid ) == PLAYER_STATE_ENTER_VEHICLE_PASSENGER ) return SendError( playerid, "You cannot use this command since you're entering a vehicle." );
else if ( GetPlayerState( playerid ) == PLAYER_STATE_EXIT_VEHICLE ) return SendError( playerid, "You cannot use this command since you're exiting a vehicle." );
else
{
SetPlayerSpecialAction( playerid, 0 );
if ( specialaction == 0 ) {
ApplyAnimation( playerid, animlib, "null", 0.0, 0, 0, 0, 0, 0 );
ApplyAnimation( playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp );
} else {
SetPlayerSpecialAction( playerid, specialaction );
}
if ( looping ) // Animations that must be played once.
{
p_InAnimation{ playerid } = true;
if ( !p_inMovieMode{ playerid } ) TextDrawShowForPlayer( playerid, g_AnimationTD );
}
}
return 1;
}
stock secondstotime(seconds, const delimiter[] = ", ", start = 0, end = -1)
{
static const times[] = {
@ -21025,7 +20951,7 @@ function handlePlayerRobbery( playerid, newkeys, oldkeys )
if ( g_robberyData[ robberyid ] [ E_STATE ] ) return SendError( playerid, "This safe must be in an idle state to pick it." );
//else if ( p_UsingRobberySafe[ playerid ] != -1 ) return SendError( playerid, "You're currently working on another safe." );
else if ( g_robberyData[ robberyid ] [ E_OPEN ] ) return 1; //SendError( playerid, "This safe is open." );
else if ( p_InAnimation{ playerid } ) return 1; //SendError( playerid, "You mustn't be using an animation." );
else if ( IsPlayerUsingAnimation( playerid ) ) return 1; //SendError( playerid, "You mustn't be using an animation." );
else if ( g_robberyData[ robberyid ] [ E_ROBTIMER ] != 0xFFFF ) return SendError( playerid, "This safe is currently busy." );
else if ( p_Class[ playerid ] == CLASS_POLICE ) return SendError( playerid, "You cannot pick this safe as a law enforcement officer." );
// else if ( g_robberyData[ robberyid ] [ E_BUSINESS_ID ] != -1 && ! g_businessData[ g_robberyData[ robberyid ] [ E_BUSINESS_ID ] ] [ E_BANK ] ) return SendError( playerid, "There is nothing to rob from this business safe." );