Merge pull request #25 from meCloudy/patch-10

Fixes the Quit To Avoid in events
This commit is contained in:
Lorenc Pekaj 2019-06-02 22:29:13 +10:00 committed by GitHub
commit a7ea5168a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions

View File

@ -375,6 +375,11 @@ stock SavePlayerData( playerid, bool: logout = false )
if ( IsPlayerCuffed( playerid ) || IsPlayerTazed( playerid ) || IsPlayerTied( playerid ) || p_LeftCuffed{ playerid } || p_QuitToAvoidTimestamp[ playerid ] > g_iTime )
bQuitToAvoid = true;
#if defined __cloudy_event_system
if ( IsPlayerInEvent( playerid ) )
bQuitToAvoid = false;
#endif
format( Query, sizeof( Query ), "UPDATE `USERS` SET `SCORE`=%d,`ADMINLEVEL`=%d,`OWNEDHOUSES`=%d,`KILLS`=%d,`DEATHS`=%d,`VIP_PACKAGE`=%d,`OWNEDCARS`=%d,`LASTLOGGED`=%d,`VIP_EXPIRE`=%d,`LAST_SKIN`=%d,`BURGLARIES`=%d,`UPTIME`=%d,`ARRESTS`=%d,`CITY`=%d,`METH`=%d,`SODA`=%d,`ACID`=%d,`GAS`=%d,",
GetPlayerScore( playerid ), p_AdminLevel[ playerid ],
@ -415,4 +420,4 @@ stock SavePlayerData( playerid, bool: logout = false )
stock GetPlayerAccountID( playerid ) return p_AccountID[ playerid ];
stock IsPlayerLoggedIn( playerid ) return p_PlayerLogged{ playerid };
stock IsPlayerLoggedIn( playerid ) return p_PlayerLogged{ playerid };

View File

@ -439,7 +439,12 @@ stock AwardNearestLEO( playerid, reason )
{
if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID || GetPlayerWantedLevel( playerid ) < 2 || IsPlayerDead( playerid ) )
return false;
#if defined __cloudy_event_system
if ( IsPlayerInEvent( playerid ) )
return false;
#endif
new Float: radius = ( IsPlayerInAnyVehicle( playerid ) ? 150.0 : 75.0 ); // If player is in a vehicle, increase radius due to ability to get farther quicker.
new closestLEO = GetClosestPlayerEx( playerid, CLASS_POLICE, radius );
@ -500,4 +505,4 @@ hook OnPlayerUpdateEx( playerid )
}
}
return 1;
}
}

View File

@ -845,8 +845,14 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float:
return 1; // fcnpc
// Cop shoots innocent, they /q - so jail
#if defined __cloudy_event_system
if ( p_Class[ playerid ] == CLASS_POLICE && p_WantedLevel[ hitid ] > 2 && ! IsPlayerInEvent( playerid ) && ! IsPlayerInEvent( hitid ) )
#else
if ( p_Class[ playerid ] == CLASS_POLICE && p_WantedLevel[ hitid ] > 2 )
#endif
{
p_QuitToAvoidTimestamp[ hitid ] = g_iTime + 3;
}
if ( p_Class[ playerid ] == CLASS_POLICE && p_Class[ hitid ] != CLASS_POLICE && !p_WantedLevel[ hitid ] && GetPlayerState( hitid ) != PLAYER_STATE_WASTED && ! IsPlayerInEvent( playerid ) && ! IsPlayerInBattleRoyale( playerid ) )
return ShowPlayerHelpDialog( playerid, 2000, "You cannot hurt innocent civilians, you're a ~b~cop~w~~h~!" ), 0;