bruteforce / breakin automatic when you enter a house
This commit is contained in:
parent
395bd7c86f
commit
8feb261284
@ -44,5 +44,5 @@
|
|||||||
- Called when a player leaves a gang
|
- Called when a player leaves a gang
|
||||||
- `OnPlayerEnterHouse( playerid, houseid )`
|
- `OnPlayerEnterHouse( playerid, houseid )`
|
||||||
- Called when a player enters a house
|
- Called when a player enters a house
|
||||||
- `OnPlayerAttemptBurglary( playerid, houseid, businessid )`
|
- `OnPlayerAttemptBreakIn( playerid, houseid, businessid )`
|
||||||
- Called when a player attempts to break into a business/house
|
- Called when a player attempts to break into a business/house
|
||||||
|
@ -25,10 +25,15 @@
|
|||||||
#define MAX_COKE_AMOUNT ( 10 )
|
#define MAX_COKE_AMOUNT ( 10 )
|
||||||
#define MAX_WEAPON_AMOUNT ( 10 )
|
#define MAX_WEAPON_AMOUNT ( 10 )
|
||||||
|
|
||||||
|
#define PROGRESS_CRACKING_BIZ ( 8 )
|
||||||
|
|
||||||
/* ** Macros ** */
|
/* ** Macros ** */
|
||||||
#define UpdateBusinessTitle(%0) \
|
#define UpdateBusinessTitle(%0) \
|
||||||
mysql_function_query(dbHandle,sprintf("SELECT f.`NAME` FROM `USERS` f LEFT JOIN `BUSINESSES` m ON m.`OWNER_ID`=f.`ID` WHERE m.`ID`=%d",%0),true,"OnUpdateBusinessTitle","i",%0)
|
mysql_function_query(dbHandle,sprintf("SELECT f.`NAME` FROM `USERS` f LEFT JOIN `BUSINESSES` m ON m.`OWNER_ID`=f.`ID` WHERE m.`ID`=%d",%0),true,"OnUpdateBusinessTitle","i",%0)
|
||||||
|
|
||||||
|
#define IsValidBusiness(%0) \
|
||||||
|
( 0 <= %0 < MAX_BUSINESSES && Iter_Contains( business, %0 ) )
|
||||||
|
|
||||||
/* ** Variables ** */
|
/* ** Variables ** */
|
||||||
enum E_BUSINESS_DATA
|
enum E_BUSINESS_DATA
|
||||||
{
|
{
|
||||||
@ -295,6 +300,102 @@ hook OnVehicleDeath( vehicleid, killerid )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook OnPlayerAttemptBreakIn( playerid, houseid, businessid )
|
||||||
|
{
|
||||||
|
new is_fbi = GetPlayerClass( playerid ) == CLASS_POLICE && p_inFBI{ playerid } && ! p_inArmy{ playerid } && ! p_inCIA{ playerid };
|
||||||
|
new is_burglar = GetPlayerClass( playerid ) == CLASS_CIVILIAN && IsPlayerJob( playerid, JOB_BURGLAR );
|
||||||
|
|
||||||
|
// prohibit non-cop,
|
||||||
|
if ( ! ( ! is_fbi && is_burglar || ! is_burglar && is_fbi ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ( IsValidBusiness( businessid ) )
|
||||||
|
{
|
||||||
|
new current_time = GetServerTime( );
|
||||||
|
new crackpw_cooldown = GetPVarInt( playerid, "crack_biz_cool" );
|
||||||
|
|
||||||
|
if ( crackpw_cooldown > current_time ) {
|
||||||
|
return SendError( playerid, "You are unable to attempt a house break-in for %d seconds.", crackpw_cooldown - current_time ), 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( g_iTime > g_businessData[ businessid ] [ E_CRACKED_TS ] && g_businessData[ businessid ] [ E_CRACKED ] ) g_businessData[ businessid ] [ E_CRACKED ] = false; // The Virus Is Disabled.
|
||||||
|
|
||||||
|
if ( IsBusinessAssociate( playerid, businessid ) )
|
||||||
|
return SendError( playerid, "You are an associate of this business, you cannot crack it." );
|
||||||
|
|
||||||
|
if ( g_businessData[ businessid ] [ E_CRACKED_WAIT ] > g_iTime )
|
||||||
|
return SendError( playerid, "This house had its password recently had a cracker run through. Come back later." );
|
||||||
|
|
||||||
|
if ( g_businessData[ businessid ] [ E_CRACKED ] || g_businessData[ businessid ] [ E_BEING_CRACKED ] )
|
||||||
|
return SendError( playerid, "This house is currently being cracked or is already cracked." );
|
||||||
|
|
||||||
|
// alert
|
||||||
|
foreach ( new ownerid : Player ) if ( IsBusinessAssociate( ownerid, businessid ) ) {
|
||||||
|
SendClientMessageFormatted( ownerid, -1, ""COL_RED"[BURGLARY]"COL_WHITE" %s(%d) is attempting to break into your business %s"COL_WHITE"!", ReturnPlayerName( playerid ), playerid, g_businessData[ businessid ] [ E_NAME ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// crack pw
|
||||||
|
g_businessData[ businessid ] [ E_BEING_CRACKED ] = true;
|
||||||
|
SetPVarInt( playerid, "crackpw_biz", businessid );
|
||||||
|
SetPVarInt( playerid, "crack_biz_cool", current_time + 40 );
|
||||||
|
ShowProgressBar( playerid, "Cracking Password", PROGRESS_CRACKING_BIZ, 7500, COLOR_WHITE );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnPlayerProgressUpdate( playerid, progressid, bool: canceled, params )
|
||||||
|
{
|
||||||
|
if ( progressid == PROGRESS_CRACKING_BIZ )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
businessid = GetPVarInt( playerid, "crackpw_biz" );
|
||||||
|
|
||||||
|
if ( ! IsPlayerSpawned( playerid ) || ! IsPlayerInDynamicCP( playerid, g_businessData[ businessid ] [ E_ENTER_CP ] ) || !IsPlayerConnected( playerid ) || IsPlayerInAnyVehicle( playerid ) || canceled ) {
|
||||||
|
g_businessData[ businessid ] [ E_BEING_CRACKED ] = false;
|
||||||
|
return StopProgressBar( playerid ), 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hook OnProgressCompleted( playerid, progressid, params )
|
||||||
|
{
|
||||||
|
if ( progressid == PROGRESS_CRACKING_BIZ )
|
||||||
|
{
|
||||||
|
new szLocation[ MAX_ZONE_NAME ];
|
||||||
|
new businessid = GetPVarInt( playerid, "crackpw_biz" );
|
||||||
|
g_businessData[ businessid ] [ E_BEING_CRACKED ] = false;
|
||||||
|
g_businessData[ businessid ] [ E_CRACKED_WAIT ] = g_iTime + 120; // g_businessSecurityData[ g_businessData[ businessid ] [ E_SECURITY_LEVEL ] ] [ E_BREAKIN_COOLDOWN ];
|
||||||
|
|
||||||
|
if ( random( 100 ) < 75 )
|
||||||
|
{
|
||||||
|
foreach ( new ownerid : Player ) if ( IsBusinessAssociate( ownerid, businessid ) ) {
|
||||||
|
SendClientMessageFormatted( ownerid, -1, ""COL_RED"[BURGLARY]"COL_WHITE" %s(%d) has broken into your business %s"COL_WHITE"!", ReturnPlayerName( playerid ), playerid, g_businessData[ businessid ] [ E_NAME ] );
|
||||||
|
}
|
||||||
|
g_businessData[ businessid ] [ E_CRACKED ] = true;
|
||||||
|
g_businessData[ businessid ] [ E_CRACKED_TS ] = g_iTime + 180;
|
||||||
|
SendServerMessage( playerid, "You have successfully cracked this business' password. It will not be accessible in 3 minutes." );
|
||||||
|
GivePlayerWantedLevel( playerid, 12 );
|
||||||
|
GivePlayerScore( playerid, 2 );
|
||||||
|
//GivePlayerExperience( playerid, E_BURGLAR );
|
||||||
|
ach_HandleBurglaries( playerid );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach ( new ownerid : Player ) if ( IsBusinessAssociate( ownerid, businessid ) ) {
|
||||||
|
SendClientMessageFormatted( ownerid, -1, ""COL_RED"[BURGLARY]"COL_WHITE" %s(%d) failed to break in business %s"COL_WHITE"!", ReturnPlayerName( playerid ), playerid, g_businessData[ businessid ] [ E_NAME ] );
|
||||||
|
}
|
||||||
|
GetZoneFromCoordinates( szLocation, g_businessData[ businessid ] [ E_X ], g_businessData[ businessid ] [ E_Y ], g_businessData[ businessid ] [ E_Z ] );
|
||||||
|
SendClientMessageToCops( -1, ""COL_BLUE"[BURGLARY]"COL_WHITE" %s has failed to crack a business' password near %s.", ReturnPlayerName( playerid ), szLocation );
|
||||||
|
SendClientMessage( playerid, -1, ""COL_GREY"[SERVER]"COL_WHITE" You have failed to crack this business' password." );
|
||||||
|
GivePlayerWantedLevel( playerid, 6 );
|
||||||
|
CreateCrimeReport( playerid );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ** Command ** */
|
/* ** Command ** */
|
||||||
CMD:b( playerid, params[ ] ) return cmd_business( playerid, params );
|
CMD:b( playerid, params[ ] ) return cmd_business( playerid, params );
|
||||||
CMD:business( playerid, params[ ] )
|
CMD:business( playerid, params[ ] )
|
||||||
|
@ -194,7 +194,7 @@ hook OnPlayerEnterHouse( playerid, houseid )
|
|||||||
// alert burglar of any furniture
|
// alert burglar of any furniture
|
||||||
if ( ! IsPlayerHomeOwner( playerid, houseid ) && IsPlayerJob( playerid, JOB_BURGLAR ) && GetPlayerClass( playerid ) == CLASS_CIVILIAN ) {
|
if ( ! IsPlayerHomeOwner( playerid, houseid ) && IsPlayerJob( playerid, JOB_BURGLAR ) && GetPlayerClass( playerid ) == CLASS_CIVILIAN ) {
|
||||||
if ( Iter_Count( housefurniture[ houseid ] ) ) {
|
if ( Iter_Count( housefurniture[ houseid ] ) ) {
|
||||||
ShowPlayerHelpDialog( playerid, 4000, "This house has furniture to rob.~n~~n~Type ~g~~h~/burglar steal~w~ near the furniture you want to steal." );
|
ShowPlayerHelpDialog( playerid, 4000, "This house has furniture to rob.~n~~n~Press ~g~~h~~k~~VEHICLE_ENTER_EXIT~~w~ near the furniture you want to steal." );
|
||||||
} else {
|
} else {
|
||||||
ShowPlayerHelpDialog( playerid, 4000, "~r~This house has no furniture to rob." );
|
ShowPlayerHelpDialog( playerid, 4000, "~r~This house has no furniture to rob." );
|
||||||
}
|
}
|
||||||
@ -202,37 +202,46 @@ hook OnPlayerEnterHouse( playerid, houseid )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hook OnPlayerAttemptBurglary( playerid, houseid, businessid )
|
hook OnPlayerAttemptBreakIn( playerid, houseid, businessid )
|
||||||
{
|
{
|
||||||
new current_time = GetServerTime( );
|
new is_fbi = GetPlayerClass( playerid ) == CLASS_POLICE && p_inFBI{ playerid } && ! p_inArmy{ playerid } && ! p_inCIA{ playerid };
|
||||||
new crackpw_cooldown = GetPVarInt( playerid, "crack_housepw_cool" );
|
new is_burglar = GetPlayerClass( playerid ) == CLASS_CIVILIAN && IsPlayerJob( playerid, JOB_BURGLAR );
|
||||||
|
|
||||||
if ( crackpw_cooldown > current_time ) {
|
// prohibit non-cop,
|
||||||
return SendError( playerid, "You are unable to attempt a house break-in for %d seconds.", crackpw_cooldown - current_time ), 0;
|
if ( ! ( ! is_fbi && is_burglar || ! is_burglar && is_fbi ) )
|
||||||
}
|
return 0;
|
||||||
|
|
||||||
print("Attempt Breakin");
|
|
||||||
|
|
||||||
if ( IsValidHouse( houseid ) )
|
if ( IsValidHouse( houseid ) )
|
||||||
{
|
{
|
||||||
|
new current_time = GetServerTime( );
|
||||||
|
new crackpw_cooldown = GetPVarInt( playerid, "crack_housepw_cool" );
|
||||||
|
|
||||||
|
if ( crackpw_cooldown > current_time ) {
|
||||||
|
return SendError( playerid, "You are unable to attempt a house break-in for %d seconds.", crackpw_cooldown - current_time ), 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( current_time > g_houseData[ houseid ] [ E_CRACKED_TS ] && g_houseData[ houseid ] [ E_CRACKED ] )
|
if ( current_time > g_houseData[ houseid ] [ E_CRACKED_TS ] && g_houseData[ houseid ] [ E_CRACKED ] )
|
||||||
g_houseData[ houseid ] [ E_CRACKED ] = false; // The Virus Is Disabled.
|
g_houseData[ houseid ] [ E_CRACKED ] = false; // The Virus Is Disabled.
|
||||||
|
|
||||||
if ( g_houseData[ houseid ] [ E_CRACKED_WAIT ] > current_time )
|
if ( g_houseData[ houseid ] [ E_CRACKED_WAIT ] > current_time )
|
||||||
return print("1"), SendError( playerid, "This house had its password recently had a cracker run through. Come back later." ), 0;
|
return SendError( playerid, "This house had its password recently had a cracker run through. Come back later." ), 0;
|
||||||
|
|
||||||
if ( g_houseData[ houseid ] [ E_CRACKED ] || g_houseData[ houseid ] [ E_BEING_CRACKED ] )
|
if ( g_houseData[ houseid ] [ E_CRACKED ] || g_houseData[ houseid ] [ E_BEING_CRACKED ] )
|
||||||
return print("2"), SendError( playerid, "This house is currently being cracked or is already cracked." ), 0;
|
return SendError( playerid, "This house is currently being cracked or is already cracked." ), 0;
|
||||||
|
|
||||||
if ( IsHouseOnFire( houseid ) )
|
if ( IsHouseOnFire( houseid ) )
|
||||||
return print("3"), SendError( playerid, "This house is on fire, you cannot crack it!" ), 0;
|
return SendError( playerid, "This house is on fire, you cannot crack it!" ), 0;
|
||||||
|
|
||||||
print("Attempt Breakin2");
|
|
||||||
g_houseData[ houseid ] [ E_BEING_CRACKED ] = true;
|
g_houseData[ houseid ] [ E_BEING_CRACKED ] = true;
|
||||||
p_HouseCrackingPW[ playerid ] = houseid;
|
p_HouseCrackingPW[ playerid ] = houseid;
|
||||||
SetPVarInt( playerid, "crack_housepw_cool", current_time + 40 );
|
SetPVarInt( playerid, "crack_housepw_cool", current_time + 40 );
|
||||||
ShowProgressBar( playerid, "Cracking Password", PROGRESS_CRACKING, 7500, COLOR_WHITE );
|
|
||||||
return 1;
|
if ( is_fbi ) {
|
||||||
|
ShowProgressBar( playerid, "Brute Forcing Password", PROGRESS_BRUTEFORCE, 5000, COLOR_BLUE );
|
||||||
|
} else {
|
||||||
|
ShowProgressBar( playerid, "Cracking Password", PROGRESS_CRACKING, 7500, COLOR_WHITE );
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -281,8 +290,8 @@ hook OnPlayerEnterDynArea( playerid, areaid )
|
|||||||
|
|
||||||
if ( attached_model == 498 )
|
if ( attached_model == 498 )
|
||||||
{
|
{
|
||||||
if ( ! IsPlayerAttachedObjectSlotUsed( playerid, 3 ) ) {
|
if ( GetPVarType( playerid, "stolen_fid" ) == PLAYER_VARTYPE_NONE ) {
|
||||||
return SendError( playerid, "You aren't holding anything!" );
|
return 1; // return SendError( playerid, "You aren't holding anything!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
new stolen_furniture_count = GetGVarInt( sprintf( "vburg_%d_items", attached_vehicle ) );
|
new stolen_furniture_count = GetGVarInt( sprintf( "vburg_%d_items", attached_vehicle ) );
|
||||||
@ -367,88 +376,7 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ** Commands ** */
|
/* ** Functions ** */
|
||||||
CMD:burglar( playerid, params[ ] )
|
|
||||||
{
|
|
||||||
if ( p_Class[ playerid ] != CLASS_CIVILIAN ) return SendError( playerid, "You are not a civilian." );
|
|
||||||
if ( !IsPlayerJob( playerid, JOB_BURGLAR ) ) return SendError( playerid, "You are not a burglar." );
|
|
||||||
|
|
||||||
if ( isnull( params ) ) return SendUsage( playerid, "/burglar [CRACKPW/STEAL/STORE]" );
|
|
||||||
else if ( strmatch( params, "crackpw" ) )
|
|
||||||
{
|
|
||||||
|
|
||||||
// businesses
|
|
||||||
/*foreach ( new handle : business )
|
|
||||||
{
|
|
||||||
if ( IsPlayerInDynamicCP( playerid, g_businessData[ handle ] [ E_ENTER_CP ] ) )
|
|
||||||
{
|
|
||||||
if ( g_iTime > g_businessData[ handle ] [ E_CRACKED_TS ] && g_businessData[ handle ] [ E_CRACKED ] ) g_businessData[ handle ] [ E_CRACKED ] = false; // The Virus Is Disabled.
|
|
||||||
|
|
||||||
if ( IsBusinessAssociate( playerid, handle ) )
|
|
||||||
return SendError( playerid, "You are an associate of this business, you cannot crack it." );
|
|
||||||
|
|
||||||
if ( g_businessData[ handle ] [ E_CRACKED_WAIT ] > g_iTime )
|
|
||||||
return SendError( playerid, "This house had its password recently had a cracker run through. Come back later." );
|
|
||||||
|
|
||||||
if ( g_businessData[ handle ] [ E_CRACKED ] || g_businessData[ handle ] [ E_BEING_CRACKED ] )
|
|
||||||
return SendError( playerid, "This house is currently being cracked or is already cracked." );
|
|
||||||
|
|
||||||
// alert
|
|
||||||
foreach ( new ownerid : Player ) if ( IsBusinessAssociate( ownerid, handle ) ) {
|
|
||||||
SendClientMessageFormatted( ownerid, -1, ""COL_RED"[BURGLARY]"COL_WHITE" %s(%d) is attempting to break into your business %s"COL_WHITE"!", ReturnPlayerName( playerid ), playerid, g_businessData[ handle ] [ E_NAME ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
// crack pw
|
|
||||||
g_businessData[ handle ] [ E_BEING_CRACKED ] = true;
|
|
||||||
SetPVarInt( playerid, "crackpw_biz", handle );
|
|
||||||
SetPVarInt( playerid, "crackpw_cool", g_iTime + 40 );
|
|
||||||
ShowProgressBar( playerid, "Cracking Password", PROGRESS_CRACKING_BIZ, 7500, COLOR_WHITE );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
else SendUsage( playerid, "/burglar [CRACKPW/STEAL]" );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
CMD:bruteforce( playerid, params[ ] )
|
|
||||||
{
|
|
||||||
/* ** ANTI SPAM ** */
|
|
||||||
if ( GetPVarInt( playerid, "last_bruteforce" ) > g_iTime ) return SendError( playerid, "You must wait 30 seconds before using this command again." );
|
|
||||||
/* ** END OF ANTI SPAM ** */
|
|
||||||
|
|
||||||
if ( p_Class[ playerid ] != CLASS_POLICE ) return SendError( playerid, "This command is restricted for F.B.I agents." );
|
|
||||||
if ( !( p_inFBI{ playerid } == true && p_inArmy{ playerid } == false && p_inCIA{ playerid } == false ) ) return SendError( playerid, "This command is restricted for F.B.I agents." );
|
|
||||||
|
|
||||||
foreach ( new i : houses )
|
|
||||||
{
|
|
||||||
if ( IsPlayerInDynamicCP( playerid, g_houseData[ i ] [ E_CHECKPOINT ] [ 0 ] ) && !strmatch( g_houseData[ i ] [ E_OWNER ], ReturnPlayerName( playerid ) ) )
|
|
||||||
{
|
|
||||||
if ( g_iTime > g_houseData[ i ] [ E_CRACKED_TS ] && g_houseData[ i ] [ E_CRACKED ] ) g_houseData[ i ] [ E_CRACKED ] = false; // The Virus Is Disabled.
|
|
||||||
|
|
||||||
if ( g_houseData[ i ] [ E_CRACKED_WAIT ] > g_iTime )
|
|
||||||
return SendError( playerid, "This house had its password recently had a cracker run through. Come back later." );
|
|
||||||
|
|
||||||
if ( strmatch( g_houseData[ i ] [ E_PASSWORD ], "N/A" ) )
|
|
||||||
return SendError( playerid, "This house does not require cracking as it doesn't have a password." );
|
|
||||||
|
|
||||||
if ( g_houseData[ i ] [ E_CRACKED ] || g_houseData[ i ] [ E_BEING_CRACKED ] )
|
|
||||||
return SendError( playerid, "This house is currently being cracked or is already cracked." );
|
|
||||||
|
|
||||||
if ( IsHouseOnFire( i ) )
|
|
||||||
return SendError( playerid, "This house is on fire, you cannot bruteforce it!" ), 1;
|
|
||||||
|
|
||||||
g_houseData[ i ] [ E_BEING_CRACKED ] = true;
|
|
||||||
p_HouseCrackingPW[ playerid ] = i;
|
|
||||||
SetPVarInt( playerid, "last_bruteforce", g_iTime + 30 );
|
|
||||||
ShowProgressBar( playerid, "Brute Forcing Password", PROGRESS_BRUTEFORCE, 5000, COLOR_BLUE );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SendError( playerid, "You are not standing in any house checkpoint." );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ResetVehicleBurglaryData( vehicleid )
|
stock ResetVehicleBurglaryData( vehicleid )
|
||||||
{
|
{
|
||||||
DeleteGVar( sprintf( "vburg_%d_cash", vehicleid ) );
|
DeleteGVar( sprintf( "vburg_%d_cash", vehicleid ) );
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#define PROGRESS_MINING 3
|
#define PROGRESS_MINING 3
|
||||||
#define PROGRESS_ROBBING 4
|
#define PROGRESS_ROBBING 4
|
||||||
#define PROGRESS_SAFEPICK 5
|
#define PROGRESS_SAFEPICK 5
|
||||||
#define PROGRESS_CRACKING_BIZ 8
|
|
||||||
|
|
||||||
/* ** Variables ** */
|
/* ** Variables ** */
|
||||||
static stock
|
static stock
|
||||||
|
@ -2708,56 +2708,11 @@ function emp_deactivate( vehicleid )
|
|||||||
|
|
||||||
public OnPlayerProgressUpdate( playerid, progressid, bool: canceled, params )
|
public OnPlayerProgressUpdate( playerid, progressid, bool: canceled, params )
|
||||||
{
|
{
|
||||||
if ( progressid == PROGRESS_CRACKING_BIZ )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
businessid = GetPVarInt( playerid, "crackpw_biz" );
|
|
||||||
|
|
||||||
if ( ! IsPlayerSpawned( playerid ) || ! IsPlayerInDynamicCP( playerid, g_businessData[ businessid ] [ E_ENTER_CP ] ) || !IsPlayerConnected( playerid ) || IsPlayerInAnyVehicle( playerid ) || canceled ) {
|
|
||||||
g_businessData[ businessid ] [ E_BEING_CRACKED ] = false;
|
|
||||||
return StopProgressBar( playerid ), 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnProgressCompleted( playerid, progressid, params )
|
public OnProgressCompleted( playerid, progressid, params )
|
||||||
{
|
{
|
||||||
switch( progressid )
|
|
||||||
{
|
|
||||||
case PROGRESS_CRACKING_BIZ:
|
|
||||||
{
|
|
||||||
new szLocation[ MAX_ZONE_NAME ];
|
|
||||||
new businessid = GetPVarInt( playerid, "crackpw_biz" );
|
|
||||||
g_businessData[ businessid ] [ E_BEING_CRACKED ] = false;
|
|
||||||
g_businessData[ businessid ] [ E_CRACKED_WAIT ] = g_iTime + 120; // g_businessSecurityData[ g_businessData[ businessid ] [ E_SECURITY_LEVEL ] ] [ E_BREAKIN_COOLDOWN ];
|
|
||||||
|
|
||||||
if ( random( 100 ) < 75 )
|
|
||||||
{
|
|
||||||
foreach ( new ownerid : Player ) if ( IsBusinessAssociate( ownerid, businessid ) ) {
|
|
||||||
SendClientMessageFormatted( ownerid, -1, ""COL_RED"[BURGLARY]"COL_WHITE" %s(%d) has broken into your business %s"COL_WHITE"!", ReturnPlayerName( playerid ), playerid, g_businessData[ businessid ] [ E_NAME ] );
|
|
||||||
}
|
|
||||||
g_businessData[ businessid ] [ E_CRACKED ] = true;
|
|
||||||
g_businessData[ businessid ] [ E_CRACKED_TS ] = g_iTime + 180;
|
|
||||||
SendServerMessage( playerid, "You have successfully cracked this business' password. It will not be accessible in 3 minutes." );
|
|
||||||
GivePlayerWantedLevel( playerid, 12 );
|
|
||||||
GivePlayerScore( playerid, 2 );
|
|
||||||
//GivePlayerExperience( playerid, E_BURGLAR );
|
|
||||||
Achievement::HandleBurglaries( playerid );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach ( new ownerid : Player ) if ( IsBusinessAssociate( ownerid, businessid ) ) {
|
|
||||||
SendClientMessageFormatted( ownerid, -1, ""COL_RED"[BURGLARY]"COL_WHITE" %s(%d) failed to break in business %s"COL_WHITE"!", ReturnPlayerName( playerid ), playerid, g_businessData[ businessid ] [ E_NAME ] );
|
|
||||||
}
|
|
||||||
GetZoneFromCoordinates( szLocation, g_businessData[ businessid ] [ E_X ], g_businessData[ businessid ] [ E_Y ], g_businessData[ businessid ] [ E_Z ] );
|
|
||||||
SendClientMessageToCops( -1, ""COL_BLUE"[BURGLARY]"COL_WHITE" %s has failed to crack a business' password near %s.", ReturnPlayerName( playerid ), szLocation );
|
|
||||||
SendClientMessage( playerid, -1, ""COL_GREY"[SERVER]"COL_WHITE" You have failed to crack this business' password." );
|
|
||||||
GivePlayerWantedLevel( playerid, 6 );
|
|
||||||
CreateCrimeReport( playerid );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6563,8 +6518,10 @@ public OnPlayerEnterDynamicCP( playerid, checkpointid )
|
|||||||
if ( g_iTime > g_businessData[ b ] [ E_CRACKED_TS ] && g_businessData[ b ] [ E_CRACKED ] )
|
if ( g_iTime > g_businessData[ b ] [ E_CRACKED_TS ] && g_businessData[ b ] [ E_CRACKED ] )
|
||||||
g_businessData[ b ] [ E_CRACKED ] = false; // The Virus Is Disabled.
|
g_businessData[ b ] [ E_CRACKED ] = false; // The Virus Is Disabled.
|
||||||
|
|
||||||
if ( ! g_businessData[ b ] [ E_CRACKED ] && ! IsBusinessAssociate( playerid, b ) )
|
if ( ! g_businessData[ b ] [ E_CRACKED ] && ! IsBusinessAssociate( playerid, b ) ) {
|
||||||
|
CallLocalFunction( "OnPlayerAttemptBreakIn", "ddd", playerid, -1, b ); // attempting a break in as a burglar/cop
|
||||||
return SendError( playerid, "You cannot access this business as you are not an associate of it." );
|
return SendError( playerid, "You cannot access this business as you are not an associate of it." );
|
||||||
|
}
|
||||||
|
|
||||||
new
|
new
|
||||||
bType = g_businessData[ b ] [ E_INTERIOR_TYPE ];
|
bType = g_businessData[ b ] [ E_INTERIOR_TYPE ];
|
||||||
@ -6609,11 +6566,8 @@ public OnPlayerEnterDynamicCP( playerid, checkpointid )
|
|||||||
|
|
||||||
if ( ! g_houseData[ i ] [ E_CRACKED ] && ! strmatch( g_houseData[ i ] [ E_PASSWORD ], "N/A" ) && ! is_owner )
|
if ( ! g_houseData[ i ] [ E_CRACKED ] && ! strmatch( g_houseData[ i ] [ E_PASSWORD ], "N/A" ) && ! is_owner )
|
||||||
{
|
{
|
||||||
if ( IsPlayerJob( playerid, JOB_BURGLAR ) || GetPlayerClass( playerid ) == CLASS_POLICE ) {
|
|
||||||
CallLocalFunction( "OnPlayerAttemptBurglary", "ddd", playerid, houseid, -1 ); // attempting a break in as a burglar/cop
|
|
||||||
}
|
|
||||||
|
|
||||||
p_PasswordedHouse[ playerid ] = i;
|
p_PasswordedHouse[ playerid ] = i;
|
||||||
|
CallLocalFunction( "OnPlayerAttemptBreakIn", "ddd", playerid, i, -1 ); // attempting a break in as a burglar/cop
|
||||||
ShowPlayerDialog( playerid, DIALOG_HOUSE_PW, DIALOG_STYLE_PASSWORD, "{FFFFFF}House Authentication", ""COL_GREEN"This house is password locked!\n"COL_WHITE"You may only enter this house if you enter the correct password.", "Enter", "Cancel" );
|
ShowPlayerDialog( playerid, DIALOG_HOUSE_PW, DIALOG_STYLE_PASSWORD, "{FFFFFF}House Authentication", ""COL_GREEN"This house is password locked!\n"COL_WHITE"You may only enter this house if you enter the correct password.", "Enter", "Cancel" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user