From f0d793d4fccb0e5d35c1e4a6115ff78d17d5d8bc Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Mon, 8 Oct 2018 21:36:19 +1100 Subject: [PATCH] speed up robbery time with thermal drill --- .../cnr/features/robbery/safes.pwn | 34 ++++++++++++++----- gamemodes/irresistible/cnr/progress.pwn | 2 +- gamemodes/sf-cnr.pwn | 6 ++-- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/robbery/safes.pwn b/gamemodes/irresistible/cnr/features/robbery/safes.pwn index f2d5c11..d258695 100644 --- a/gamemodes/irresistible/cnr/features/robbery/safes.pwn +++ b/gamemodes/irresistible/cnr/features/robbery/safes.pwn @@ -237,7 +237,16 @@ stock AttachToRobberySafe( robberyid, playerid, type ) offsetY = -1.4 * floatcos( -( rotation + 170 ), degrees ); g_robberyData[ robberyid ] [ E_DRILL_EFFECT ] = CreateDynamicObject( 18718, fX + offsetX, fY + offsetY, fZ, 90, 0, rotation, g_robberyData[ robberyid ] [ E_WORLD ] ); - g_robberyData[ robberyid ] [ E_ROBTIMER ] = SetTimerEx( "onSafeBust", 7500, false, "dddd", playerid, robberyid, type, 0 ); + new + Float: speed_up = GetPlayerLevel( playerid, E_ROBBERY ) * 37.5; + + if ( speed_up >= 37.5 ) { + SendServerMessage( playerid, "You have attached your thermal drill (%0.1f%s faster) on this "COL_ORANGE"safe"COL_WHITE".", ( speed_up / 7500.0 ) * 100.0, "%%" ); + } else { + SendServerMessage( playerid, "You have attached your thermal drill on this "COL_ORANGE"safe"COL_WHITE"." ); + } + + g_robberyData[ robberyid ] [ E_ROBTIMER ] = SetTimerEx( "onSafeBust", 7500 - floatround( speed_up ), false, "dddd", playerid, robberyid, type, 0 ); p_drillStrength[ playerid ] -= 10; Streamer_Update( playerid ); @@ -298,12 +307,11 @@ stock createRobberyLootInstance( playerid, robberyid, type ) GetDynamicObjectPos( g_robberyData[ robberyid ] [ E_SAFE ], fX, fY, fZ ); GetDynamicObjectRot( g_robberyData[ robberyid ] [ E_SAFE ], fRotation, fRotation, fRotation ); - new businessid = g_robberyData[ robberyid ] [ E_BUSINESS_ID ]; - new bool: business_robbery = businessid != -1; + // new businessid = g_robberyData[ robberyid ] [ E_BUSINESS_ID ]; + // new bool: business_robbery = businessid != -1; new Float: random_chance = fRandomEx( 0.0, 101.0 ); - new Float: probability = 90.0; - if ( business_robbery ) + /*if ( business_robbery ) { switch ( g_businessData[ businessid ] [ E_SECURITY_LEVEL ] ) { @@ -312,10 +320,18 @@ stock createRobberyLootInstance( playerid, robberyid, type ) case 2: probability = 75.0; case 3: probability = 101.0; // must be over 100.0% } + }*/ + + // 100% success rate for newbs + if ( p_Robberies[ playerid ] < 10.0 ) { + random_chance = 100.0; } - // printf ( "[BIZ]Probability %0.3f - dice %0.3f", probability, random_chance ); - if ( business_robbery ? random_chance > probability : ( p_Robberies[ playerid ] <= 20 ? 100.0 : random_chance ) > 5.0 ) + // level increase chance of success + random_chance += GetPlayerLevel( playerid, E_ROBBERY ) * 0.2; // increase success rate by 0.2% per level + + // potential for a 20% fail rate + if ( random_chance > 20.0 ) { new Float: iRobAmount = float( g_robberyData[ robberyid ] [ E_ROB_VALUE ] ); new Float: iLoot = fRandomEx( iRobAmount / 2.0, iRobAmount ); @@ -325,7 +341,7 @@ stock createRobberyLootInstance( playerid, robberyid, type ) g_robberyData[ robberyid ] [ E_MULTIPLIER ] = 1.0; // check if this is a business safe - if ( business_robbery ) + /*if ( business_robbery ) { new Float: final_bank = float( g_businessData[ businessid ] [ E_BANK ] ); switch ( g_businessData[ businessid ] [ E_SECURITY_LEVEL ] ) @@ -345,7 +361,7 @@ stock createRobberyLootInstance( playerid, robberyid, type ) // add loot anyway under 3k if ( iLoot < 3000 ) iLoot = RandomEx( 1500, 3000 ); - } + }*/ // Loose 50% because of impact // if ( type == ROBBERY_TYPE_C4 ) iLoot *= 0.50; diff --git a/gamemodes/irresistible/cnr/progress.pwn b/gamemodes/irresistible/cnr/progress.pwn index 977f858..b6cfe51 100644 --- a/gamemodes/irresistible/cnr/progress.pwn +++ b/gamemodes/irresistible/cnr/progress.pwn @@ -33,7 +33,7 @@ forward OnProgressCompleted( playerid, progressid, params ); /* ** Hooks ** */ hook OnPlayerConnect( playerid ) { - p_ProgressBar[ playerid ] = CreatePlayerProgressBar( playerid, 251.000000, 222.000000, 142.0, 9.2 ); + p_ProgressBar[ playerid ] = CreatePlayerProgressBar( playerid, 252.000000, 221.000000, 142.0, 9.2 ); p_ProgressTitle[ playerid ] = CreatePlayerTextDraw( playerid, 320.000000, 205.000000, "_" ); PlayerTextDrawAlignment( playerid, p_ProgressTitle[ playerid ], 2 ); diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 1ca7cbc..1a0c41b 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -4647,7 +4647,7 @@ public OnProgressCompleted( playerid, progressid, params ) Float: distance = distanceFromSafe( playerid, robberyid ) ; - if ( robberyid != -1 && distance < 2.5 || distance > 0.0 ) + if ( robberyid != -1 && 0.0 < distance <= 2.5 ) { if ( !g_robberyData[ robberyid ] [ E_ROBBED ] && !IsValidDynamicObject( g_robberyData[ robberyid ] [ E_SAFE_MONEY ] ) ) { @@ -17741,7 +17741,7 @@ function handlePlayerRobbery( playerid, newkeys, oldkeys ) if ( success == 0xBF ) SendError( playerid, "There is no money to rob from this business safe." ); else if ( success == 1 ) { - SendServerMessage( playerid, "You have attached your thermal drill on this "COL_ORANGE"safe"COL_WHITE"." ), p_UsingRobberySafe[ playerid ] = robberyid; + p_UsingRobberySafe[ playerid ] = robberyid; } } else @@ -17783,7 +17783,7 @@ function handlePlayerRobbery( playerid, newkeys, oldkeys ) Float: speed_up = GetPlayerLevel( playerid, E_ROBBERY ) * 50.0; if ( speed_up >= 50.0 ) { - SendClientMessageFormatted( playerid, -1, ""COL_GOLD"[ROBBERY]"COL_WHITE" You are now picking a safe (%0.1f%s faster), please wait until you've finished. Press C to stop.", ( speed_up / 5000.0 ) * 100.0, "%%" ); + SendClientMessageFormatted( playerid, -1, ""COL_GOLD"[ROBBERY]"COL_WHITE" You are now picking a safe (%0.1f%s faster), please wait until you've finished. Press C to stop.", ( speed_up / 10000.0 ) * 100.0, "%%" ); } else { SendClientMessage( playerid, -1, ""COL_GOLD"[ROBBERY]"COL_WHITE" You are now picking a safe, please wait until you've finished. Press C to stop." ); }