From 11b0621e13ab7f98d0e35a15facebdd750e56a99 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Mon, 24 Sep 2018 18:18:07 +1000 Subject: [PATCH] adds passive mode, readjust settings (see updates.txt) --- .../cnr/commands/admin/admin_four.pwn | 6 +- .../cnr/features/minijobs/traindriver.pwn | 30 ++----- .../cnr/features/vehicles/vehicles.pwn | 20 ++--- .../irresistible/cnr/features/weapon_drop.pwn | 2 +- gamemodes/irresistible/cnr/player.pwn | 3 +- .../irresistible/cnr/player_settings.pwn | 50 +++++------ gamemodes/sf-cnr.pwn | 88 ++++++++++++------- scriptfiles/updates.txt | 17 ++-- 8 files changed, 112 insertions(+), 104 deletions(-) diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_four.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_four.pwn index 95be870..3635be4 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_four.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_four.pwn @@ -147,7 +147,7 @@ CMD:resetwepall( playerid, params[ ] ) foreach(new pID : Player) { - if ( !IsPlayerSpawned( pID ) || ! IsPlayerSettingToggled( pID, SETTING_EVENT_TP ) ) + if ( !IsPlayerSpawned( pID ) || IsPlayerSettingToggled( pID, SETTING_EVENT_TP ) ) continue; if ( IsPlayerAFK( playerid ) ) @@ -184,7 +184,7 @@ CMD:giveweaponall( playerid, params[ ] ) foreach(new pID : Player) { - if ( !IsPlayerSpawned( pID ) || IsPlayerJailed( pID ) || ! IsPlayerSettingToggled( pID, SETTING_EVENT_TP ) ) + if ( !IsPlayerSpawned( pID ) || IsPlayerJailed( pID ) || IsPlayerSettingToggled( pID, SETTING_EVENT_TP ) ) continue; if ( IsPlayerAFK( playerid ) ) @@ -223,7 +223,7 @@ CMD:circleall( playerid, params[ ] ) GetPlayerPos( playerid, nX, nY, nZ ); foreach(new i : Player) { - if ( IsPlayerSpawned( i ) && i != playerid && !IsPlayerJailed( i ) && IsPlayerSettingToggled( i, SETTING_EVENT_TP ) ) + if ( IsPlayerSpawned( i ) && i != playerid && !IsPlayerJailed( i ) && ! IsPlayerSettingToggled( i, SETTING_EVENT_TP ) ) { if ( !allowcop && p_Class[ i ] == CLASS_POLICE ) continue; diff --git a/gamemodes/irresistible/cnr/features/minijobs/traindriver.pwn b/gamemodes/irresistible/cnr/features/minijobs/traindriver.pwn index b1956e4..010da94 100644 --- a/gamemodes/irresistible/cnr/features/minijobs/traindriver.pwn +++ b/gamemodes/irresistible/cnr/features/minijobs/traindriver.pwn @@ -71,36 +71,24 @@ hook OnPlayerDeath( playerid, killerid, reason ) return 1; } -/*hook OnPlayerUpdateEx( playerid ) -{ - new player_vehicle = GetPlayerVehicleID( playerid ); - - if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER && player_vehicle && p_hasTrainJob{ playerid } && !IsVehicleTrain( player_vehicle ) && p_TrainCancelTimer[ playerid ] == -1 ) { - cancelPlayerTrainWork( playerid, player_vehicle, .ticks = 60 ); - } - return 1; -}*/ - hook OnPlayerStateChange( playerid, newstate, oldstate ) { + new + vehicleid = GetPlayerVehicleID( playerid ); + if ( newstate != PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_DRIVER && p_hasTrainJob{ playerid } ) { KillTimer( p_TrainCancelTimer[ playerid ] ); // just in-case - cancelPlayerTrainWork( playerid, GetPlayerVehicleID( playerid ), 15 ); + cancelPlayerTrainWork( playerid, 15 ); } - else if ( newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER && p_hasTrainJob{ playerid } ) { + else if ( newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER && p_hasTrainJob{ playerid } && IsVehicleTrain( vehicleid ) ) { KillTimer( p_TrainCancelTimer[ playerid ] ); p_TrainCancelTimer[ playerid ] = -1; } - else if ( newstate == PLAYER_STATE_DRIVER && IsPlayerInAnyVehicle(playerid) && !p_hasTrainJob{ playerid }) - { - if ( IsVehicleTrain( GetPlayerVehicleID( playerid ) ) ) - { - ShowPlayerHelpDialog( playerid, 3000, "You can begin a train job by typing ~g~/train" ); - } + else if ( newstate == PLAYER_STATE_DRIVER && IsPlayerInAnyVehicle( playerid ) && !p_hasTrainJob{ playerid } && IsVehicleTrain( vehicleid ) ) { + ShowPlayerHelpDialog( playerid, 5000, "You can begin a train job by typing ~g~/train" ); } - return 1; } @@ -220,7 +208,7 @@ function OnTrainPositionUpdate( playerid, routeid ) return 1; } -function cancelPlayerTrainWork( playerid, vehicleid, ticks ) +function cancelPlayerTrainWork( playerid, ticks ) { if ( ticks < 1 || !IsPlayerConnected( playerid ) || !IsPlayerSpawned( playerid ) || ! p_hasTrainJob{ playerid } ) { @@ -230,7 +218,7 @@ function cancelPlayerTrainWork( playerid, vehicleid, ticks ) else { ShowPlayerHelpDialog( playerid, 1000, "You have %d seconds to get back inside the train you were using.", ticks - 1 ); - p_TrainCancelTimer[ playerid ] = SetTimerEx( "cancelPlayerTrainWork", 980, false, "ddd", playerid, vehicleid, ticks - 1 ); + p_TrainCancelTimer[ playerid ] = SetTimerEx( "cancelPlayerTrainWork", 980, false, "dd", playerid, ticks - 1 ); } return 1; } diff --git a/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn b/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn index 54d3fa5..7c7030c 100644 --- a/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn +++ b/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn @@ -129,7 +129,15 @@ hook OnPlayerDriveVehicle( playerid, vehicleid ) return 1; // ignore if unowned/erroneous } - if ( ownerid != playerid ) + if ( ownerid == playerid ) + { + SendClientMessage(playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" Welcome back to your vehicle."); + Beep( playerid ); + GetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, objective ); + SetVehicleParamsEx( vehicleid, VEHICLE_PARAMS_ON, lights, VEHICLE_PARAMS_OFF, doors, bonnet, boot, objective ); + return 1; + } + else { if ( g_vehicleData[ ownerid ] [ slotid ] [ E_LOCKED ] == true ) { @@ -152,16 +160,8 @@ hook OnPlayerDriveVehicle( playerid, vehicleid ) } else SendClientMessage( playerid, -1, ""COL_PINK"[ADMIN]"COL_GREY" This is a locked vehicle." ); } + else SendClientMessageFormatted( playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" This vehicle is owned by %s.", ReturnPlayerName( ownerid ) ); } - else if ( ownerid == playerid ) - { - SendClientMessage(playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" Welcome back to your vehicle."); - Beep( playerid ); - GetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, objective ); - SetVehicleParamsEx( vehicleid, VEHICLE_PARAMS_ON, lights, VEHICLE_PARAMS_OFF, doors, bonnet, boot, objective ); - return 1; - } - else SendClientMessageFormatted( playerid, -1, ""COL_GREY"[VEHICLE]"COL_WHITE" This vehicle is owned by %s.", ReturnPlayerName( ownerid ) ); } return 1; } diff --git a/gamemodes/irresistible/cnr/features/weapon_drop.pwn b/gamemodes/irresistible/cnr/features/weapon_drop.pwn index 5ee686c..ec93f69 100644 --- a/gamemodes/irresistible/cnr/features/weapon_drop.pwn +++ b/gamemodes/irresistible/cnr/features/weapon_drop.pwn @@ -133,7 +133,7 @@ hook OnPlayerPickUpDynPickup( playerid, pickupid ) new setting_enabled = IsPlayerSettingToggled( playerid, SETTING_WEAPON_PICKUP ); - if ( ! setting_enabled || ( setting_enabled && existing_weapon != g_weaponDropData[ dropid ] [ E_WEAPON_ID ] && existing_ammo ) ) + if ( setting_enabled || ( ! setting_enabled && existing_weapon != g_weaponDropData[ dropid ] [ E_WEAPON_ID ] && existing_ammo ) ) { ShowPlayerHelpDialog( playerid, 2500, "Hold ~r~~k~~PED_ANSWER_PHONE~~w~ To Take %s", ReturnWeaponName( g_weaponDropData[ dropid ] [ E_WEAPON_ID ] ) ); return 1; diff --git a/gamemodes/irresistible/cnr/player.pwn b/gamemodes/irresistible/cnr/player.pwn index 270df91..02fa0f8 100644 --- a/gamemodes/irresistible/cnr/player.pwn +++ b/gamemodes/irresistible/cnr/player.pwn @@ -242,7 +242,8 @@ new p_TazingImmunity [ MAX_PLAYERS ], p_PlayerAltBind [ MAX_PLAYERS ] = { -1, ... }, p_PlayerAltBindTick [ MAX_PLAYERS ], - p_AimedAtPolice [ MAX_PLAYERS ] + p_AimedAtPolice [ MAX_PLAYERS ], + bool: p_PassiveModeDisabled [ MAX_PLAYERS char ] ; /* ** Getters And Setters** */ diff --git a/gamemodes/irresistible/cnr/player_settings.pwn b/gamemodes/irresistible/cnr/player_settings.pwn index 6694c38..6d3a807 100644 --- a/gamemodes/irresistible/cnr/player_settings.pwn +++ b/gamemodes/irresistible/cnr/player_settings.pwn @@ -9,7 +9,7 @@ #include < YSI\y_hooks > /* ** Definitions ** */ -#define MAX_SETTINGS ( 12 ) +#define MAX_SETTINGS ( 13 ) #define SETTING_BAILOFFERS ( 0 ) #define SETTING_EVENT_TP ( 1 ) @@ -23,17 +23,14 @@ #define SETTING_COINS_BAR ( 9 ) #define SETTING_TOP_DONOR ( 10 ) #define SETTING_WEAPON_PICKUP ( 11 ) +#define SETTING_PASSIVE_MODE ( 12 ) /* ** Variables ** */ -enum E_SETTING_DATA { - bool: E_DEFAULT_VAL, E_NAME[ 20 ] -}; - static stock - g_PlayerSettings [ ] [ E_SETTING_DATA ] = { - { false, "Bail Offers" }, { false, "Event Teleports" }, { false, "Gang Invites" }, { false, "Chat Prefixes" }, { false, "Ransom Offers" }, - { false, "Auto-Save" }, { true, "Connection Log" }, { true, "Hitmarker" }, { true, "V.I.P Skin" }, { false, "Total Coin Bar" }, { false, "Last Donor Text" }, - { false, "Auto Pickup Weapon" } + g_PlayerSettings [ MAX_SETTINGS ] [ 24 ] = { + { "Prevent Bail Offers" }, { "Prevent Event Teleports" }, { "Prevent Gang Invites" }, { "Prevent Chat Prefixes" }, { "Prevent Ransom Offers" }, + { "Prevent Auto-Save" }, { "Display Connection Log" }, { "Display Hitmarker" }, { "Set V.I.P Skin" }, { "Hide Total Coin Bar" }, { "Hide Last Donor Text" }, + { "Manual Pickup Weapon" }, { "Passive Mode" } }, bool: p_PlayerSettings [ MAX_PLAYERS ] [ MAX_SETTINGS char ] ; @@ -54,36 +51,36 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) new settingid = listitem - 1; + if ( settingid == SETTING_VIPSKIN && p_VIPLevel[ playerid ] < VIP_REGULAR ) { + return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" ); + } + if ( ( p_PlayerSettings[ playerid ] { settingid } = !p_PlayerSettings[ playerid ] { settingid } ) == true ) { - if ( settingid == SETTING_VIPSKIN ) - { - if ( p_VIPLevel[ playerid ] < VIP_REGULAR ) return SendError( playerid, "You are not a V.I.P, to become one visit "COL_GREY"donate.sfcnr.com" ); + if ( settingid == SETTING_VIPSKIN ) { SyncObject( playerid ); ClearAnimations( playerid ); SetPlayerSkin( playerid, p_LastSkin[ playerid ] ); } - else if ( settingid == SETTING_COINS_BAR ) - ShowPlayerTogglableTextdraws( playerid, .force = false ); - - else if ( settingid == SETTING_TOP_DONOR ) - HidePlayerTogglableTextdraws( playerid, .force = false ); + else if ( settingid == SETTING_COINS_BAR || settingid == SETTING_TOP_DONOR ) { + HidePlayerTogglableTextdraws( playerid, .force = false ); + ShowPlayerTogglableTextdraws( playerid, .force = false ); + } format( szNormalString, 68, "INSERT INTO `SETTINGS`(`USER_ID`, `SETTING_ID`) VALUES (%d, %d)", p_AccountID[ playerid ], settingid ); } else { - if ( settingid == SETTING_COINS_BAR ) - HidePlayerTogglableTextdraws( playerid, .force = false ); - - else if ( settingid == SETTING_TOP_DONOR ) + if ( settingid == SETTING_COINS_BAR || settingid == SETTING_TOP_DONOR ) { + HidePlayerTogglableTextdraws( playerid, .force = false ); ShowPlayerTogglableTextdraws( playerid, .force = false ); + } format( szNormalString, 64, "DELETE FROM `SETTINGS` WHERE USER_ID=%d AND SETTING_ID=%d", p_AccountID[ playerid ], settingid ); } mysql_single_query( szNormalString ); - SendServerMessage( playerid, "You have %s "COL_GREY"%s"COL_WHITE". Changes may take effect after spawning/relogging.", p_PlayerSettings[ playerid ] { settingid } != g_PlayerSettings[ settingid ] [ E_DEFAULT_VAL ] ? ( "disabled" ) : ( "enabled" ), g_PlayerSettings[ settingid ] [ E_NAME ] ); + SendServerMessage( playerid, "You have %s "COL_GREY"%s"COL_WHITE". Changes may take effect after spawning/relogging.", p_PlayerSettings[ playerid ] { settingid } ? ( "enabled" ) : ( "disabled" ), g_PlayerSettings[ settingid ] ); cmd_cp( playerid, "" ); // Redirect to control panel again... } return 1; @@ -91,7 +88,7 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) hook OnPlayerConnect( playerid ) { for ( new i = 0; i < MAX_SETTINGS; i ++ ) { - p_PlayerSettings[ playerid ] { i } = g_PlayerSettings[ i ] [ E_DEFAULT_VAL ]; + p_PlayerSettings[ playerid ] { i } = false; } return 1; } @@ -131,12 +128,13 @@ thread OnSettingsLoad( playerid ) /* ** Commands ** */ CMD:cp( playerid, params[ ] ) return cmd_controlpanel( playerid, params ); +CMD:settings( playerid, params[ ] ) return cmd_controlpanel( playerid, params ); CMD:controlpanel( playerid, params[ ] ) { - szLargeString = ""COL_WHITE"Setting\t"COL_WHITE"Status\t"COL_WHITE"Default\n"COL_GREY"Irresistible Guard\t \t"COL_GREY">>>\n"; + szLargeString = ""COL_WHITE"Setting\t"COL_WHITE"Status\n"COL_GREY"Irresistible Guard\t"COL_ORANGE">>>\n"; for( new i = 0; i < MAX_SETTINGS; i++ ) { - format( szLargeString, 600, "%s%s\t%s\t"COL_GREY"%s\n", szLargeString, g_PlayerSettings[ i ] [ E_NAME ], p_PlayerSettings[ playerid ] { i } == g_PlayerSettings[ i ] [ E_DEFAULT_VAL ] ? ( ""#COL_GREEN"enabled" ) : ( ""#COL_RED"disabled" ), g_PlayerSettings[ i ] [ E_DEFAULT_VAL ] ? ( "disabled" ) : ( "enabled" ) ); + format( szLargeString, sizeof( szLargeString ), "%s%s\t%s\n", szLargeString, g_PlayerSettings[ i ], p_PlayerSettings[ playerid ] { i } ? ( ""#COL_GREEN"YES" ) : ( ""#COL_RED"NO" ) ); } ShowPlayerDialog( playerid, DIALOG_CP_MENU, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Control Panel", szLargeString, "Select", "Cancel" ); @@ -145,5 +143,5 @@ CMD:controlpanel( playerid, params[ ] ) /* ** Functions ** */ stock IsPlayerSettingToggled( playerid, settingid ) { - return p_PlayerSettings[ playerid ] { settingid } == g_PlayerSettings[ settingid ] [ E_DEFAULT_VAL ]; + return p_PlayerSettings[ playerid ] { settingid }; } diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 1ae5d97..f30f329 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -16,7 +16,7 @@ #pragma option -d3 #pragma dynamic 7200000 -//#define DEBUG_MODE +// #define DEBUG_MODE #if defined DEBUG_MODE #pragma option -d3 @@ -725,7 +725,7 @@ new { true , "Scissors", "Automatically cut ties", LIMIT_SCISSORS, 1100, 6 }, // 5 { true , "Rope", "/tie", LIMIT_ROPES, 2250, 7 }, // 8 [1500] { true , "Aluminium Foil", "Automatically deflect EMP", LIMIT_FOIL, 3400, 9 }, // 9 - { true , "Bobby Pin", "Automatically break cuffs", LIMIT_PINS, 3650, 8 }, // 6 [1000] -makecopgreatagain + { true , "Bobby Pin", "Automatically break cuffs", LIMIT_PINS, 3900, 8 }, // 6 [1000] -makecopgreatagain { false, "Money Case", "Increases robbing amount", LIMIT_ONE, 4500, 10 }, // 7 [1250] { true , "Thermal Drill", "Halves safe cracking time", LIMIT_ONE, 5000, 11 }, // 10 { true , "Metal Melter", "/breakout", LIMIT_MELTER, 7500, 12 } // 11 @@ -2565,7 +2565,7 @@ public OnServerUpdateTimer( ) ClearPlayerRoadblocks( playerid ); // Toggle total coin bar - if ( IsPlayerSettingToggled( playerid, SETTING_COINS_BAR ) ) + if ( ! IsPlayerSettingToggled( playerid, SETTING_COINS_BAR ) ) PlayerTextDrawSetString( playerid, p_CoinsTD[ playerid ], sprintf( "%05.3f", p_IrresistibleCoins[ playerid ] ) ); // Decrementing Weed Opacity Label @@ -3247,13 +3247,8 @@ public ZoneTimer( ) UpdatePlayerTime( playerid ); // Remove Anti-Spawn Kill - if ( p_AntiSpawnKillEnabled{ playerid } && g_iTime > p_AntiSpawnKill[ playerid ] ) - { - DisableRemoteVehicleCollisions( playerid, p_AdminOnDuty{ playerid } ); - SetPlayerHealth( playerid, p_AdminOnDuty{ playerid } == true ? float( INVALID_PLAYER_ID ) : 100.0 ); - Delete3DTextLabel( p_SpawnKillLabel[ playerid ] ); - p_SpawnKillLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID; - p_AntiSpawnKillEnabled{ playerid } = false; + if ( p_AntiSpawnKillEnabled{ playerid } && g_iTime > p_AntiSpawnKill[ playerid ] ) { + DisablePlayerSpawnProtection( playerid ); } // Increment Variables Whilst Not AFK @@ -3898,6 +3893,7 @@ public OnPlayerDisconnect( playerid, reason ) p_CasinoRewardsPoints[ playerid ] = 0.0; p_OwnedBusinesses[ playerid ] = 0; g_LastExportModel[ playerid ] = 0; + p_PassiveModeDisabled{ playerid } = false; p_ExplosiveBullets[ playerid ] = 0; p_GangSplitProfits[ playerid ] = 0; p_IrresistibleCoins[ playerid ] = 0.0; @@ -4146,14 +4142,13 @@ public OnPlayerSpawn( playerid ) } /* ** Anti-Spawn Kill ** */ - DisableRemoteVehicleCollisions( playerid, 1 ); + DisableRemoteVehicleCollisions( playerid, p_AdminOnDuty{ playerid } ); SetPlayerHealth( playerid, INVALID_PLAYER_ID ); Delete3DTextLabel( p_SpawnKillLabel[ playerid ] ); - p_SpawnKillLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID; - p_SpawnKillLabel[ playerid ] = Create3DTextLabel( "Spawn Protected!", COLOR_GOLD, 0.0, 0.0, 0.0, 15.0, 0 ); + p_SpawnKillLabel[ playerid ] = Create3DTextLabel( "Spawn Protected!", COLOR_GOLD, 0.0, 0.0, 0.0, 15.0, 0 ); + p_AntiSpawnKill[ playerid ] = g_iTime + 15; Attach3DTextLabelToPlayer( p_SpawnKillLabel[ playerid ], playerid, 0.0, 0.0, 0.3 ); p_AntiSpawnKillEnabled{ playerid } = true; - p_AntiSpawnKill[ playerid ] = g_iTime + 15; /* ** Anti-Spawn Kill ** */ if ( p_Class[ playerid ] == CLASS_CIVILIAN ) @@ -4301,8 +4296,9 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float:fX, Float:f if ( IsPlayerConnected( hitid ) && ( IsPlayerTazed( hitid ) || IsPlayerCuffed( hitid ) || IsPlayerKidnapped( hitid ) || IsPlayerTied( hitid ) || IsPlayerLoadingObjects( hitid ) || IsPlayerAdminOnDuty( hitid ) || p_AntiSpawnKillEnabled{ hitid } ) ) return 0; - if ( p_AntiSpawnKill[ playerid ] > g_iTime && p_AntiSpawnKillEnabled{ playerid } ) - return ( p_AntiSpawnKill[ playerid ] = 0 ), SendServerMessage( playerid, "Your spawn protection is no longer active!" ), 0; + if ( p_AntiSpawnKill[ playerid ] > g_iTime && p_AntiSpawnKillEnabled{ playerid } ) { + return DisablePlayerSpawnProtection( playerid ), SendServerMessage( playerid, "Your spawn protection is no longer active!" ), 0; + } } else if ( hittype == BULLET_HIT_TYPE_VEHICLE ) @@ -4621,12 +4617,25 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b // Anti RDM and gang member damage if ( ! IsPlayerInEvent( playerid ) && ! IsPlayerInPaintBall( playerid ) && ! IsPlayerBoxing( playerid ) && ! IsPlayerDueling( playerid ) ) { - if ( IsPlayerInPlayerGang( issuerid, playerid ) ) + if ( IsPlayerInPlayerGang( issuerid, playerid ) ) { return ShowPlayerHelpDialog( issuerid, 2000, "You cannot damage your homies!" ), 0; + } + + // Passive mode enabled for damaged id? + if ( IsPlayerPassiveModeEnabled( playerid ) ) { + return ShowPlayerHelpDialog( issuerid, 2000, "~r~~h~This player has passive mode enabled." ), 0; + } + + // Passive mode enabled for player? + if ( IsPlayerPassiveModeEnabled( issuerid ) ) { + p_PassiveModeDisabled{ issuerid } = true; + return ShowPlayerHelpDialog( issuerid, 2000, "~r~~h~Passive mode disabled!" ), 0; + } // Anti Random Deathmatch - if ( IsRandomDeathmatch( issuerid, playerid ) ) - return ShowPlayerHelpDialog( issuerid, 2000, "You cannot ~r~~h~random deathmatch~w~~h~ in this location!" ), 0; + if ( IsRandomDeathmatch( issuerid, playerid ) ) { + return ShowPlayerHelpDialog( issuerid, 2000, "~r~~h~This player cannot be random deathmatched." ), 0; + } } // No passenger, no bullets @@ -4640,8 +4649,9 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b } // Wanted on shoot! - if ( p_WantedLevel[ issuerid ] <= 2 && p_Class[ issuerid ] != CLASS_POLICE && p_Class[ playerid ] == CLASS_POLICE && GetPVarInt( issuerid, "ShotCopWantedCD" ) < g_iTime ) + if ( p_WantedLevel[ issuerid ] <= 2 && p_Class[ issuerid ] != CLASS_POLICE && p_Class[ playerid ] == CLASS_POLICE && GetPVarInt( issuerid, "ShotCopWantedCD" ) < g_iTime ) { GivePlayerWantedLevel( issuerid, 6 ), SetPVarInt( issuerid, "ShotCopWantedCD", g_iTime + 120 ); + } // Headshots if ( ( weaponid == WEAPON_SNIPER || weaponid == WEAPON_RIFLE ) && bodypart == 9 ) @@ -4842,6 +4852,7 @@ public OnPlayerDeath( playerid, killerid, reason ) DestroyDynamic3DTextLabel( p_WeedLabel[ playerid ] ); p_WeedLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID; p_Tied{ playerid } = false; + p_PassiveModeDisabled{ playerid } = false; p_TicketTimestamp[ playerid ] = 0; p_Kidnapped{ playerid } = false; //p_Detained{ playerid } = false; @@ -5323,7 +5334,7 @@ public OnPlayerText( playerid, text[ ] ) return 1; } -function Untaze( playerid ) +function Untaze( playerid, taze_immunity_seconds ) { if ( !IsPlayerConnected( playerid ) || !p_Tazed{ playerid } ) // || p_Detained{ playerid } == true return 0; @@ -5336,7 +5347,7 @@ function Untaze( playerid ) ClearAnimations( playerid ); p_BulletInvulnerbility[ playerid ] = g_iTime + 3; - p_TazingImmunity[ playerid ] = g_iTime + 6; + p_TazingImmunity[ playerid ] = g_iTime + taze_immunity_seconds; p_Tazed{ playerid } = false; return 1; } @@ -22348,6 +22359,9 @@ stock IsRandomDeathmatch( issuerid, damagedid ) if ( IsPlayerBoxing( issuerid ) ) return false; + if ( IsPlayerPassiveModeEnabled( damagedid ) ) + return true; + if ( ! IsPlayerInCasino( issuerid ) || ! IsPlayerInCasino( damagedid ) ) return false; @@ -22612,13 +22626,13 @@ stock CreateBusinessActors( businessid ) stock ShowPlayerTogglableTextdraws( playerid, bool: force = false ) { // Current Coins - if ( IsPlayerSettingToggled( playerid, SETTING_COINS_BAR ) || force ) { + if ( ! IsPlayerSettingToggled( playerid, SETTING_COINS_BAR ) || force ) { TextDrawShowForPlayer( playerid, g_CurrentCoinsTD ); PlayerTextDrawShow( playerid, p_CoinsTD[ playerid ] ); } // Top donor - if ( IsPlayerSettingToggled( playerid, SETTING_TOP_DONOR ) || force ) { + if ( ! IsPlayerSettingToggled( playerid, SETTING_TOP_DONOR ) || force ) { TextDrawShowForPlayer( playerid, g_TopDonorTD ); } } @@ -22626,13 +22640,13 @@ stock ShowPlayerTogglableTextdraws( playerid, bool: force = false ) stock HidePlayerTogglableTextdraws( playerid, bool: force = true ) { // Current Coins - if ( ! IsPlayerSettingToggled( playerid, SETTING_COINS_BAR ) || force ) { + if ( IsPlayerSettingToggled( playerid, SETTING_COINS_BAR ) || force ) { TextDrawHideForPlayer( playerid, g_CurrentCoinsTD ); PlayerTextDrawHide( playerid, p_CoinsTD[ playerid ] ); } // Top donor - if ( ! IsPlayerSettingToggled( playerid, SETTING_TOP_DONOR ) || force ) { + if ( IsPlayerSettingToggled( playerid, SETTING_TOP_DONOR ) || force ) { TextDrawHideForPlayer( playerid, g_TopDonorTD ); } } @@ -25446,7 +25460,7 @@ stock TazePlayer( victimid, playerid ) GameTextForPlayer( playerid, "~n~~y~~h~/cuff", 2000, 4 ); SendClientMessageFormatted( victimid, -1, ""COL_RED"[TAZED]{FFFFFF} You have been tazed by %s(%d) for 3 seconds!", ReturnPlayerName( playerid ), playerid ); SendClientMessageFormatted( playerid, -1, ""COL_GREEN"[TAZED]{FFFFFF} You have tazed %s(%d) for 3 seconds!", ReturnPlayerName( victimid ), victimid ); - SetTimerEx( "Untaze", 2000, false, "d", victimid ); // previous 3000 + SetTimerEx( "Untaze", 2000, false, "dd", victimid, 6 ); // previous 3000 TogglePlayerControllable( victimid, 0 ); ApplyAnimation( victimid, "CRACK", "crckdeth2", 5.0, 1, 1, 1, 0, 0 ); p_Tazed{ victimid } = true; @@ -25493,7 +25507,7 @@ stock ArrestPlayer( victimid, playerid ) SendClientMessageFormatted( playerid, -1, ""COL_GREEN"[ACHIEVE]{FFFFFF} You have earned "COL_GOLD"%s{FFFFFF} dollars and 2 score for arresting %s(%d)!", cash_format( totalCash ), ReturnPlayerName( victimid ), victimid ); GameTextForPlayer( victimid, "~r~Busted!", 4000, 0 ); CallLocalFunction( "OnPlayerArrested", "dddd", playerid, victimid, p_Arrests[ playerid ], 1 ); - Untaze( victimid ); + Untaze( victimid, 6 ); GivePlayerIrresistiblePoints( victimid, -2 ); 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 ); @@ -25583,7 +25597,7 @@ stock BreakPlayerCuffs( playerid, &attempts = 0 ) GetServerPoliceRatio( police_percentage ); // probability based off some factors - new probability = 35 + floatround( police_percentage ); + new probability = 25 + floatround( police_percentage ); // attempt to uncuff for ( attempts = 1; attempts < p_BobbyPins[ playerid ]; attempts ++ ) @@ -25611,7 +25625,7 @@ stock BreakPlayerCuffs( playerid, &attempts = 0 ) //Delete3DTextLabel( p_DetainedLabel[ playerid ] ); //p_DetainedLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID; //p_DetainedBy[ playerid ] = INVALID_PLAYER_ID;*/ - Untaze( playerid ); + Untaze( playerid, 10 ); SendServerMessage( playerid, "You have used %d bobby pins to successfully break your cuffs.", attempts ); GivePlayerWantedLevel( playerid, 6 ); } else { @@ -25640,3 +25654,17 @@ stock IsPlayerInMinigame( playerid ) { return IsPlayerInPaintBall( playerid ) || IsPlayerDueling( playerid ) || IsPlayerPlayingPool( playerid ) || IsPlayerPlayingPoker( playerid ); } +stock DisablePlayerSpawnProtection( playerid ) +{ + DisableRemoteVehicleCollisions( playerid, p_AdminOnDuty{ playerid } ); + SetPlayerHealth( playerid, p_AdminOnDuty{ playerid } ? float( INVALID_PLAYER_ID ) : 100.0 ); + Delete3DTextLabel( p_SpawnKillLabel[ playerid ] ); + p_SpawnKillLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID; + p_AntiSpawnKillEnabled{ playerid } = false; + return 1; +} + +stock IsPlayerPassiveModeEnabled( playerid ) +{ + return IsPlayerSettingToggled( playerid, SETTING_PASSIVE_MODE ) && ! p_WantedLevel[ playerid ] && p_Class[ playerid ] != CLASS_POLICE && ! p_PassiveModeDisabled{ playerid }; +} diff --git a/scriptfiles/updates.txt b/scriptfiles/updates.txt index d29f107..2e93ba7 100644 --- a/scriptfiles/updates.txt +++ b/scriptfiles/updates.txt @@ -1,12 +1,5 @@ -(+) Adds pool system minigame, like in singleplayer. -(+) Adds pilot minijob, accessible using "/pilot" in specific plane models. -(+) Adds traindriver minijob, accessible using "/train" in a train. -(+) Adds "/p" to be able to chat inside the paintball lobby -(+) Adds "/b production" to see what the status of your business production is. -(+) Adds "/reconnectchuff" for level 5 administrators. -(+) GPS now shows describes what each location is 'known for' and will be ordered by what is used most. -(/) Jail times now decreased by 40% and bobby pin prices have been increased. -(*) Players inside a vehicle that is brought by a player will be respawned. -(*) Fixes issue with being unable to exit a meth van. -(*) If you shoot a ball, it will not stop it while it is moving. -(*) Fix textdraw issue within casinos. \ No newline at end of file +(+) Adds passive mode (togglable via /settings). Disables random death matching as an innocent player. +(+) You can now disable automatic weapon pickup through /settings. +(/) If you successfully break your cuffs, you get immunity from being tazed for 10 seconds. +(/) Default 25% success rate breaking cuffs... Increases with more police in the server. +(/) Simplified "/cp" (alternatively, /settings) dialog.