Merged in Adjustments (pull request #52)

Adjustments
This commit is contained in:
Damen DeBerry 2019-01-14 09:14:34 +00:00 committed by Lorenc Pekaj
commit 32715d9245
6 changed files with 67 additions and 63 deletions

View File

@ -278,6 +278,8 @@ stock ArrestPlayer( victimid, playerid )
GivePlayerSeasonalXP( victimid, -20.0 );
SendGlobalMessage( -1, ""COL_GOLD"[JAIL]{FFFFFF} %s(%d) has sent %s(%d) to jail for %d seconds!", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( victimid ), victimid, totalSeconds );
JailPlayer( victimid, totalSeconds );
KillTimer( p_AwaitingBCAttemptTimer[ victimid ] );
p_AwaitingBCAttemptTimer[ playerid ] = SetTimerEx( "BreakPlayerCuffsAttempt", 3000, false, "d", victimid );
return 1;
}
else return SendError( playerid, "There are no players around to arrest." );
@ -312,40 +314,29 @@ stock CuffPlayer( victimid, playerid )
if ( GetPlayerState( playerid ) == PLAYER_STATE_WASTED ) return SendError( playerid, "You cannot use this command since you are dead." );
if ( !IsPlayerSpawned( victimid ) ) return SendError( playerid, "The player must be spawned." );
new
break_attempts = 0;
if ( ! BreakPlayerCuffs( victimid, break_attempts ) )
if ( !BreakPlayerCuffs( victimid ) )
{
GameTextForPlayer( victimid, "~n~~r~CUFFED!", 2000, 4 );
//GameTextForPlayer( playerid, sprintf( "~n~~y~~h~/arrest %d", victimid ), 2000, 4 );
GameTextForPlayer( playerid, "~n~~y~~h~/arrest", 2000, 4 );
SendClientMessageFormatted( victimid, -1, ""COL_RED"[CUFFED]{FFFFFF} You have been cuffed by %s(%d)!", ReturnPlayerName( playerid ), playerid );
SendClientMessageFormatted( playerid, -1, ""COL_GREEN"[CUFFED]{FFFFFF} You have cuffed %s(%d)!", ReturnPlayerName( victimid ), victimid );
KillTimer( p_CuffAbuseTimer[ victimid ] );
p_CuffAbuseTimer[ victimid ] = SetTimerEx( "Uncuff", ( 60 * 1000 ), false, "d", victimid );
//ApplyAnimation( victimid, "ped", "cower", 5.0, 1, 1, 1, 0, 0 );
//TogglePlayerControllable( victimid, 0 );
p_Cuffed{ victimid } = true;
p_QuitToAvoidTimestamp[ victimid ] = g_iTime + 3;
SetPlayerAttachedObject( victimid, 2, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000 );
SetPlayerSpecialAction( victimid, SPECIAL_ACTION_CUFFED );
ShowPlayerHelpDialog( victimid, 4000, "You can buy bobby pins at Supa Save or a 24/7 store to break cuffs." );
}
else
{
if ( break_attempts )
{
new
money_dropped = RandomEx( 200, 400 ) * break_attempts;
SendClientMessageFormatted( playerid, -1, ""COL_GREEN"[CUFFED]{FFFFFF} %s(%d) just broke their cuffs off, and dropped %s!", ReturnPlayerName( victimid ), victimid, cash_format( money_dropped ) );
GivePlayerCash( playerid, money_dropped );
KillTimer( p_CuffAbuseTimer[ victimid ] );
p_CuffAbuseTimer[ victimid ] = SetTimerEx( "Uncuff", ( 60 * 1000 ), false, "d", victimid );
p_AwaitingBCAttempt[ victimid ] = true;
KillTimer( p_AwaitingBCAttemptTimer[ victimid ] );
p_AwaitingBCAttemptTimer[ victimid ] = SetTimerEx( "BreakPlayerCuffsAttempt", 3000, false, "d", victimid );
}
else
{
SendClientMessageFormatted( playerid, -1, ""COL_GREEN"[CUFFED]{FFFFFF} %s(%d) just broke their cuffs off!", ReturnPlayerName( victimid ), victimid );
}
SendClientMessageFormatted( playerid, -1, ""COL_GREEN"[CUFFED]{FFFFFF} %s(%d) just broke their cuffs off!", ReturnPlayerName( victimid ) );
}
return 1;
}

View File

@ -9,7 +9,7 @@
#include < YSI\y_hooks >
/* ** Definitions ** */
#define JAIL_SECONDS_MULTIPLIER ( 3 )
#define JAIL_SECONDS_MULTIPLIER ( 2 )
#define ALCATRAZ_REQUIRED_TIME ( 150 )
#define ALCATRAZ_TIME_PAUSE ( 5 )

View File

@ -190,6 +190,7 @@ stock GetShopItemAmount( playerid, id )
case SHOP_ITEM_DRILL: return p_drillStrength[ playerid ];
case SHOP_ITEM_METAL_MELTER: return p_MetalMelter[ playerid ];
case SHOP_ITEM_WEED_SEED: return g_playerShopItems[ playerid ] [ SHOP_ITEM_WEED_SEED ];
case SHOP_ITEM_FIREWORKS: return p_Fireworks[ playerid ];
}
return 0;
}
@ -211,6 +212,7 @@ stock SetPlayerShopItemAmount( playerid, id, value )
case SHOP_ITEM_DRILL: p_drillStrength[ playerid ] = value;
case SHOP_ITEM_METAL_MELTER: p_MetalMelter[ playerid ] = value;
case SHOP_ITEM_WEED_SEED: g_playerShopItems[ playerid ] [ SHOP_ITEM_WEED_SEED ] = value;
case SHOP_ITEM_FIREWORKS: p_Fireworks[ playerid ] = value;
}
return 1;
}

View File

@ -11,7 +11,7 @@
/* ** Definitions ** */
#define POCKET_RADIUS ( 0.09 )
#define POOL_TIMER_SPEED ( 30 )
#define POOL_TIMER_SPEED ( 25 )
#define DEFAULT_AIM ( 0.38 )
#define DEFAULT_POOL_STRING "Pool Table\n{FFFFFF}Press ENTER To Play"
#define POOL_FEE_RATE ( 0.02 )

View File

@ -29,6 +29,8 @@ new
bool: p_Tazed [ MAX_PLAYERS char ],
p_LastVehicle [ MAX_PLAYERS ] = { INVALID_VEHICLE_ID, ... },
bool: p_Cuffed [ MAX_PLAYERS char ],
bool: p_AwaitingBCAttempt [ MAX_PLAYERS ],
p_AwaitingBCAttemptTimer [ MAX_PLAYERS ],
p_CuffAbuseTimer [ MAX_PLAYERS ],
p_AntiRobSpam [ MAX_PLAYERS ],
p_AntiRapeSpam [ MAX_PLAYERS ],

View File

@ -515,6 +515,7 @@ public OnPlayerDisconnect( playerid, reason )
p_AntiEMP [ playerid ] = 0;
p_LastVehicle [ playerid ] = INVALID_VEHICLE_ID;
p_Cuffed { playerid } = false;
p_AwaitingBCAttempt[ playerid ] = false;
justConnected { playerid } = true;
p_Muted { playerid } = false;
p_MetalMelter [ playerid ] = 0;
@ -593,6 +594,7 @@ public OnPlayerDisconnect( playerid, reason )
DestroyAllPlayerC4s( playerid, true );
KillTimer( p_JailTimer[ playerid ] );
KillTimer( p_CuffAbuseTimer[ playerid ] );
KillTimer( p_AwaitingBCAttemptTimer[ playerid ] );
ResetPlayerCash( playerid );
if ( !GetPVarInt( playerid, "banned_connection" ) ) SendDeathMessage( INVALID_PLAYER_ID, playerid, 201 );
@ -665,6 +667,8 @@ public OnPlayerSpawn( playerid )
CancelEdit( playerid );
HidePlayerHelpDialog( playerid );
KillTimer( p_AwaitingBCAttemptTimer[ playerid ] );
// Money Bags
if ( p_MoneyBag{ playerid } && p_Class[ playerid ] != CLASS_POLICE ) // SetPlayerAttachedObject( playerid, 1, 1550, 1, 0.131999, -0.140999, 0.053999, 11.299997, 65.599906, 173.900054, 0.652000, 0.573000, 0.594000 );
RemovePlayerAttachedObject( playerid, 1 ), SetPlayerAttachedObject( playerid, 1, 1210, 7, 0.302650, -0.002469, -0.193321, 296.124053, 270.396881, 8.941717, 1.000000, 1.000000, 1.000000 );
@ -1194,6 +1198,7 @@ public OnPlayerDeath( playerid, killerid, reason )
RemovePlayerStolensFromHands( playerid );
RemoveEquippedOre( playerid );
KillTimer( p_CuffAbuseTimer[ playerid ] );
KillTimer( p_AwaitingBCAttemptTimer[ playerid ] );
PlayerTextDrawHide( playerid, p_LocationTD[ playerid ] );
p_Tazed{ playerid } = false;
p_WeaponDealing{ playerid } = false;
@ -7102,55 +7107,59 @@ stock ShowPlayerSpawnMenu( playerid ) {
return ShowPlayerDialog( playerid, DIALOG_SPAWN, DIALOG_STYLE_LIST, "{FFFFFF}Spawn Location", ""COL_GREY"Reset Back To Default\nHouse\nBusiness\nGang Facility\nVisage Casino", "Select", "Cancel" );
}
stock BreakPlayerCuffs( playerid, &attempts = 0 )
stock BreakPlayerCuffs( playerid )
{
if ( !IsPlayerConnected( playerid ) ) return false;
if ( p_BobbyPins[ playerid ] < 1 )
return 0;
new Float: police_percentage;
new bool: success = false;
// get current police percentage
GetServerPoliceRatio( police_percentage );
// probability based off some factors
new probability = 15 + floatround( police_percentage, floatround_floor );
// attempt to uncuff
for ( attempts = 1; attempts < p_BobbyPins[ playerid ]; attempts ++ )
{
if ( random( 101 ) <= probability ) { // 35% success rate RIP!
success = true;
break;
}
ShowPlayerHelpDialog( playerid, 4000, "You can buy bobby pins at Supa Save or a 24/7 store to break cuffs." );
return false;
}
else p_BobbyPins[ playerid ]--;
if ( ( p_BobbyPins[ playerid ] -= attempts ) > 0 ) {
ShowPlayerHelpDialog( playerid, 5000, "You only have %d bobby pins left!", p_BobbyPins[ playerid ] );
}
if ( p_AwaitingBCAttempt[ playerid ] ) p_AwaitingBCAttempt[ playerid ] = false;
if ( success ) {
/*TogglePlayerControllable( playerid, 1 );
new probability = 60;
if ( random( 101 ) <= probability )
{
if ( !IsPlayerCuffed( playerid ) )
{
Untaze( playerid, 10 );
GivePlayerWantedLevel( playerid, 6 );
}
else
{
if ( !IsPlayerAttachedObjectSlotUsed( playerid, 2 ) )
return false;
TogglePlayerControllable( playerid, 1 );
RemovePlayerAttachedObject( playerid, 2 );
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_NONE );
if ( !IsPlayerInAnyVehicle( playerid ) ) {
ClearAnimations( playerid );
}
p_Cuffed{ playerid } = false;
p_Tazed{ playerid } = false;
//p_Detained{ playerid } = false;
//Delete3DTextLabel( p_DetainedLabel[ playerid ] );
//p_DetainedLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID;
//p_DetainedBy[ playerid ] = INVALID_PLAYER_ID;*/
Untaze( playerid, 10 );
SendServerMessage( playerid, "You have used %d bobby pins to successfully break your cuffs.", attempts );
GivePlayerWantedLevel( playerid, 6 );
} else {
SendError( playerid, "You snapped %d bobby pin(s) and failed to break out of your cuffs.", attempts );
p_BulletInvulnerbility[ playerid ] = g_iTime + 5;
}
SendServerMessage( playerid, "You have successfully broken out of your cuffs!" );
return true;
}
else
{
SendServerMessage( playerid, "You have snapped your bobby pin and failed to break out of your cuffs. Re-attempting in 3 seconds." );
p_AwaitingBCAttempt[ playerid ] = true;
KillTimer( p_AwaitingBCAttemptTimer[ playerid ] );
p_AwaitingBCAttemptTimer[ playerid ] = SetTimerEx( "BreakPlayerCuffsAttempt", 3000, false, "d", playerid );
return false;
}
return 1;
}
function BreakPlayerCuffsAttempt( playerid ) return BreakPlayerCuffs( playerid );
stock IsPlayerAFK( playerid ) return ( ( GetTickCount( ) - p_AFKTime[ playerid ] ) >= 2595 );
stock GetPlayerVIPDuration( playerid ) return p_VIPExpiretime[ playerid ] - g_iTime;