Merge pull request #46 from dusan01/features/cop-level-benefits

Features/cop level benefits
This commit is contained in:
Lorenc Pekaj 2019-06-17 23:10:29 +10:00 committed by GitHub
commit 7705bde84e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 13 deletions

View File

@ -180,6 +180,9 @@ CMD:arrest( playerid, params[ ] )
if ( GetPlayerState( playerid ) == PLAYER_STATE_WASTED ) return SendError( playerid, "You cannot use this command since you are dead." ); if ( GetPlayerState( playerid ) == PLAYER_STATE_WASTED ) return SendError( playerid, "You cannot use this command since you are dead." );
new totalCash = ( p_WantedLevel[ victimid ] < MAX_WANTED_LVL ? p_WantedLevel[ victimid ] : MAX_WANTED_LVL ) * ( COP_ARREST_PAY_PER_WANTED ); new totalCash = ( p_WantedLevel[ victimid ] < MAX_WANTED_LVL ? p_WantedLevel[ victimid ] : MAX_WANTED_LVL ) * ( COP_ARREST_PAY_PER_WANTED );
new totalSeconds = p_WantedLevel[ victimid ] * ( JAIL_SECONDS_MULTIPLIER ); new totalSeconds = p_WantedLevel[ victimid ] * ( JAIL_SECONDS_MULTIPLIER );
if ( GetPlayerLevel( victimid, E_POLICE ) >= 75.0 ) {
totalSeconds = floatround( float( totalSeconds ) * 0.5 );
}
GivePlayerScore( playerid, 2 ); GivePlayerScore( playerid, 2 );
GivePlayerExperience( playerid, E_POLICE ); GivePlayerExperience( playerid, E_POLICE );
GivePlayerCash( playerid, totalCash ); GivePlayerCash( playerid, totalCash );
@ -396,9 +399,13 @@ stock BreakPlayerCuffs( playerid )
} }
else p_BobbyPins[ playerid ] --; else p_BobbyPins[ playerid ] --;
new probability = 50; // success rate probability new Float: probability = fRandomEx( 0.0, 100.0 );
if ( random( 101 ) <= probability ) // multiply success rate every 25 levels (only 1, 2, 3, 4x)
probability *= GetPlayerLevel( playerid, E_POLICE ) / 25.0 + 1.0;
// if probability >= n% after multiplying as well then uncuff
if ( probability >= 75.0 )
{ {
if ( ! IsPlayerCuffed( playerid ) ) if ( ! IsPlayerCuffed( playerid ) )
{ {
@ -439,12 +446,12 @@ stock AwardNearestLEO( playerid, reason )
{ {
if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID || GetPlayerWantedLevel( playerid ) < 2 || IsPlayerDead( playerid ) ) if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID || GetPlayerWantedLevel( playerid ) < 2 || IsPlayerDead( playerid ) )
return false; return false;
#if defined __cloudy_event_system #if defined __cloudy_event_system
if ( IsPlayerInEvent( playerid ) ) if ( IsPlayerInEvent( playerid ) )
return false; return false;
#endif #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 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 ); new closestLEO = GetClosestPlayerEx( playerid, CLASS_POLICE, radius );

View File

@ -32,13 +32,13 @@ CMD:bail( playerid, params[ ] )
else if ( GetPVarInt( pID, "bail_antispam" ) > g_iTime ) return SendError( playerid, "You must wait 10 seconds before offering a bail to this player." ); else if ( GetPVarInt( pID, "bail_antispam" ) > g_iTime ) return SendError( playerid, "You must wait 10 seconds before offering a bail to this player." );
else else
{ {
equa = BAIL_DOLLARS_PER_SECOND * p_JailTime[ pID ]; equa = floatround( float( BAIL_DOLLARS_PER_SECOND * p_JailTime[ pID ] ) * ( 1.0 - GetPlayerLevel( pID, E_POLICE ) / 125.0 ) );
if ( p_JailTime[ pID ] >= ALCATRAZ_TIME_WANTED ) equa *= 2; if ( p_JailTime[ pID ] >= ALCATRAZ_TIME_WANTED ) equa *= 2;
p_BailOfferer[ pID ] = playerid; p_BailOfferer[ pID ] = playerid;
p_BailTimestamp[ pID ] = g_iTime + 120; p_BailTimestamp[ pID ] = g_iTime + 120;
SetPVarInt( pID, "bail_antispam", g_iTime + 1 ); SetPVarInt( pID, "bail_antispam", g_iTime + 1 );
SendServerMessage( playerid, "You have offered %s(%d) bail for "COL_GOLD"%s", ReturnPlayerName( pID ), pID, cash_format( equa ) ); SendServerMessage( playerid, "You have offered %s(%d) bail for "COL_GOLD"%s", ReturnPlayerName( pID ), pID, cash_format( equa ) );
SendClientMessageFormatted( pID, -1, ""COL_GREY"[SERVER]"COL_WHITE" %s(%d) has offered to bail you out for "COL_GOLD"%s"COL_WHITE". "COL_ORANGE"/acceptbail"COL_WHITE" to accept the bail.", ReturnPlayerName( playerid ), playerid, cash_format( equa ) ); SendClientMessageFormatted( pID, -1, ""COL_GREY"[SERVER]"COL_WHITE" %s(%d) has offered to bail you out for "COL_GOLD"%s"COL_WHITE". "COL_ORANGE"/acceptbail"COL_WHITE" to accept the bail.", ReturnPlayerName( playerid ), playerid, cash_format( equa ) );
} }
return 1; return 1;
} }
@ -46,7 +46,7 @@ CMD:bail( playerid, params[ ] )
CMD:acceptbail( playerid, params[ ] ) CMD:acceptbail( playerid, params[ ] )
{ {
new new
equa = BAIL_DOLLARS_PER_SECOND * p_JailTime[ playerid ]; equa = floatround( float( BAIL_DOLLARS_PER_SECOND * p_JailTime[ playerid ] ) * ( 1.0 - GetPlayerLevel( playerid, E_POLICE ) / 125.0 ) );
if ( p_JailTime[ playerid ] >= ALCATRAZ_TIME_WANTED ) if ( p_JailTime[ playerid ] >= ALCATRAZ_TIME_WANTED )
equa *= 2; equa *= 2;
@ -61,7 +61,7 @@ CMD:acceptbail( playerid, params[ ] )
new new
cashEarned = floatround( equa * 0.70 ); cashEarned = floatround( equa * 0.70 );
GivePlayerCash( playerid, -equa ); GivePlayerCash( playerid, -equa );
GivePlayerCash( p_BailOfferer[ playerid ], cashEarned ); GivePlayerCash( p_BailOfferer[ playerid ], cashEarned );
StockMarket_UpdateEarnings( E_STOCK_GOVERNMENT, cashEarned, 0.1 ); StockMarket_UpdateEarnings( E_STOCK_GOVERNMENT, cashEarned, 0.1 );
SendClientMessageFormatted( p_BailOfferer[ playerid ], -1, ""COL_GREEN"[BAIL]"COL_WHITE" %s(%d) has paid bail. You have earned "COL_GOLD"%s"COL_WHITE" from his bail.", ReturnPlayerName( playerid ), playerid, cash_format( cashEarned ) ); SendClientMessageFormatted( p_BailOfferer[ playerid ], -1, ""COL_GREEN"[BAIL]"COL_WHITE" %s(%d) has paid bail. You have earned "COL_GOLD"%s"COL_WHITE" from his bail.", ReturnPlayerName( playerid ), playerid, cash_format( cashEarned ) );

View File

@ -538,6 +538,10 @@ stock createRobberyLootInstance( playerid, robberyid, type )
random_chance = 100.0; random_chance = 100.0;
} }
if ( GetPlayerLevel( playerid, E_POLICE ) >= 50.0 ) {
random_chance = 100.0;
}
// level increase chance of success // level increase chance of success
random_chance += GetPlayerLevel( playerid, E_ROBBERY ) * 0.2; // increase success rate by 0.2% per level random_chance += GetPlayerLevel( playerid, E_ROBBERY ) * 0.2; // increase success rate by 0.2% per level