diff --git a/gamemodes/irresistible/anticheat/weapon.pwn b/gamemodes/irresistible/anticheat/weapon.pwn index 503cfad..3b34b83 100644 --- a/gamemodes/irresistible/anticheat/weapon.pwn +++ b/gamemodes/irresistible/anticheat/weapon.pwn @@ -299,4 +299,4 @@ stock AC_CreateDynamicPickup( modelid, type, Float: x, Float: y, Float: z, world #else #define _ALS_CreateDynamicPickup #endif -#define CreateDynamicPickup AC_CreateDynamicPickup +#define CreateDynamicPickup AC_CreateDynamicPickup \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/classes.pwn b/gamemodes/irresistible/cnr/classes.pwn index e073361..1ae1da6 100644 --- a/gamemodes/irresistible/cnr/classes.pwn +++ b/gamemodes/irresistible/cnr/classes.pwn @@ -362,6 +362,16 @@ hook OnPlayerRequestSpawn( playerid ) return IsPlayerClassApproved( playerid ); } +hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) +{ + if( !IsPlayerNPC( playerid ) ) + { + if ( ( newkeys && KEY_FIRE ) && GetPlayerClass( playerid ) == CLASS_POLICE && GetPlayerWeapon( playerid ) == 9 ) + RemoveSpecificPlayerWeapon( playerid, 9, false ); + } + return 1; +} + stock IsPlayerClassApproved( playerid ) { // is logged in @@ -488,4 +498,4 @@ stock IsPlayerPolice( playerid ) } } return false; -} +} \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/features/animations.pwn b/gamemodes/irresistible/cnr/features/animations.pwn index fa5cb13..e05e872 100644 --- a/gamemodes/irresistible/cnr/features/animations.pwn +++ b/gamemodes/irresistible/cnr/features/animations.pwn @@ -362,6 +362,7 @@ stock CreateLoopingAnimation( playerid, animlib[ ], animname[ ], Float:Speed, lo else if ( IsPlayerAttachedObjectSlotUsed( playerid, 3 ) ) return SendError( playerid, "You cannot use this command since you're holding a stolen good." ); else if ( GetPlayerState( playerid ) == PLAYER_STATE_ENTER_VEHICLE_DRIVER || GetPlayerState( playerid ) == PLAYER_STATE_ENTER_VEHICLE_PASSENGER ) return SendError( playerid, "You cannot use this command since you're entering a vehicle." ); else if ( GetPlayerState( playerid ) == PLAYER_STATE_EXIT_VEHICLE ) return SendError( playerid, "You cannot use this command since you're exiting a vehicle." ); + else if ( GetPlayerWeapon( playerid ) == 46 ) return SendError( playerid, "You cannot use this command while wearing a parachute." ); else { SetPlayerSpecialAction( playerid, 0 ); @@ -396,4 +397,4 @@ stock IsPlayingAnimation( playerid, const library[ ], const animation[ ] ) stock IsPlayerUsingAnimation( playerid ) { return p_InAnimation{ playerid }; -} +} \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/features/business/business.pwn b/gamemodes/irresistible/cnr/features/business/business.pwn index f3dd31f..26f6158 100644 --- a/gamemodes/irresistible/cnr/features/business/business.pwn +++ b/gamemodes/irresistible/cnr/features/business/business.pwn @@ -506,6 +506,13 @@ hook OnPlayerDriveVehicle( playerid, vehicleid ) { if ( g_isBusinessVehicle[ vehicleid ] != -1 && Iter_Contains( business, g_isBusinessVehicle[ vehicleid ] ) ) { + if ( IsPlayerPassive( playerid ) ) + { + ShowPlayerHelpDialog( playerid, 2000, "Passive players cannot enter business vehicles." ); + SyncObject( playerid ); + return 1; + } + new businessid = g_isBusinessVehicle[ vehicleid ]; diff --git a/gamemodes/irresistible/cnr/features/car_jacker.pwn b/gamemodes/irresistible/cnr/features/car_jacker.pwn index 57cff05..f183fa6 100644 --- a/gamemodes/irresistible/cnr/features/car_jacker.pwn +++ b/gamemodes/irresistible/cnr/features/car_jacker.pwn @@ -42,6 +42,12 @@ hook OnScriptInit( ) return 1; } +hook OnPlayerConnect( playerid ) +{ + p_AntiExportCarSpam [ playerid ] = g_iTime + 60; + return 1; +} + hook OnPlayerDisconnect( playerid, reason ) { g_LastExportModel[ playerid ] = 0; diff --git a/gamemodes/irresistible/cnr/features/cop/arrest.pwn b/gamemodes/irresistible/cnr/features/cop/arrest.pwn index bf3ff32..913aeac 100644 --- a/gamemodes/irresistible/cnr/features/cop/arrest.pwn +++ b/gamemodes/irresistible/cnr/features/cop/arrest.pwn @@ -20,9 +20,13 @@ forward OnPlayerArrested( playerid, victimid, totalarrests, totalpeople ); /* ** Hooks ** */ hook OnPlayerDisconnect( playerid, reason ) { + p_AwaitingBCAttempt{ playerid } = false; KillTimer( p_AwaitingBCAttemptTimer[ playerid ] ); p_AwaitingBCAttemptTimer[ playerid ] = -1; + + // Quit to Avoid - Award Handling + if ( playerid != INVALID_PLAYER_ID ) AwardNearestLEO( playerid, 0 ); return 1; } @@ -317,6 +321,24 @@ stock ArrestPlayer( victimid, playerid ) else return SendError( playerid, "There are no players around to arrest." ); } +stock AwardArrest( victimid, playerid ) +{ + p_QuitToAvoidTimestamp[ playerid ] = 0; + new totalCash = ( p_WantedLevel[ victimid ] < MAX_WANTED_LVL ? p_WantedLevel[ victimid ] : MAX_WANTED_LVL ) * ( 300 ); + new totalSeconds = p_WantedLevel[ victimid ] * ( JAIL_SECONDS_MULTIPLIER ); + GivePlayerScore( playerid, 2 ); + GivePlayerExperience( playerid, E_POLICE ); + GivePlayerCash( playerid, totalCash ); + StockMarket_UpdateEarnings( E_STOCK_GOVERNMENT, totalCash, 0.1 ); + if ( totalCash > 20000 ) printf("[police arrest] %s -> %s - %s", ReturnPlayerName( playerid ), ReturnPlayerName( victimid ), cash_format( totalCash ) ); // 8hska7082bmahu + 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 ); + GivePlayerSeasonalXP( victimid, -20.0 ); + JailPlayer( victimid, totalSeconds ); + return 1; +} + stock CuffPlayer( victimid, playerid ) { if ( p_Class[ playerid ] != CLASS_POLICE ) return SendError( playerid, "This is restricted to police only." ); @@ -467,4 +489,59 @@ stock BreakPlayerCuffs( playerid ) } } -function BreakPlayerCuffsAttempt( playerid ) return BreakPlayerCuffs( playerid ), 1; \ No newline at end of file +function BreakPlayerCuffsAttempt( playerid ) return BreakPlayerCuffs( playerid ), 1; + +stock AwardNearestLEO( playerid, reason ) +{ + if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID ) + return false; + + new + closestLEO = INVALID_PLAYER_ID, + Float: radius = ( IsPlayerInAnyVehicle( playerid ) ? 150.0 : 75.0 ) // If player is in a vehicle, increase radius due to ability to get farther quicker. + ; + + closestLEO = GetClosestPlayerEx( playerid, CLASS_POLICE, radius ); + + if ( IsPlayerConnected( closestLEO ) ) + { + new reasonText[ 24 ]; + + switch ( reason ) + { + case 0: reasonText = "Q'ing to Avoid"; + case 1: reasonText = "being AFK while wanted"; + } + + AwardArrest( playerid, closestLEO ); + SendGlobalMessage( -1, ""COL_GOLD"[JAIL]{FFFFFF} %s(%d) has been awarded for the arrest on %s(%d) due to them "COL_LRED"%s.", ReturnPlayerName( closestLEO ), closestLEO, ReturnPlayerName( playerid ), playerid, reasonText ); + return true; + } + + return false; +} + +hook OnPlayerAccessEntrance( playerid, entranceid, worldid, interiorid ) +{ + if ( GetPlayerWantedLevel( playerid ) > 2 ) + { + + new Float: x, Float: y, Float: z; + + GetEntrancePos( entranceid, x, y, z ); + + foreach ( new pID : Player ) + { + if ( p_Class[ pID ] != CLASS_POLICE ) continue; + + new Float: distance = GetPlayerDistanceFromPoint( pID, x, y, z ); + + if ( distance < 50 ) + { + p_QuitToAvoidTimestamp[ playerid ] = g_iTime + 30; + break; + } + } + } + return 1; +} \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/features/info_pickups.pwn b/gamemodes/irresistible/cnr/features/info_pickups.pwn index 33d0b6a..81901f2 100644 --- a/gamemodes/irresistible/cnr/features/info_pickups.pwn +++ b/gamemodes/irresistible/cnr/features/info_pickups.pwn @@ -26,7 +26,7 @@ static stock { -2767.3765, 1257.077, 11.7703, 0xFFFF, "{FFFFFF}You can mine ores and store your ores in dunes for exportation! Grab the spade and hit the ore!" }, // Mining { 1954.71890, 1038.251, 992.859, 0xFFFF, "{FFFFFF}Test out your luck on the slot machines, maybe you might win the mega jackpot!" }, // Slots { 1955.69070, 1005.167, 992.468, 0xFFFF, "{FFFFFF}Roulette can payout up to $3.5M! Single bets return 35x your money whereas outside bets can return 2x to 3x!" }, // Roulette - { 2085.5896, 1239.4589, 414.745, 0xFFFF, "{FFFFFF}Buy materials at a co-nvience store and cook meth! Aim and shoot each ingredient to add them as you /meth cook!" } // Meth Cook + { 2085.5896, 1239.4589, 414.745, 0xFFFF, "{FFFFFF}Buy materials at a convience store and cook meth! Aim and shoot each ingredient to add them as you /meth cook!" } // Meth Cook } ; diff --git a/gamemodes/irresistible/cnr/features/minijobs/meth.pwn b/gamemodes/irresistible/cnr/features/minijobs/meth.pwn index 0a13c23..a8360f9 100644 --- a/gamemodes/irresistible/cnr/features/minijobs/meth.pwn +++ b/gamemodes/irresistible/cnr/features/minijobs/meth.pwn @@ -69,6 +69,7 @@ static stock /* ** Forwards ** */ forward OnMethamphetamineCooking( playerid, vehicleid, last_chemical ); +forward OnPlayerVehicleDestroyed( playerid, slot ); /* ** Hooks ** */ hook OnPlayerDisconnect( playerid, reason ) @@ -341,6 +342,12 @@ public OnMethamphetamineCooking( playerid, vehicleid, last_chemical ) return 1; } +public OnPlayerVehicleDestroyed( playerid, slot ) +{ + if ( g_vehicleData[ playerid ][ slot ][ E_MODEL ] == 508 ) RemovePlayersFromJourney( g_vehicleData[ playerid ][ slot ][ E_VEHICLE_ID ] ); + return 1; +} + /* ** Commands ** */ CMD:meth( playerid, params[ ] ) { @@ -517,4 +524,30 @@ stock GetPlayerCausticSoda( playerid ) return p_CausticSoda{ playerid }; stock SetPlayerCausticSoda( playerid, amount ) { p_CausticSoda{ playerid } = amount; +} + +stock RemovePlayersFromJourney( vehicleID ) +{ + new Float: x, Float: y, Float: z, Float: Angle; + + foreach ( new playerid : Player ) + { + if ( GetPlayerVirtualWorld( playerid ) == ( vehicleID + VW_METH ) && !p_Spectating{ playerid } ) + { + haltMethamphetamine( playerid, vehicleID ); + + GetVehiclePos( vehicleID, x, y, z ); + GetVehicleZAngle( vehicleID, Angle ); + x += ( 5.0 * floatsin( -( Angle - 45.0 ), degrees ) ); + y += ( 5.0 * floatcos( -( Angle - 45.0 ), degrees ) ); + + SetPlayerPos( playerid, x, y, z ); + SetPlayerInterior( playerid, 0 ); + SetPlayerVirtualWorld( playerid, 0 ); + + SendServerMessage( playerid, "You have been removed from a player-owned Journey as the player who owned it has left the server." ); + } + } + + return 1; } \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/features/passive_mode.pwn b/gamemodes/irresistible/cnr/features/passive_mode.pwn index 99a8ce7..a3f197d 100644 --- a/gamemodes/irresistible/cnr/features/passive_mode.pwn +++ b/gamemodes/irresistible/cnr/features/passive_mode.pwn @@ -22,6 +22,14 @@ hook OnPlayerUpdateEx( playerid ) if ( p_AntiSpawnKillEnabled{ playerid } && g_iTime > p_AntiSpawnKill[ playerid ] ) { DisablePlayerSpawnProtection( playerid ); } + if ( GetPlayerWantedLevel( playerid ) > 0 ) + { + if ( IsPassivePlayerInVehicle( GetPlayerVehicleID( playerid ) ) ) + { + SyncObject( playerid ); + SendError( playerid, "You cannot enter vehicles with passive players in it as a wanted criminal." ); + } + } return 1; } @@ -69,7 +77,52 @@ hook OnPlayerUnjailed( playerid, reasonid ) return 1; } +hook OnPlayerEnterVehicle( playerid, vehicleid, ispassenger ) +{ + + if ( IsPlayerPassive( playerid ) ) + { + if ( IsWantedPlayerInVehicle( vehicleid ) ) + { + SetPlayerWantedLevel( playerid, 6 ); + ShowPlayerHelpDialog( playerid, 3000, "You are now considered wanted for associating yourself with a wanted player." ); + return 1; + } + } + return 1; + +} + /* ** Functions ** */ +stock GivePassivePassengersWanted( playerid, vehicleid ) +{ + foreach( new pID : Player ) + { + if ( !IsPlayerPassive( pID ) || IsPlayerNPC( pID ) || pID == playerid ) + continue; + + if ( GetPlayerVehicleID( pID ) == vehicleid ) + { + SetPlayerWantedLevel( pID, 6 ); + ShowPlayerHelpDialog( pID, 3000, "You are now considered wanted for associating yourself with a wanted player." ); + } + } + return true; +} + +stock IsPassivePlayerInVehicle( vehicleid ) +{ + foreach ( new pID : Player ) + { + if ( !IsPlayerPassive( pID ) || !IsPlayerInAnyVehicle( pID ) ) + continue; + + if ( GetPlayerVehicleID( pID ) == vehicleid ) + return true; + } + return false; +} + stock DisablePlayerSpawnProtection( playerid ) { if ( p_AntiSpawnKillEnabled{ playerid } ) diff --git a/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn b/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn index 9404e50..f8dc67a 100644 --- a/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn +++ b/gamemodes/irresistible/cnr/features/vehicles/vehicles.pwn @@ -305,6 +305,7 @@ CMD:v( playerid, params[ ] ) else if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be a driver to use this command." ); else if ( v == -1 ) return SendError( playerid, "This vehicle isn't a buyable vehicle." ); else if ( playerid != ownerid ) return SendError( playerid, "You cannot park this vehicle." ); + else if ( IsPlayerBelowSeaLevel( playerid ) ) return SendError( playerid, "You cannot use this command while below sea level." ); else { if ( IsVehicleUpsideDown( GetPlayerVehicleID( playerid ) ) ) return SendError( playerid, "Sorry, you're just going to have to ditch your car as soon as possible." ); @@ -344,8 +345,8 @@ CMD:v( playerid, params[ ] ) { if ( p_VehicleBringCooldown[ playerid ] > g_iTime ) return SendError( playerid, "You must wait %s before using this feature again.", secondstotime( p_VehicleBringCooldown[ playerid ] - g_iTime ) ); - - if ( p_OwnedVehicles[ playerid ] > 0 ) + else if ( IsPlayerBelowSeaLevel( playerid ) ) return SendError( playerid, "You cannot use this command while below sea level." ); + else if ( p_OwnedVehicles[ playerid ] > 0 ) { szLargeString = ""COL_WHITE"Bringing your vehicle to you will cost $10,000!\n"; for( new i; i < p_OwnedVehicles[ playerid ]; i++ ) @@ -383,6 +384,7 @@ CMD:v( playerid, params[ ] ) ; if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You must be inside a vehicle to use this command." ); else if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be a driver to use this command." ); + else if ( IsPlayerBelowSeaLevel( playerid ) ) return SendError( playerid, "You cannot use this command while below sea level." ); else if ( sscanf( params[ 6 ], "dd", color1, color2 ) ) return SendUsage( playerid, "/v color [COLOR_1] [COLOR_2]" ); else if ( g_buyableVehicle{ GetPlayerVehicleID( playerid ) } == false ) return SendError( playerid, "This isn't a buyable vehicle." ); else if ( GetPlayerCash( playerid ) < 100 ) return SendError( playerid, "You don't have enough cash for this." ); @@ -407,6 +409,7 @@ CMD:v( playerid, params[ ] ) ; if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You must be inside a vehicle to use this command." ); else if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be a driver to use this command." ); + else if ( IsPlayerBelowSeaLevel( playerid ) ) return SendError( playerid, "You cannot use this command while below sea level." ); else if ( sscanf( params[ 6 ], "s[32]", szPlate ) ) return SendUsage( playerid, "/v plate [TEXT]" ); else if ( g_buyableVehicle{ GetPlayerVehicleID( playerid ) } == false ) return SendError( playerid, "This isn't a buyable vehicle." ); else @@ -428,6 +431,7 @@ CMD:v( playerid, params[ ] ) ; if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You must be inside a vehicle to use this command." ); else if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be a driver to use this command." ); + else if ( IsPlayerBelowSeaLevel( playerid ) ) return SendError( playerid, "You cannot use this command while below sea level." ); else if ( sscanf( params[ 9 ], "d", paintjobid ) ) return SendUsage( playerid, "/v paintjob [PAINT_JOB_ID]" ); else if ( g_buyableVehicle{ GetPlayerVehicleID( playerid ) } == false ) return SendError( playerid, "This isn't a buyable vehicle." ); else if ( GetPlayerCash( playerid ) < 500 ) return SendError( playerid, "You don't have enough cash for this." ); @@ -450,6 +454,7 @@ CMD:v( playerid, params[ ] ) new v = getVehicleSlotFromID( vehicleid, ownerid ); if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You need to be in a vehicle to use this command." ); else if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendError( playerid, "You need to be a driver to use this command." ); + else if ( IsPlayerBelowSeaLevel( playerid ) ) return SendError( playerid, "You cannot use this command while below sea level." ); else if ( v == -1 ) return SendError( playerid, "This vehicle isn't a buyable vehicle." ); else if ( playerid != ownerid ) return SendError( playerid, "This vehicle does not belong to you." ); else @@ -461,7 +466,7 @@ CMD:v( playerid, params[ ] ) if ( !strcmp( params[ 7 ], "doors", true, 5 ) ) { if ( !strlen( params[ 13 ] ) ) return SendUsage( playerid, "/v toggle doors [OPEN/CLOSE]" ); - if ( strmatch( params[ 13 ], "open" ) ) { + else if ( strmatch( params[ 13 ], "open" ) ) { SetVehicleParamsCarDoors( vehicleid, 1, 1, 1, 1 ); return SendServerMessage( playerid, "You have opened the doors of this vehicle." ); } @@ -476,7 +481,7 @@ CMD:v( playerid, params[ ] ) else if ( !strcmp( params[ 7 ], "windows", true, 7 ) ) { if ( !strlen( params[ 15 ] ) ) return SendUsage( playerid, "/v toggle windows [OPEN/CLOSE]" ); - if ( strmatch( params[ 15 ], "open" ) ) { + else if ( strmatch( params[ 15 ], "open" ) ) { SetVehicleParamsCarWindows( vehicleid, 0, 0, 0, 0 ); return SendServerMessage( playerid, "You have opened the windows of this vehicle." ); } @@ -718,6 +723,8 @@ stock DestroyBuyableVehicle( playerid, vID, bool: db_remove = true ) ResetBuyableVehicleMods( playerid, vID ); } + CallLocalFunction( "OnPlayerVehicleDestroyed", "dd", playerid, vID ); + // Reset vehicle component data (hook into module) DestroyVehicleCustomComponents( playerid, vID, db_remove ); @@ -841,7 +848,11 @@ stock dischargeVehicles( playerid ) if ( p_OwnedVehicles[ playerid ] ) { for( new v; v < MAX_BUYABLE_VEHICLES; v++ ) - DestroyBuyableVehicle( playerid, v, .db_remove = false ); + { + if ( g_vehicleData[ playerid ][ v ][ E_MODEL ] == 508 ) RemovePlayersFromJourney( g_vehicleData[ playerid ][ v ][ E_VEHICLE_ID ] ); + DestroyBuyableVehicle( playerid, v, .db_remove = false ); + } + } return 1; } diff --git a/gamemodes/irresistible/cnr/features/vip/coin_generation.pwn b/gamemodes/irresistible/cnr/features/vip/coin_generation.pwn index fc770c3..8fb37f6 100644 --- a/gamemodes/irresistible/cnr/features/vip/coin_generation.pwn +++ b/gamemodes/irresistible/cnr/features/vip/coin_generation.pwn @@ -55,7 +55,7 @@ hook OnPlayerTickSecond( playerid ) iKeys, iUpDownKeys, iLeftRightKeys; // Increase Irresistible Coins (1/20 = cred/min) - if ( ! IsPlayerAFK( playerid ) && GetPlayerKeys( playerid, iKeys, iUpDownKeys, iLeftRightKeys ) && ! IsPlayerOnRoulette( playerid ) && ! IsPlayerOnSlotMachine( playerid ) && GetPlayerVehicleSeat( playerid ) <= 0 ) + if ( ! IsPlayerAFK( playerid ) && GetPlayerKeys( playerid, iKeys, iUpDownKeys, iLeftRightKeys ) && ! IsPlayerOnRoulette( playerid ) && ! IsPlayerOnSlotMachine( playerid ) && GetPlayerVehicleSeat( playerid ) <= 0 && !IsPlayerUsingAnimation( playerid ) ) { if ( iKeys != 0 || iUpDownKeys != 0 || iLeftRightKeys != 0 ) { // GetPlayerScore( playerid ) > 10 && diff --git a/gamemodes/irresistible/cnr/features/vip/coin_market.pwn b/gamemodes/irresistible/cnr/features/vip/coin_market.pwn index fce31d5..b40adf2 100644 --- a/gamemodes/irresistible/cnr/features/vip/coin_market.pwn +++ b/gamemodes/irresistible/cnr/features/vip/coin_market.pwn @@ -501,7 +501,7 @@ CMD:irresistiblecoins( playerid, params[ ] ) else if ( senttoid == playerid ) return SendError( playerid, "You cannot send yourself coins." ); else { - if ( GetDistanceBetweenPlayers( playerid, senttoid ) > 8.0 ) + if ( GetDistanceBetweenPlayers( playerid, senttoid ) > 8.0 || p_Spectating{ senttoid } ) return SendError( playerid, "Please make sure you are close to the player before sending coins to them." ); format( szNormalString, sizeof( szNormalString ), "INSERT INTO `TRANSACTIONS_IC` (`TO_ID`, `FROM_ID`, `IC`) VALUES (%d, %d, %f)", p_AccountID[ senttoid ], p_AccountID[ playerid ], coins ); diff --git a/gamemodes/irresistible/cnr/features/weapon_drop.pwn b/gamemodes/irresistible/cnr/features/weapon_drop.pwn index 25ab57b..6ae8f4f 100644 --- a/gamemodes/irresistible/cnr/features/weapon_drop.pwn +++ b/gamemodes/irresistible/cnr/features/weapon_drop.pwn @@ -317,42 +317,12 @@ CMD:dropweapon( playerid, params[ ] ) { if ( p_Spectating{ playerid } ) return SendError( playerid, "You cannot use such commands while you're spectating." ); new - iCurrentWeapon = GetPlayerWeapon( playerid ), - iWeaponID[ 13 ], - iWeaponAmmo[ 13 ] + iCurrentWeapon = GetPlayerWeapon( playerid ) ; if ( iCurrentWeapon != 0 ) { - for( new iSlot = 0; iSlot < sizeof( iWeaponAmmo ); iSlot++ ) - { - new - iWeapon, - iAmmo; - - GetPlayerWeaponData( playerid, iSlot, iWeapon, iAmmo ); - - if ( iWeapon != iCurrentWeapon ) { - GetPlayerWeaponData( playerid, iSlot, iWeaponID[ iSlot ], iWeaponAmmo[ iSlot ] ); - } - else - { - new - Float: X, Float: Y, Float: Z; - - if ( GetPlayerPos( playerid, X, Y, Z ) && CreateWeaponPickup( iWeapon, iAmmo, iSlot, X + fRandomEx( 0.5, 3.0 ), Y + fRandomEx( 0.5, 3.0 ), Z, GetServerTime( ) + 120, .nonpassive_only = false ) != ITER_NONE ) { - p_PlayerPickupDelay[ playerid ] = GetServerTime( ) + 3; - } - } - } - - ResetPlayerWeapons( playerid ); - - for( new iSlot = 0; iSlot < sizeof( iWeaponAmmo ); iSlot++ ) { - GivePlayerWeapon( playerid, iWeaponID[ iSlot ], 0 <= iWeaponAmmo[ iSlot ] < 16384 ? iWeaponAmmo[ iSlot ] : 16384 ); - } - - SetPlayerArmedWeapon( playerid, 0 ); // prevent driveby + RemoveSpecificPlayerWeapon( playerid, iCurrentWeapon, true ); return SendServerMessage( playerid, "You have dropped your weapon." ); } else { return SendError( playerid, "You are not holding any weapon." ); @@ -439,3 +409,47 @@ stock ClearInactiveWeaponDrops( ) } return 1; } + +stock RemoveSpecificPlayerWeapon( playerid, weaponid, bool:createpickup ) +{ + new + iCurrentWeapon = GetPlayerWeapon( playerid ), + iWeaponID[ 13 ], + iWeaponAmmo[ 13 ] + ; + + if ( iCurrentWeapon != 0 ) + { + for( new iSlot = 0; iSlot < sizeof( iWeaponAmmo ); iSlot++ ) + { + new + iWeapon, + iAmmo; + + GetPlayerWeaponData( playerid, iSlot, iWeapon, iAmmo ); + + if ( iWeapon != iCurrentWeapon || iWeapon != weaponid ) { + GetPlayerWeaponData( playerid, iSlot, iWeaponID[ iSlot ], iWeaponAmmo[ iSlot ] ); + } + + if ( createpickup ) + { + new + Float: X, Float: Y, Float: Z; + + if ( GetPlayerPos( playerid, X, Y, Z ) && CreateWeaponPickup( iWeapon, iAmmo, iSlot, X + fRandomEx( 0.5, 3.0 ), Y + fRandomEx( 0.5, 3.0 ), Z, GetServerTime( ) + 120, .nonpassive_only = false ) != ITER_NONE ) { + p_PlayerPickupDelay[ playerid ] = GetServerTime( ) + 3; + } + } + } + + ResetPlayerWeapons( playerid ); + + for( new iSlot = 0; iSlot < sizeof( iWeaponAmmo ); iSlot++ ) { + GivePlayerWeapon( playerid, iWeaponID[ iSlot ], 0 <= iWeaponAmmo[ iSlot ] < 16384 ? iWeaponAmmo[ iSlot ] : 16384 ); + } + + SetPlayerArmedWeapon( playerid, 0 ); // prevent driveby + } + return 1; +} \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/features/weed.pwn b/gamemodes/irresistible/cnr/features/weed.pwn index 6d814ce..ebf07c0 100644 --- a/gamemodes/irresistible/cnr/features/weed.pwn +++ b/gamemodes/irresistible/cnr/features/weed.pwn @@ -329,7 +329,6 @@ stock Weed_GetPlantLimit( playerid ) stock Weed_ResetSellingProperties( playerid ) { - Weed_ResetSellingProperties( playerid ); p_WeedSellingGrams[ playerid ] = 0; p_WeedSellingPrice[ playerid ] = 0; return 1; diff --git a/gamemodes/irresistible/cnr/wanted_level.pwn b/gamemodes/irresistible/cnr/wanted_level.pwn index 3eebc49..0ef8f17 100644 --- a/gamemodes/irresistible/cnr/wanted_level.pwn +++ b/gamemodes/irresistible/cnr/wanted_level.pwn @@ -50,6 +50,11 @@ stock CNR_SetPlayerWantedLevel( playerid, level ) ResetPlayerPassiveMode( playerid, .passive_disabled = true ); // remove passive mode if the player is wanted } } + else if ( IsPlayerInAnyVehicle( playerid ) ) + { + new vehicleID = GetPlayerVehicleID( playerid ); + GivePassivePassengersWanted( playerid, vehicleID ); + } else { PlayerTextDrawHide( playerid, p_WantedLevelTD[ playerid ] ); @@ -76,7 +81,12 @@ stock GivePlayerWantedLevel( playerid, level ) { if ( ! IsPlayerConnected( playerid ) || IsPlayerNPC( playerid ) || IsPlayerJailed( playerid ) || IsPlayerDueling( playerid ) || level == 0 ) return 0; - + else if ( IsPlayerInAnyVehicle( playerid ) ) + { + new vehicleID = GetPlayerVehicleID( playerid ); + GivePassivePassengersWanted( playerid, vehicleID ); + } + new current_wanted = GetPlayerWantedLevel( playerid ); @@ -91,4 +101,14 @@ stock ClearPlayerWantedLevel( playerid ) p_WantedLevel[ playerid ] = 0; SetPlayerWantedLevel( playerid, 0 ); SetPlayerColorToTeam( playerid ); +} + +stock IsWantedPlayerInVehicle( vehicleid ) +{ + foreach ( new pID : Player ) + { + if ( GetPlayerVehicleID( pID ) == vehicleid && GetPlayerWantedLevel( pID ) > 1 ) + return true; + } + return false; } \ No newline at end of file diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index a83734e..2e2c0bf 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -265,8 +265,12 @@ public OnServerUpdateTimer( ) { // AFK Jail if ( p_WantedLevel[ playerid ] >= 6 && p_InHouse[ playerid ] == -1 && !IsPlayerAdminOnDuty( playerid ) && !IsPlayerInEntrance( playerid, g_VIPLounge[ CITY_SF ] ) && !IsPlayerInEntrance( playerid, g_VIPLounge[ CITY_LV ] ) && !IsPlayerInEntrance( playerid, g_VIPLounge[ CITY_LS ] ) && !IsPlayerTied( playerid ) && !IsPlayerKidnapped( playerid ) && !IsPlayerCuffed( playerid ) && !IsPlayerTazed( playerid ) && IsPlayerSpawned( playerid ) ) { // && !IsPlayerDetained( playerid ) - JailPlayer( playerid, 60, 1 ); - SendGlobalMessage( -1, ""COL_GOLD"[JAIL]{FFFFFF} %s(%d) has been sent to jail for 60 seconds by the server "COL_LRED"[AFK Wanted]", ReturnPlayerName( playerid ), playerid ); + + if ( !AwardNearestLEO( playerid, 1 ) ) + { + JailPlayer( playerid, 60, 1 ); + SendGlobalMessage( -1, ""COL_GOLD"[JAIL]{FFFFFF} %s(%d) has been sent to jail for 60 seconds by the server "COL_LRED"[AFK Wanted]", ReturnPlayerName( playerid ), playerid ); + } } // AFK Admins @@ -2332,7 +2336,7 @@ CMD:vipjob( playerid, params[ ] ) if ( isnull( params ) ) return SendUsage( playerid, "/vipjob [PART OF JOB NAME]" ); - if ( ( iJob = GetJobIDFromName( params ) ) == 0xFE ) + if ( ( iJob = GetJobIDFromName( params ) ) == 0xFE || iJob < 0 || iJob > 7 ) return SendError( playerid, "You have entered an invalid job." ); if ( iJob != p_Job{ playerid } ) { @@ -2357,8 +2361,9 @@ CMD:mech( playerid, params[ ] ) ; if ( p_Class[ playerid ] != CLASS_CIVILIAN ) return SendError( playerid, "You must be a civilian to use this command." ); - if ( !IsPlayerJob( playerid, JOB_DIRTY_MECHANIC ) ) return SendError( playerid, "You are not a dirty mechanic." ); - if ( isnull( params ) ) return SendUsage( playerid, "/(mech)anic [FIX/NOS/REMP/FLIP/FLIX/PRICE/NEARBY]" ); + else if ( !IsPlayerJob( playerid, JOB_DIRTY_MECHANIC ) ) return SendError( playerid, "You are not a dirty mechanic." ); + else if ( IsPlayerBelowSeaLevel( playerid ) ) return SendError( playerid, "You cannot use this command while below sea level." ); + else if ( isnull( params ) ) return SendUsage( playerid, "/(mech)anic [FIX/NOS/REMP/FLIP/FLIX/PRICE/NEARBY]" ); else if ( strmatch( params, "fix" ) ) { if ( p_AntiMechFixSpam[ playerid ] > g_iTime ) @@ -2705,12 +2710,14 @@ CMD:emp( playerid, params[ ] ) { SendClientMessage( playerid, -1, ""COL_RED"[EMP]{FFFFFF} An Electromagnetic Pulse attempt has been repelled by an aluminum foil!" ); SendClientMessage( pID, -1, ""COL_GREEN"[EMP]{FFFFFF} Electromagnetic Pulse had been repelled by aluminum foil set on vehicle." ); + p_QuitToAvoidTimestamp[ pID ] = g_iTime + 15; return 1; } } SendClientMessageFormatted( pID, -1, ""COL_RED"[EMP]{FFFFFF} %s(%d) has sent an electromagnetic pulse on your vehicle causing it to crash for 30 seconds.", ReturnPlayerName( playerid ), playerid ); SendClientMessageFormatted( playerid, -1, ""COL_GREEN"[EMP]{FFFFFF} You have activated a electromagnetic pulse on %s(%d)'s vehicle!", ReturnPlayerName( pID ), pID ); + p_QuitToAvoidTimestamp[ pID ] = g_iTime + 15; SetTimerEx( "emp_deactivate", 30000, false, "d", GetPlayerVehicleID( pID ) ); GetVehicleParamsEx( iVehicle, engine, lights, alarm, doors, bonnet, boot, objective ); SetVehicleParamsEx( iVehicle, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective ); @@ -5038,6 +5045,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) case 17 .. 22: weaponid = listitem - 12; case 23 .. 24: weaponid = listitem - 9; } + if ( GetPlayerClass( playerid ) == CLASS_POLICE && weaponid == 9 ) return SendError( playerid, "You cannot purchase a chainsaw as a Law Enforcement Officer." ); GivePlayerWeapon( playerid, weaponid, 0xFFFF ); SendServerMessage( playerid, "You have redeemed a %s.", ReturnWeaponName( weaponid ) ); p_VIPWeaponRedeem[ playerid ] = g_iTime + ( p_VIPLevel[ playerid ] == VIP_PLATINUM ? 60 : 300 ); @@ -5565,6 +5573,8 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) { if ( x == listitem ) { + // Chainsaw Removal for LEO through Ammunation + if ( GetPlayerClass( playerid ) == CLASS_POLICE && g_AmmunationWeapons[ i ] [ E_WEPID ] == 9 ) return SendError( playerid, "You cannot purchase a chainsaw as a Law Enforcement Officer." ); if ( g_AmmunationWeapons[ i ] [ E_PRICE ] > GetPlayerCash( playerid ) ) { SendError( playerid, "You don't have enough money for this." ); @@ -7147,3 +7157,12 @@ stock GetPlayerOutsidePos( playerid, &Float: X, &Float: Y, &Float: Z ) // gets t } return 1; } + +stock IsPlayerBelowSeaLevel( playerid ) +{ + new Float: z; + + GetPlayerPos( playerid, z, z, z ); + + return z < 0.0; +} \ No newline at end of file diff --git a/scriptfiles/updates.txt b/scriptfiles/updates.txt index 242e9eb..8930e30 100644 --- a/scriptfiles/updates.txt +++ b/scriptfiles/updates.txt @@ -1,13 +1,17 @@ -(+) A percentage is showed in the top donor bar, which is the required total funding of the server for the month. -(+) Server features are shown to newly registered players. -(/) Breaking Cuffs is now at a 75% chance success rate. -(/) Jail Multiplier is now lowered from 3 to 2. -(/) /sm is no longer capped at a 90M transaction. -(/) /ic send limit has been increased from 5,000 to 10,000. -(/) Player money is saved on an inflow/outflow basis. Before, it saved only when you disconnected. -(/) You need 50 score to send private messages in the server. -(*) Bank Money changes now trigger it to be saved. Fixing IC & Stock selling issue. -(*) Fireworks purchasing is now functional and grants you the item upon purchase. -(*) Fixed issue with cop chat behaving abnormally. -(*) You cannot use /sync in jail. -(-) Knives have been removed due to abuse. \ No newline at end of file +(/) Weed is no longer taxed when bought or sold. (Kova) +(*) Quit to Avoid and AFK Wanted will now award the nearest LEO (75m On Foot, 150m In Vehicle). (Damen) +(*) Passive Mode Players are no longer able to enter Business Vehicles. (Damen) +(*) Passive Mode Players will now become wanted through association when interacting with wanted players. (Damen) +(*) Law Enforcement Officers are no longer able to purchase or obtain chainsaws. (Damen) +(*) When inside a player-owned Journey vehicle interior and the owner disconnects, you will be removed from the interior. (Damen) +(*) Info pickup text typo fixed. (Damen) +(*) /vipjob should no longer allow you to put in an incorrect job name and still take your money. (Damen) +(*) You can no longer use player-owned vehicle or dirty mechanic commands to allow your vehicle to drive underwater. (Damen) +(*) You can no longer relog to reset the Dirty Mechanic export timer restriction. (Damen) +(*) Removes the ability to send IC to administrators who are spectating you. (Damen) +(*) Removes the ability to farm IC by using animations. (Damen) +(*) You can no longer use animations while wearing a parachute to avoid fake deaths. (Damen) +(*) EMPs now trigger the anti-Q to avoid system to punish those who attempt to evade LEOs. (Damen) +(*) /spawn should now display beyond 60 homes. (Stev) +(*) Business production label should now display the correct amount of money. (Stev) +(*) Militia Ship should no longer be robbable through the wall. (Kova) \ No newline at end of file