add new event checks compatiable with cloudy's event system

This commit is contained in:
Lorenc Pekaj 2019-05-29 23:40:57 +10:00
parent 1c3fecdc91
commit fe09bbd963
6 changed files with 94 additions and 9 deletions

View File

@ -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 ( 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 ( 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 ( 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 ( 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 ( 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." ); 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 if ( GetPlayerWeapon( playerid ) == 46 ) return SendError( playerid, "You cannot use this command while wearing a parachute." );
else 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 ); SetPlayerSpecialAction( playerid, 0 );
if ( specialaction == 0 ) { if ( specialaction == 0 ) {
ApplyAnimation( playerid, animlib, "null", 0.0, 0, 0, 0, 0, 0 ); ApplyAnimation( playerid, animlib, "null", 0.0, 0, 0, 0, 0, 0 );

View File

@ -154,7 +154,11 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) {
/* ** Commands ** */ /* ** Commands ** */
CMD:c4( playerid, params[ ] ) 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 ) ) if ( !strcmp( params, "plant", true, 5 ) )
{ {

View File

@ -115,9 +115,19 @@ CMD:taze( playerid, params[ ] )
if ( IsPlayerJailed( playerid ) ) return SendError( playerid, "You cannot use this command while in jail." ); 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 ( 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 ( 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 ( 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 ); 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 ) if ( random( 101 ) < 90 )
{ {
GameTextForPlayer( victimid, "~n~~r~TAZED!", 2000, 4 ); GameTextForPlayer( victimid, "~n~~r~TAZED!", 2000, 4 );

View File

@ -63,6 +63,12 @@ hook OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float: f
hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) 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 ) if ( dialogid == DIALOG_PERKS && response )
{ {
switch( listitem ) switch( listitem )
@ -194,8 +200,15 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
/* ** Commands ** */ /* ** Commands ** */
CMD:perks( playerid, params[ ] ) 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." ); 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 ) ) if ( IsPlayerInArmyVehicle( playerid ) )
return SendError( playerid, "You cannot use this command while in an army vehicle." ); return SendError( playerid, "You cannot use this command while in an army vehicle." );

View File

@ -120,6 +120,12 @@ CMD:weed( playerid, params[ ] )
if ( IsPlayerTied( playerid ) || IsPlayerTazed( playerid ) || IsPlayerCuffed( playerid ) || IsPlayerJailed( playerid ) || IsPlayerInMinigame( playerid ) ) if ( IsPlayerTied( playerid ) || IsPlayerTazed( playerid ) || IsPlayerCuffed( playerid ) || IsPlayerJailed( playerid ) || IsPlayerInMinigame( playerid ) )
return SendError( playerid, "You cannot use this command at the moment." ); 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 ( strmatch( params, "plant" ) )
{ {
if ( ! IsPlayerJob( playerid, JOB_DRUG_DEALER ) ) return SendError( playerid, "You are not a drug dealer." ); 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 ( 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 ( 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 ( 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 ( 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_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." ); //if ( GetPlayerState( playerid ) == PLAYER_STATE_EXIT_VEHICLE ) return SendError( playerid, "You cannot use this command if you're exiting a vehicle." );

View File

@ -1091,8 +1091,14 @@ public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, b
} }
// Headshots // 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 ) if ( ( weaponid == WEAPON_SNIPER || weaponid == WEAPON_RIFLE ) && bodypart == 9 )
#endif
{
amount *= 1.5; amount *= 1.5;
}
// Paintball Headshot // Paintball Headshot
if ( issuerid != INVALID_PLAYER_ID && p_inPaintBall{ playerid } == true ) 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 ( 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 ( 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." ); 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( 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 ); 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 ); 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 ( 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 ( 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 ( 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 ( 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 ( 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." ); 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 // remove rope after attempt
if ( p_Ropes[ playerid ] -- > 0 ) { if ( p_Ropes[ playerid ] -- > 0 ) {
ShowPlayerHelpDialog( playerid, 4500, "You only have %d ropes left!", p_Ropes[ playerid ] ); 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 ( 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 ( 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 ( 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!" ); 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 new
iRandom = random( 101 ); 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 ( 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 ( 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 ( 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 ( 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!" ); 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 ); new iRandom = random( 101 );
if ( IsPlayerJob( playerid, JOB_MUGGER ) ) { iRandom += 10; } // Adds more success to muggers if ( IsPlayerJob( playerid, JOB_MUGGER ) ) { iRandom += 10; } // Adds more success to muggers
if ( iRandom < 75 || IsPlayerTied( victimid ) ) if ( iRandom < 75 || IsPlayerTied( victimid ) )