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... {