Eases to understand the damage callback

This commit is contained in:
Cloudy 2019-05-31 17:03:29 +03:00 committed by GitHub
parent a97e30dfcc
commit 0c7fbc9af3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -996,7 +996,7 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b
{ {
if ( !IsPlayerStreamedIn( issuerid, playerid ) || IsPlayerAFK( issuerid ) ) if ( !IsPlayerStreamedIn( issuerid, playerid ) || IsPlayerAFK( issuerid ) )
return 0; return 0;
// Boxing immunity // Boxing immunity
if ( IsPlayerBoxing( playerid ) && ! IsPlayerBoxing( issuerid ) ) if ( IsPlayerBoxing( playerid ) && ! IsPlayerBoxing( issuerid ) )
return ShowPlayerHelpDialog( issuerid, 2000, "You cannot damage a boxing player!" ), 0; return ShowPlayerHelpDialog( issuerid, 2000, "You cannot damage a boxing player!" ), 0;
@ -1040,10 +1040,35 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b
/*if ( p_Class[ issuerid ] == CLASS_POLICE && p_Class[ playerid ] != CLASS_POLICE && !p_WantedLevel[ playerid ] && GetPlayerState( playerid ) != PLAYER_STATE_WASTED ) { /*if ( p_Class[ issuerid ] == CLASS_POLICE && p_Class[ playerid ] != CLASS_POLICE && !p_WantedLevel[ playerid ] && GetPlayerState( playerid ) != PLAYER_STATE_WASTED ) {
ShowPlayerHelpDialog( issuerid, 2000, "You should not hurt innocent civilians, you're a ~b~cop~w~~h~!" ); ShowPlayerHelpDialog( issuerid, 2000, "You should not hurt innocent civilians, you're a ~b~cop~w~~h~!" );
}*/ }*/
if ( p_Class[ issuerid ] == CLASS_POLICE && p_Class[ playerid ] != CLASS_POLICE && !p_WantedLevel[ playerid ] && GetPlayerState( playerid ) != PLAYER_STATE_WASTED && ! IsPlayerInEvent( issuerid ) )
#if defined __cloudy_event_system
if( IsPlayerInEvent( issuerid ) && IsPlayerInEvent( playerid ) )
{
if( g_eventData[ EV_FIGHT_TYPE] == 3 ) return 0;
if( p_Class[ issuerid ] == p_Class[ playerid ] )
{
if ( p_Class[ issuerid ] == CLASS_CIVILIAN && g_eventData[ EV_FIGHT_TYPE ] == 0 ) // Cops Vs Civilians
return 0;
if ( p_Class[ issuerid ] == CLASS_POLICE && g_eventData[ EV_FIGHT_TYPE ] < 2 ) // ( Cops Vs Civilians ) Or ( Civilians Vs Civilians Vs Cops )
return 0;
}
}
#endif
#if defined __cloudy_event_system
if ( p_Class[ issuerid ] == CLASS_POLICE && p_Class[ playerid ] != CLASS_POLICE && !p_WantedLevel[ playerid ] && GetPlayerState( playerid ) != PLAYER_STATE_WASTED && ! ( IsPlayerInEvent( issuerid ) && IsPlayerInEvent( playerid ) && g_eventData[ EV_FIGHT_TYPE ] < 3 ) )
#else
if ( p_Class[ issuerid ] == CLASS_POLICE && p_Class[ playerid ] != CLASS_POLICE && !p_WantedLevel[ playerid ] && GetPlayerState( playerid ) != PLAYER_STATE_WASTED )
#endif
return ShowPlayerHelpDialog( issuerid, 2000, "You cannot hurt innocent civilians, you're a ~b~cop~w~~h~!" ), 0; return ShowPlayerHelpDialog( issuerid, 2000, "You cannot hurt innocent civilians, you're a ~b~cop~w~~h~!" ), 0;
if ( p_Class[ playerid ] == p_Class[ issuerid ] && p_Class[ playerid ] != CLASS_CIVILIAN ) #if defined __cloudy_event_system
if ( p_Class[ playerid ] == p_Class[ issuerid ] && p_Class[ playerid ] != CLASS_CIVILIAN && ! ( IsPlayerInEvent( issuerid ) && IsPlayerInEvent( playerid ) && g_eventData[ EV_FIGHT_TYPE ] == 2 ) )
#else
if ( p_Class[ playerid ] == p_Class[ issuerid ] && p_Class[ playerid ] != CLASS_CIVILIAN )
#endif
return 0; return 0;
if ( p_BulletInvulnerbility[ playerid ] > g_iTime ) if ( p_BulletInvulnerbility[ playerid ] > g_iTime )
@ -1058,16 +1083,15 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b
if ( IsPlayerTazed( playerid ) || IsPlayerCuffed( playerid ) || IsPlayerKidnapped( playerid ) || IsPlayerTied( playerid ) || IsPlayerLoadingObjects( playerid ) || IsPlayerAdminOnDuty( playerid ) || IsPlayerSpawnProtected( playerid ) ) if ( IsPlayerTazed( playerid ) || IsPlayerCuffed( playerid ) || IsPlayerKidnapped( playerid ) || IsPlayerTied( playerid ) || IsPlayerLoadingObjects( playerid ) || IsPlayerAdminOnDuty( playerid ) || IsPlayerSpawnProtected( playerid ) )
return 0; return 0;
// // Rhino damage invulnerable
// if ( p_Class[ playerid ] == CLASS_POLICE && IsPlayerInAnyVehicle( playerid ) && GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 432 )
// return 0;
// Anti RDM and gang member damage // Anti RDM and gang member damage
if ( ! IsPlayerInEvent( playerid ) && ! IsPlayerInPaintBall( playerid ) && ! IsPlayerBoxing( playerid ) && ! IsPlayerDueling( playerid ) && ! IsPlayerInBattleRoyale( playerid ) ) if ( ! IsPlayerInPaintBall( playerid ) && ! IsPlayerBoxing( playerid ) && ! IsPlayerDueling( playerid ) && ! IsPlayerInBattleRoyale( playerid ) )
{ {
if ( IsPlayerInPlayerGang( issuerid, playerid ) ) { #if defined __cloudy_event_system
return ShowPlayerHelpDialog( issuerid, 2000, "You cannot damage your homies!" ), 0; if ( IsPlayerInPlayerGang( issuerid, playerid ) && ! ( IsPlayerInEvent( playerid ) && IsPlayerInEvent( issuerid ) && g_eventData[ EV_FIGHT_TYPE] <= 2 ) )
} #else
if ( IsPlayerInPlayerGang( issuerid, playerid ) )
#endif
return ShowPlayerHelpDialog( issuerid, 2000, "You cannot damage your homies!" ), 0;
// Anti Random Deathmatch // Anti Random Deathmatch
if ( IsRandomDeathmatch( issuerid, playerid ) ) { if ( IsRandomDeathmatch( issuerid, playerid ) ) {
@ -1092,14 +1116,12 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b
// Headshots // Headshots
#if defined __cloudy_event_system #if defined __cloudy_event_system
if ( ( weaponid == WEAPON_SNIPER || weaponid == WEAPON_RIFLE ) && bodypart == 9 && ( ! IsPlayerInEvent( playerid ) || ( IsPlayerInEvent( playerid ) && EventSettingAllow( EVENT_SETTING_HEADSHOT ) ) ) ) if ( ( weaponid == WEAPON_SNIPER || weaponid == WEAPON_RIFLE ) && bodypart == 9 && ( ! IsPlayerInEvent( playerid ) || ( IsPlayerInEvent( playerid ) && EventSettingAllow( 3 ) ) ) )
#else #else
if ( ( weaponid == WEAPON_SNIPER || weaponid == WEAPON_RIFLE ) && bodypart == 9 ) if ( ( weaponid == WEAPON_SNIPER || weaponid == WEAPON_RIFLE ) && bodypart == 9 )
#endif #endif
{
amount *= 1.5; amount *= 1.5;
}
// Paintball Headshot // Paintball Headshot
if ( issuerid != INVALID_PLAYER_ID && p_inPaintBall{ playerid } == true ) if ( issuerid != INVALID_PLAYER_ID && p_inPaintBall{ playerid } == true )
{ {
@ -7147,4 +7169,4 @@ CMD:peak( playerid, params[] )
{ {
if ( p_AdminLevel[ playerid ] != 6 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); if ( p_AdminLevel[ playerid ] != 6 ) return SendError( playerid, ADMIN_COMMAND_REJECT );
return SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" The current peak player count since startup is: %i", playersPeakCount ); return SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" The current peak player count since startup is: %i", playersPeakCount );
} }