boxing bug fixes
This commit is contained in:
parent
c2bde742c2
commit
05ac015a11
@ -14202,6 +14202,7 @@ CMD:c4( playerid, params[ ] )
|
|||||||
if ( IsPlayerCuffed( playerid ) ) return SendError( playerid, "You cannot use this command since you're cuffed." );
|
if ( IsPlayerCuffed( playerid ) ) return SendError( playerid, "You cannot use this command since you're cuffed." );
|
||||||
if ( IsPlayerTied( playerid ) ) return SendError( playerid, "You cannot use this command since you're tied." );
|
if ( IsPlayerTied( playerid ) ) return SendError( playerid, "You cannot use this command since you're tied." );
|
||||||
if ( IsPlayerKidnapped( playerid ) ) return SendError( playerid, "You cannot use this command since you're kidnapped." );
|
if ( IsPlayerKidnapped( playerid ) ) return SendError( playerid, "You cannot use this command since you're kidnapped." );
|
||||||
|
if ( IsPlayerInCasino( playerid ) ) return SendError( playerid, "You cannot use this command since you're in a casino." );
|
||||||
if ( IsPlayerInPaintBall( playerid ) ) return SendError( playerid, "You cannot use this command since you're in paintball." );
|
if ( IsPlayerInPaintBall( playerid ) ) return SendError( playerid, "You cannot use this command since you're in paintball." );
|
||||||
if ( p_C4Amount[ playerid ] < 1 ) return SendError( playerid, "You don't have any C4's" );
|
if ( p_C4Amount[ playerid ] < 1 ) return SendError( playerid, "You don't have any C4's" );
|
||||||
|
|
||||||
@ -30783,6 +30784,7 @@ stock CreateLoopingAnimation( playerid, animlib[ ], animname[ ], Float:Speed, lo
|
|||||||
else if ( IsPlayerPlayingPoker( playerid ) ) return SendError( playerid, "You cannot use this command since you're playing poker." );
|
else if ( IsPlayerPlayingPoker( playerid ) ) return SendError( playerid, "You cannot use this command since you're playing poker." );
|
||||||
else if ( IsPlayerInWater( playerid ) ) return SendError( playerid, "You cannot use this command since you're in water." );
|
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 ( 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 ( 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 ( 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 ( IsPlayerAttachedObjectSlotUsed( playerid, 0 ) ) return SendError( playerid, "You cannot use this command since you're robbing." );
|
||||||
|
@ -62,9 +62,17 @@ hook OnPlayerConnect( playerid ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hook OnPlayerDisconnect( playerid, reason ) {
|
hook OnPlayerDisconnect( playerid, reason ) {
|
||||||
if ( g_boxingPlayerData[ playerid ] [ E_FIGHTING ] ) {
|
|
||||||
boxing_ForfeitMatch( playerid, g_boxingPlayerData[ playerid ] [ E_OPPONENT ] );
|
boxing_ForfeitMatch( playerid, g_boxingPlayerData[ playerid ] [ E_OPPONENT ] );
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined AC_INCLUDED
|
||||||
|
hook OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart )
|
||||||
|
#else
|
||||||
|
hook OnPlayerDeath( playerid, killerid, reason )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
boxing_ForfeitMatch( playerid, g_boxingPlayerData[ playerid ] [ E_OPPONENT ] );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,13 +232,10 @@ CMD:boxing( playerid, params[ ] ) {
|
|||||||
return ResetBoxingPlayerVariables( playerid, opponent );
|
return ResetBoxingPlayerVariables( playerid, opponent );
|
||||||
|
|
||||||
} else if ( !strcmp( params, "forfeit", true, 7 ) ) {
|
} else if ( !strcmp( params, "forfeit", true, 7 ) ) {
|
||||||
|
if ( ! boxing_ForfeitMatch( playerid, g_boxingPlayerData[ playerid ] [ E_OPPONENT ] ) ) {
|
||||||
new opponent = g_boxingPlayerData[ playerid ] [ E_OPPONENT ];
|
|
||||||
|
|
||||||
if ( g_boxingPlayerData[ playerid ] [ E_FIGHTING ] == false )
|
|
||||||
return SendError( playerid, "You're not fighting anyone." );
|
return SendError( playerid, "You're not fighting anyone." );
|
||||||
|
}
|
||||||
return boxing_ForfeitMatch( playerid, opponent );
|
return 1;
|
||||||
}
|
}
|
||||||
return SendUsage( playerid, "/boxing [FIGHT/CANCEL/ACCEPT/DECLINE/FORFEIT]" );
|
return SendUsage( playerid, "/boxing [FIGHT/CANCEL/ACCEPT/DECLINE/FORFEIT]" );
|
||||||
}
|
}
|
||||||
@ -305,7 +310,7 @@ stock EndMatch( playerid, targetID ) {
|
|||||||
if ( g_boxingArenaData[ E_BET ] <= 0 ) {
|
if ( g_boxingArenaData[ E_BET ] <= 0 ) {
|
||||||
SendBoxingGlobal( "%s has won a boxing match against %s with a final score of %i!", ReturnPlayerName( winnerid ), ReturnPlayerName( loserid ), g_boxingPlayerData[ winnerid ] [ E_SCORE ] );
|
SendBoxingGlobal( "%s has won a boxing match against %s with a final score of %i!", ReturnPlayerName( winnerid ), ReturnPlayerName( loserid ), g_boxingPlayerData[ winnerid ] [ E_SCORE ] );
|
||||||
} else {
|
} else {
|
||||||
new winning_prize = floatround( float( g_boxingArenaData[ E_BET ] ) * 1.8 ); // We take 10% of the total pot
|
new winning_prize = floatround( float( g_boxingArenaData[ E_BET ] ) * 1.9 ); // We take 5% of the total pot
|
||||||
GivePlayerCash( winnerid, winning_prize );
|
GivePlayerCash( winnerid, winning_prize );
|
||||||
SendBoxingGlobal( "%s has won a boxing match against %s for %s with a final score of %i!", ReturnPlayerName( winnerid ), ReturnPlayerName( loserid ), number_format( g_boxingArenaData[ E_BET ] ), g_boxingPlayerData[ winnerid ] [ E_SCORE ] );
|
SendBoxingGlobal( "%s has won a boxing match against %s for %s with a final score of %i!", ReturnPlayerName( winnerid ), ReturnPlayerName( loserid ), number_format( g_boxingArenaData[ E_BET ] ), g_boxingPlayerData[ winnerid ] [ E_SCORE ] );
|
||||||
}
|
}
|
||||||
@ -324,6 +329,11 @@ stock EndMatch( playerid, targetID ) {
|
|||||||
|
|
||||||
stock boxing_RestorePlayer( playerid )
|
stock boxing_RestorePlayer( playerid )
|
||||||
{
|
{
|
||||||
|
// user reported 0xff health, maybe spawn protection
|
||||||
|
if ( g_boxingPlayerData[ playerid ] [ E_PRIOR_HEALTH ] > 100.0 ) g_boxingPlayerData[ playerid ] [ E_PRIOR_HEALTH ] = 100.0;
|
||||||
|
if ( g_boxingPlayerData[ playerid ] [ E_PRIOR_ARMOUR ] > 100.0 ) g_boxingPlayerData[ playerid ] [ E_PRIOR_ARMOUR ] = 100.0;
|
||||||
|
|
||||||
|
// set prior health
|
||||||
SetPlayerHealth( playerid, g_boxingPlayerData[ playerid ] [ E_PRIOR_HEALTH ] );
|
SetPlayerHealth( playerid, g_boxingPlayerData[ playerid ] [ E_PRIOR_HEALTH ] );
|
||||||
SetPlayerArmour( playerid, g_boxingPlayerData[ playerid ] [ E_PRIOR_ARMOUR ] );
|
SetPlayerArmour( playerid, g_boxingPlayerData[ playerid ] [ E_PRIOR_ARMOUR ] );
|
||||||
SetPlayerSkin( playerid, g_boxingPlayerData[ playerid ] [ E_PRIOR_SKIN ] );
|
SetPlayerSkin( playerid, g_boxingPlayerData[ playerid ] [ E_PRIOR_SKIN ] );
|
||||||
@ -335,6 +345,8 @@ stock boxing_RestorePlayer( playerid )
|
|||||||
}
|
}
|
||||||
|
|
||||||
stock boxing_ForfeitMatch( playerid, targetID ) {
|
stock boxing_ForfeitMatch( playerid, targetID ) {
|
||||||
|
if ( ! g_boxingPlayerData[ playerid ] [ E_FIGHTING ] ) return 0;
|
||||||
|
|
||||||
if ( g_boxingArenaData[ E_BET ] == 0 ) {
|
if ( g_boxingArenaData[ E_BET ] == 0 ) {
|
||||||
SendBoxingGlobal( "%s has won a boxing match by forfeit against %s.", ReturnPlayerName( targetID ), ReturnPlayerName( playerid ) );
|
SendBoxingGlobal( "%s has won a boxing match by forfeit against %s.", ReturnPlayerName( targetID ), ReturnPlayerName( playerid ) );
|
||||||
} else if ( g_boxingArenaData[ E_BET ] > 0 ) {
|
} else if ( g_boxingArenaData[ E_BET ] > 0 ) {
|
||||||
@ -352,7 +364,6 @@ stock boxing_ForfeitMatch( playerid, targetID ) {
|
|||||||
|
|
||||||
ResetBoxingArenaVariables();
|
ResetBoxingArenaVariables();
|
||||||
ResetBoxingPlayerVariables( playerid, targetID );
|
ResetBoxingPlayerVariables( playerid, targetID );
|
||||||
|
|
||||||
UpdateDynamic3DTextLabelText( arenaLabel, COLOR_GREY, "Boxing Arena\n"COL_WHITE"/boxing fight" );
|
UpdateDynamic3DTextLabelText( arenaLabel, COLOR_GREY, "Boxing Arena\n"COL_WHITE"/boxing fight" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user