From fe09bbd96383a065644cc4fff900bf13607eea5c Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Wed, 29 May 2019 23:40:57 +1000 Subject: [PATCH] add new event checks compatiable with cloudy's event system --- .../irresistible/cnr/features/animations.pwn | 11 +++- gamemodes/irresistible/cnr/features/c4.pwn | 6 ++- .../irresistible/cnr/features/cop/arrest.pwn | 14 +++++- gamemodes/irresistible/cnr/features/perks.pwn | 15 +++++- gamemodes/irresistible/cnr/features/weed.pwn | 7 ++- gamemodes/sf-cnr.pwn | 50 +++++++++++++++++-- 6 files changed, 94 insertions(+), 9 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/animations.pwn b/gamemodes/irresistible/cnr/features/animations.pwn index 74e34ac..f833194 100644 --- a/gamemodes/irresistible/cnr/features/animations.pwn +++ b/gamemodes/irresistible/cnr/features/animations.pwn @@ -354,7 +354,6 @@ stock CreateLoopingAnimation( playerid, animlib[ ], animname[ ], Float:Speed, lo else if ( IsPlayerInWater( playerid ) ) return SendError( playerid, "You cannot use this command since you're in water." ); else if ( IsPlayerMining( playerid ) ) return SendError( playerid, "You cannot use this command since you're mining." ); else if ( IsPlayerBoxing( playerid ) ) return SendError( playerid, "You cannot use this command since you're boxing." ); - else if ( IsPlayerInEvent( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an event." ); else if ( GetPlayerAnimationIndex( playerid ) == 1660 ) return SendError( playerid, "You cannot use this command since you're using a vending machine." ); else if ( IsPlayerAttachedObjectSlotUsed( playerid, 0 ) ) return SendError( playerid, "You cannot use this command since you're robbing." ); else if ( IsPlayingAnimation( playerid, "ROB_BANK", "CAT_Safe_Rob" ) ) return SendError( playerid, "You cannot use this command since you're robbing." ); @@ -365,6 +364,16 @@ stock CreateLoopingAnimation( playerid, animlib[ ], animname[ ], Float:Speed, lo else if ( GetPlayerWeapon( playerid ) == 46 ) return SendError( playerid, "You cannot use this command while wearing a parachute." ); else { + // event check + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_KIDNAP ) ) + #else + if ( IsPlayerInEvent( playerid ) ) + #endif + { + return SendError( playerid, "You cannot use this command since you're in an event." ); + } + SetPlayerSpecialAction( playerid, 0 ); if ( specialaction == 0 ) { ApplyAnimation( playerid, animlib, "null", 0.0, 0, 0, 0, 0, 0 ); diff --git a/gamemodes/irresistible/cnr/features/c4.pwn b/gamemodes/irresistible/cnr/features/c4.pwn index cc7a4d1..84ce6a3 100644 --- a/gamemodes/irresistible/cnr/features/c4.pwn +++ b/gamemodes/irresistible/cnr/features/c4.pwn @@ -154,7 +154,11 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) { /* ** Commands ** */ CMD:c4( playerid, params[ ] ) { - if ( IsPlayerInEvent( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an event." ); + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_C4 ) ) { + return SendError( playerid, "You cannot use this command since you're in an event." ); + } + #endif if ( !strcmp( params, "plant", true, 5 ) ) { diff --git a/gamemodes/irresistible/cnr/features/cop/arrest.pwn b/gamemodes/irresistible/cnr/features/cop/arrest.pwn index 9717ce1..66879ba 100644 --- a/gamemodes/irresistible/cnr/features/cop/arrest.pwn +++ b/gamemodes/irresistible/cnr/features/cop/arrest.pwn @@ -29,7 +29,7 @@ hook OnPlayerEnterDynamicCP( playerid, checkpointid ) checkpointid == g_Checkpoints[ CP_DROP_OFF_DIABLO ] || checkpointid == g_Checkpoints[ CP_DROP_OFF_QUBRADOS ] || checkpointid == g_Checkpoints[ CP_DROP_OFF_COP_LS ] || checkpointid == g_Checkpoints[ CP_DROP_OFF_FBI_LS ] || checkpointid == g_Checkpoints[ CP_DROP_OFF_FBI_LV ] || checkpointid == g_Checkpoints[ CP_DROP_OFF_COP_LV ] || - checkpointid == g_Checkpoints[ CP_DROP_OFF_FBI ] || checkpointid == g_Checkpoints[ CP_DROP_OFF_HELI ] ) + checkpointid == g_Checkpoints[ CP_DROP_OFF_FBI ] || checkpointid == g_Checkpoints[ CP_DROP_OFF_HELI ] ) { if ( p_Class[ playerid ] != CLASS_POLICE ) return 1; @@ -115,9 +115,19 @@ CMD:taze( playerid, params[ ] ) if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this command while in jail." ); if ( IsPlayerTied( victimid ) ) return SendError( playerid, "Tazing a tied player is pretty useless, though you can use /untie for a harder job!" ); if ( IsPlayerLoadingObjects( victimid ) ) return SendError( playerid, "This player is in a object-loading state." ); - if ( IsPlayerInEvent( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an event." ); if ( GetPlayerState( playerid ) == PLAYER_STATE_WASTED ) return SendError( playerid, "You cannot use this command since you are dead." ); if ( p_TazingImmunity[ victimid ] > g_iTime ) return SendError( playerid, "You must wait %d seconds before tazing this player.", p_TazingImmunity[ victimid ] - g_iTime ); + + // event check + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_KIDNAP ) ) + #else + if ( IsPlayerInEvent( playerid ) ) + #endif + { + return SendError( playerid, "You cannot use this command since you're in an event." ); + } + if ( random( 101 ) < 90 ) { GameTextForPlayer( victimid, "~n~~r~TAZED!", 2000, 4 ); diff --git a/gamemodes/irresistible/cnr/features/perks.pwn b/gamemodes/irresistible/cnr/features/perks.pwn index 20df771..4d202a9 100644 --- a/gamemodes/irresistible/cnr/features/perks.pwn +++ b/gamemodes/irresistible/cnr/features/perks.pwn @@ -63,6 +63,12 @@ hook OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float: f hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) { + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_PERKS ) ) { + return 1; + } + #endif + if ( dialogid == DIALOG_PERKS && response ) { switch( listitem ) @@ -194,8 +200,15 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) /* ** Commands ** */ CMD:perks( playerid, params[ ] ) { - if ( IsPlayerInEvent( playerid ) || IsPlayerInBattleRoyale( playerid ) ) + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_PERKS ) ) { return SendError( playerid, "You cannot use this command since you're in an event." ); + } + #else + if ( IsPlayerInEvent( playerid ) || IsPlayerInBattleRoyale( playerid ) ) { + return SendError( playerid, "You cannot use this command since you're in an event." ); + } + #endif if ( IsPlayerInArmyVehicle( playerid ) ) return SendError( playerid, "You cannot use this command while in an army vehicle." ); diff --git a/gamemodes/irresistible/cnr/features/weed.pwn b/gamemodes/irresistible/cnr/features/weed.pwn index 88b0459..aa134b2 100644 --- a/gamemodes/irresistible/cnr/features/weed.pwn +++ b/gamemodes/irresistible/cnr/features/weed.pwn @@ -120,6 +120,12 @@ CMD:weed( playerid, params[ ] ) if ( IsPlayerTied( playerid ) || IsPlayerTazed( playerid ) || IsPlayerCuffed( playerid ) || IsPlayerJailed( playerid ) || IsPlayerInMinigame( playerid ) ) return SendError( playerid, "You cannot use this command at the moment." ); + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_WEED ) ) { + return SendError( playerid, "You cannot use this command since you're in an event." ); + } + #endif + if ( strmatch( params, "plant" ) ) { if ( ! IsPlayerJob( playerid, JOB_DRUG_DEALER ) ) return SendError( playerid, "You are not a drug dealer." ); @@ -230,7 +236,6 @@ CMD:weed( playerid, params[ ] ) if ( IsPlayerLoadingObjects( playerid ) ) return SendError( playerid, "You're in a object-loading state, please wait." ); if ( IsPlayerAttachedObjectSlotUsed( playerid, 0 ) ) return SendError( playerid, "You cannot use this command since you're robbing." ); // if ( IsPlayerJob( playerid, JOB_DRUG_DEALER ) ) return SendError( playerid, "You cannot use your own products, they are for resale only!" ); - if ( IsPlayerInEvent( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an event." ); //if ( IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You cannot use this command in a vehicle." ); //if ( GetPlayerState( playerid ) == PLAYER_STATE_ENTER_VEHICLE_DRIVER || GetPlayerState( playerid ) == PLAYER_STATE_ENTER_VEHICLE_PASSENGER ) return SendError( playerid, "You cannot use this command if you're entering a vehicle." ); //if ( GetPlayerState( playerid ) == PLAYER_STATE_EXIT_VEHICLE ) return SendError( playerid, "You cannot use this command if you're exiting a vehicle." ); diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index eea27c5..cf09681 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -1091,8 +1091,14 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b } // Headshots + #if defined __cloudy_event_system + if ( ( weaponid == WEAPON_SNIPER || weaponid == WEAPON_RIFLE ) && bodypart == 9 && ( ! IsPlayerInEvent( playerid ) || ( IsPlayerInEvent( playerid ) && EventSettingAllow( EVENT_SETTING_HEADSHOT ) ) ) ) + #else if ( ( weaponid == WEAPON_SNIPER || weaponid == WEAPON_RIFLE ) && bodypart == 9 ) + #endif + { amount *= 1.5; + } // Paintball Headshot if ( issuerid != INVALID_PLAYER_ID && p_inPaintBall{ playerid } == true ) @@ -3521,6 +3527,17 @@ CMD:kidnap( playerid, params[ ] ) else if ( IsPlayerJailed( victimid ) ) return SendError( playerid, "This player is jailed. He may be paused." ); else if ( p_KidnapImmunity[ victimid ] > g_iTime ) return SendError( playerid, "This player cannot be kidnapped for another %s.", secondstotime( p_KidnapImmunity[ victimid ] - g_iTime ) ); else if ( PutPlayerInEmptyVehicleSeat( p_LastVehicle[ playerid ], victimid ) == -1 ) return SendError( playerid, "Failed to place the player inside a full of player vehicle." ); + + // event check + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_KIDNAP ) ) + #else + if ( IsPlayerInEvent( playerid ) ) + #endif + { + return SendError( playerid, "You cannot use this command since you're in an event." ); + } + SendClientMessageFormatted( victimid, -1, ""COL_RED"[KIDNAPPED]{FFFFFF} You have been kidnapped by %s(%d)!", ReturnPlayerName( playerid ), playerid ); SendClientMessageFormatted( playerid, -1, ""COL_GREEN"[KIDNAPPED]{FFFFFF} You have kidnapped %s(%d), he has been thrown in your previous entered vehicle!", ReturnPlayerName( victimid ), victimid ); TogglePlayerControllable( victimid, 0 ); @@ -3587,11 +3604,20 @@ CMD:tie( playerid, params[ ] ) else if ( IsPlayerJailed( victimid ) ) return SendError( playerid, "This player is jailed. He may be paused." ); else if ( IsPlayerLoadingObjects( victimid ) ) return SendError( playerid, "This player is in a object-loading state." ); else if ( GetPlayerState( victimid ) == PLAYER_STATE_WASTED ) return SendError( playerid, "You cannot tie wasted players." ); - else if ( IsPlayerInEvent( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an event." ); else if ( IsPlayerInPlayerGang( playerid, victimid ) ) return SendError( playerid, "You cannot use this command on your homies!" ); else if ( IsPlayerSpawnProtected( victimid ) ) return SendError( playerid, "You cannot use this command on spawn protected players." ); else if ( IsPlayerInCasino( victimid ) && ! p_WantedLevel[ victimid ] ) return SendError( playerid, "The innocent person you're trying to tie is in a casino." ); + // event check + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_TIE ) ) + #else + if ( IsPlayerInEvent( playerid ) ) + #endif + { + return SendError( playerid, "You cannot use this command since you're in an event." ); + } + // remove rope after attempt if ( p_Ropes[ playerid ] -- > 0 ) { ShowPlayerHelpDialog( playerid, 4500, "You only have %d ropes left!", p_Ropes[ playerid ] ); @@ -3771,9 +3797,18 @@ CMD:rob( playerid, params[ ] ) else if ( IsPlayerJailed( victimid ) ) return SendError( playerid, "This player is jailed. He may be paused." ); else if ( IsPlayerInCasino( victimid ) && ! p_WantedLevel[ victimid ] ) return SendError( playerid, "The innocent person you're trying to rob is in a casino." ); else if ( p_ClassSelection{ victimid } ) return SendError( playerid, "This player is currently in class selection." ); - else if ( IsPlayerInEvent( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an event." ); else if ( IsPlayerInPlayerGang( playerid, victimid ) ) return SendError( playerid, "You cannot use this command on your homies!" ); + // event check + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_ROB ) ) + #else + if ( IsPlayerInEvent( playerid ) ) + #endif + { + return SendError( playerid, "You cannot use this command since you're in an event." ); + } + new iRandom = random( 101 ); @@ -3856,10 +3891,19 @@ CMD:rape( playerid, params[ ] ) else if ( IsPlayerLoadingObjects( victimid ) ) return SendError( playerid, "This player is in a object-loading state." ); else if ( IsPlayerSpawnProtected( victimid ) ) return SendError( playerid, "This player is in a anti-spawn-kill state." ); else if ( p_ClassSelection{ victimid } ) return SendError( playerid, "This player is currently in class selection." ); - else if ( IsPlayerInEvent( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an event." ); else if ( IsPlayerAFK( victimid ) && GetPlayerState( playerid ) != PLAYER_STATE_WASTED ) return SendError( playerid, "This player is in an AFK state." ); else if ( IsPlayerInPlayerGang( playerid, victimid ) ) return SendError( playerid, "You cannot use this command on your homies!" ); + // event check + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) && ! EventSettingAllow( EVENT_SETTING_RAPE ) ) + #else + if ( IsPlayerInEvent( playerid ) ) + #endif + { + return SendError( playerid, "You cannot use this command since you're in an event." ); + } + new iRandom = random( 101 ); if ( IsPlayerJob( playerid, JOB_MUGGER ) ) { iRandom += 10; } // Adds more success to muggers if ( iRandom < 75 || IsPlayerTied( victimid ) )