From 9c49fa35b439bb9b5facf679c85d22bd4a87c378 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Sun, 14 Oct 2018 00:08:22 +1100 Subject: [PATCH 1/4] passive disables deathmatch --- gamemodes/irresistible/cnr/dialog_ids.pwn | 3 +- gamemodes/irresistible/cnr/player.pwn | 2 +- .../irresistible/cnr/player_settings.pwn | 10 ++--- gamemodes/sf-cnr.pwn | 39 +++++++++++++++---- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/gamemodes/irresistible/cnr/dialog_ids.pwn b/gamemodes/irresistible/cnr/dialog_ids.pwn index 53188a2..70b5479 100644 --- a/gamemodes/irresistible/cnr/dialog_ids.pwn +++ b/gamemodes/irresistible/cnr/dialog_ids.pwn @@ -210,7 +210,8 @@ #define DIALOG_COMPONENTS_SELL 1200 #define DIALOG_HOUSE_SELL 1201 #define DIALOG_BUSINESS_SELL_CONFIRM 1202 - +#define DIALOG_PASSIVE_MODE 1203 + /* ** Hooks ** */ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) { diff --git a/gamemodes/irresistible/cnr/player.pwn b/gamemodes/irresistible/cnr/player.pwn index 1953156..7c753fd 100644 --- a/gamemodes/irresistible/cnr/player.pwn +++ b/gamemodes/irresistible/cnr/player.pwn @@ -232,7 +232,7 @@ new p_PlayerAltBindTick [ MAX_PLAYERS ], p_AimedAtPolice [ MAX_PLAYERS ], bool: p_PassiveModeDisabled [ MAX_PLAYERS char ], - p_PassiveModeExpireTimer [ MAX_PLAYERS ] = { -1, ... }, + //p_PassiveModeExpireTimer [ MAX_PLAYERS ] = { -1, ... }, Text3D: p_PassiveModeLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID } ; diff --git a/gamemodes/irresistible/cnr/player_settings.pwn b/gamemodes/irresistible/cnr/player_settings.pwn index 754807e..e837508 100644 --- a/gamemodes/irresistible/cnr/player_settings.pwn +++ b/gamemodes/irresistible/cnr/player_settings.pwn @@ -68,9 +68,9 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) ShowPlayerTogglableTextdraws( playerid, .force = false ); } - else if ( settingid == SETTING_PASSIVE_MODE ) { + /*else if ( settingid == SETTING_PASSIVE_MODE ) { ResetPlayerPassiveMode( playerid, .passive_disabled = true ); // avoid abusing - } + }*/ format( szNormalString, 68, "INSERT INTO `SETTINGS`(`USER_ID`, `SETTING_ID`) VALUES (%d, %d)", p_AccountID[ playerid ], settingid ); } @@ -80,15 +80,15 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) HidePlayerTogglableTextdraws( playerid, .force = false ); ShowPlayerTogglableTextdraws( playerid, .force = false ); } - else if ( settingid == SETTING_PASSIVE_MODE ) { + /*else if ( settingid == SETTING_PASSIVE_MODE ) { ResetPlayerPassiveMode( playerid, .passive_disabled = true ); // avoid abusing - } + }*/ 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 } ? ( "enabled" ) : ( "disabled" ), g_PlayerSettings[ settingid ] ); + SendServerMessage( playerid, ""COL_ORANGE"%s"COL_WHITE" is now %s. Changes may take effect after spawning/relogging.", g_PlayerSettings[ settingid ], p_PlayerSettings[ playerid ] { settingid } ? ( "enabled" ) : ( "disabled" ) ); if ( ! strmatch( inputtext, "ignore" )) { cmd_cp( playerid, "" ); // Redirect to control panel again... diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 8a2f7c6..1935abf 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -2829,10 +2829,10 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b // Passive mode enabled for player? if ( IsPlayerPassive( issuerid ) ) { - if ( p_PassiveModeExpireTimer[ issuerid ] == -1 ) { + /*if ( p_PassiveModeExpireTimer[ issuerid ] == -1 ) { p_PassiveModeExpireTimer[ issuerid ] = PassiveMode_Reset( issuerid, 4 ); // it will just set it to anything but -1 for now - } - return 0; + }*/ + return ShowPlayerHelpDialog( issuerid, 2000, "~r~You cannot deathmatch with /passive enabled." ), 0; } // Passive mode enabled for damaged id? @@ -7668,6 +7668,7 @@ CMD:c4( playerid, params[ ] ) if ( IsPlayerTied( playerid ) ) return SendError( playerid, "You cannot use this command since you're tied." ); if ( IsPlayerKidnapped( playerid ) ) return SendError( playerid, "You cannot use this command since you're kidnapped." ); if ( IsPlayerInCasino( playerid ) ) return SendError( playerid, "You cannot use this command since you're in a casino." ); + if ( IsPlayerPassive( playerid ) ) return SendError( playerid, "You cannot use this command as an innocent player in passive mode." ); if ( IsPlayerInPaintBall( playerid ) || IsPlayerDueling( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an arena." ); if ( p_C4Amount[ playerid ] < 1 ) return SendError( playerid, "You don't have any C4's" ); @@ -10508,6 +10509,11 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) } TogglePlayerControllable( playerid, 1 ); + + if ( ! p_JobSet{ playerid } ) { + ShowPlayerDialog( playerid, DIALOG_PASSIVE_MODE, DIALOG_STYLE_LIST, "{FFFFFF}What is your type of style?", "{555555}Choose Below Below:\nI Like Roleplaying\nI Like Deathmatching", "Select", "" ); + } + p_JobSet{ playerid } = true; //if ( !p_CitySet{ playerid } ) @@ -10520,6 +10526,19 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) TogglePlayerControllable( playerid, 0 ); ShowPlayerDialog( playerid, DIALOG_JOB, DIALOG_STYLE_LIST, "{FFFFFF}Job Selection", "Rapist\nKidnapper\nTerrorist\nHitman\nProstitute\nWeapon Dealer\nDrug Dealer\nDirty Mechanic\nBurglar", "Select", "" ); } + } + if ( dialogid == DIALOG_PASSIVE_MODE ) + { + if ( ! response || ! listitem ) { + ShowPlayerDialog( playerid, DIALOG_PASSIVE_MODE, DIALOG_STYLE_LIST, "{FFFFFF}What is your type of style?", "{555555}Choose Below Below:\nI Like Roleplaying\nI Like Deathmatching", "Select", "" ); + } + + if ( listitem == 1 ) { + SendServerMessage( playerid, "Since you like roleplay, passive mode has been automatically enabled for you!" ); + } else if ( listitem == 2 ) { + CallLocalFunction( "OnDialogResponse", "dddds", playerid, DIALOG_CP_MENU, 1, SETTING_PASSIVE_MODE + 1, "ignore" ); // cunning way + SendServerMessage( playerid, "Since you like deathmatch, passive mode has been automatically enabled for you!" ); + } } if ( dialogid == DIALOG_BOMB_SHOP ) { @@ -17914,8 +17933,12 @@ stock DisablePlayerSpawnProtection( playerid ) stock SetPlayerPassiveMode( playerid ) { + // disable passive mode if it is enabled if ( IsPlayerSettingToggled( playerid, SETTING_PASSIVE_MODE ) ) + { + ResetPlayerPassiveMode( playerid, .passive_disabled = true ); return 0; + } // reset any labels etc ResetPlayerPassiveMode( playerid ); @@ -17930,21 +17953,21 @@ stock SetPlayerPassiveMode( playerid ) stock IsPlayerPassive( playerid ) { - return ! IsPlayerSettingToggled( playerid, SETTING_PASSIVE_MODE ) && ! p_WantedLevel[ playerid ] && p_Class[ playerid ] != CLASS_POLICE && ! p_PassiveModeDisabled{ playerid }; + return ! p_WantedLevel[ playerid ] && p_Class[ playerid ] != CLASS_POLICE && ! p_PassiveModeDisabled{ playerid }; } stock ResetPlayerPassiveMode( playerid, bool: passive_disabled = false ) { DestroyDynamic3DTextLabel( p_PassiveModeLabel[ playerid ] ); - KillTimer( p_PassiveModeExpireTimer[ playerid ] ); + //KillTimer( p_PassiveModeExpireTimer[ playerid ] ); p_PassiveModeLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID; - p_PassiveModeExpireTimer[ playerid ] = -1; + //p_PassiveModeExpireTimer[ playerid ] = -1; p_PassiveModeDisabled{ playerid } = passive_disabled; TextDrawHideForPlayer( playerid, g_PassiveModeTD ); return 1; } -function PassiveMode_Reset( playerid, time_left ) +/*function PassiveMode_Reset( playerid, time_left ) { // if you happen to die then have a shot synced ... just reset normally if ( GetPlayerState( playerid ) == PLAYER_STATE_WASTED ) { @@ -17963,7 +17986,7 @@ function PassiveMode_Reset( playerid, time_left ) ShowPlayerHelpDialog( playerid, 1500, "Passive mode disabled in ~r~%d seconds.", time_left ); } return 1; -} +}*/ stock SendClientMessageToCops( colour, format[ ], va_args<> ) // Conversion to foreach 14 stuffed the define, not sure how... { From fdb9f9aa77802e8d33b7c4d822d1411cfd5ced9c Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Sun, 14 Oct 2018 01:36:32 +1100 Subject: [PATCH 2/4] hit amount amount bug fix in interior (label) --- gamemodes/irresistible/cnr/features/damage_feed.pwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/features/damage_feed.pwn b/gamemodes/irresistible/cnr/features/damage_feed.pwn index 9283629..6beeea3 100644 --- a/gamemodes/irresistible/cnr/features/damage_feed.pwn +++ b/gamemodes/irresistible/cnr/features/damage_feed.pwn @@ -125,7 +125,7 @@ public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypar GetPlayerLastShotVectors( issuerid, fromX, fromY, fromZ, toX, toY, toZ ); new - Text3D: bullet_label = CreateDynamic3DTextLabel( sprintf( "%.0f", amount ), 0xFFFFFF80, toX, toY, toZ, 100.0, .interiorid = GetPlayerVirtualWorld( playerid ), .worldid = GetPlayerInterior( playerid ), .testlos = 1 ); + Text3D: bullet_label = CreateDynamic3DTextLabel( sprintf( "%.0f", amount ), 0xFFFFFF80, toX, toY, toZ, 100.0, .interiorid = GetPlayerInterior( playerid ), .worldid = GetPlayerVirtualWorld( playerid ), .testlos = 1 ); if ( IsValidDynamic3DTextLabel( bullet_label ) ) { From 7606829ff9cbdca15b3f7834878d53407884a707 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Sun, 14 Oct 2018 01:43:21 +1100 Subject: [PATCH 3/4] fix moviemode bug with xp bs showing wrongly --- gamemodes/irresistible/cnr/experience.pwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/experience.pwn b/gamemodes/irresistible/cnr/experience.pwn index fd3be78..a9b7733 100644 --- a/gamemodes/irresistible/cnr/experience.pwn +++ b/gamemodes/irresistible/cnr/experience.pwn @@ -179,7 +179,7 @@ hook OnPlayerDisconnect( playerid, reason ) hook OnPlayerMovieMode( playerid, bool: toggled ) { - if ( toggled ) + if ( ! toggled ) { TextDrawShowForPlayer( playerid, g_CurrentRankTD ); TextDrawShowForPlayer( playerid, g_currentXPTD ); From c2085bcdd2d0366404a49c93ae6cfa737c921ccf Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Sun, 14 Oct 2018 01:55:53 +1100 Subject: [PATCH 4/4] updates.txt update --- scriptfiles/updates.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scriptfiles/updates.txt b/scriptfiles/updates.txt index f6596fa..d33f219 100644 --- a/scriptfiles/updates.txt +++ b/scriptfiles/updates.txt @@ -1,12 +1,20 @@ +(+) Newly registered players will be asked if they prefer DM or RP - if they like RP, passive mode is on. (+) Added confirmation dialog before selling a home / business / vehicle components. (+) Pilot and train minijobs are now saved to the database (and in /highscores). (+) Adds some strippers in the LV brothel (for fun). (+) Adds Hide From Minimap perk (costs $25,000) ... hides you for 1 minute. -(/) You can now set spikes in non-air and non-sea vehicles using your AIM key. +(+) Fire tracker is now /fires ... and it shows the fires on the map as red blips. +(+) New hitmarker system ... activate using /cp - Now shows taken/given damage! +(/) Passive mode now completely disables deathmatch. +(/) You can now set spikes in non-air and non-sea vehicles using your CAPSLOCK key. (/) Car jackers now need to wait only 1 min before exporting another vehicle (before 2 min). (/) Players with level 100 in a specific level are able to accrue more XP in the level. +(/) Explosive rounds used on vehicles will have a more significant impact. +(/) Explosive rounds require the key N to activate. +(/) Rank is now XP based now (prior score based). (*) Should be faster to place multiple drills using left alt. (*) Fixes death bug with players suiciding in a vehicle. (*) Fixed Alcatraz map escaping issues. (*) Addressed issue with being unable to rob ChuffSec. +(*) Fixed issue with business exports being randomly canceled. (-) Removed a counter in cluckin' bell for ease of access to the safe. \ No newline at end of file