adjustments made per comments and testing
This commit is contained in:
parent
21455d399f
commit
7278d113f5
@ -49,13 +49,6 @@ hook OnPlayerDeath( playerid, killerid, reason )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hook OnPlayerUpdate( playerid )
|
|
||||||
{
|
|
||||||
if ( IsPlayerAnyLEO( playerid ) && CheckIfPlayerHasWeapon( playerid, 9 ) )
|
|
||||||
RemoveSpecificPlayerWeapon( playerid, 9, false );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
hook OnPlayerSpawn( playerid )
|
hook OnPlayerSpawn( playerid )
|
||||||
{
|
{
|
||||||
if ( 0 <= playerid < MAX_PLAYERS )
|
if ( 0 <= playerid < MAX_PLAYERS )
|
||||||
|
@ -362,6 +362,16 @@ hook OnPlayerRequestSpawn( playerid )
|
|||||||
return IsPlayerClassApproved( 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 ) {
|
stock IsPlayerClassApproved( playerid ) {
|
||||||
|
|
||||||
// is logged in
|
// is logged in
|
||||||
@ -488,12 +498,4 @@ stock IsPlayerPolice( playerid )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
stock IsPlayerAnyLEO( playerid )
|
|
||||||
{
|
|
||||||
if ( IsPlayerPolice( playerid ) || IsPlayerArmy( playerid ) || IsPlayerCIA( playerid ) || IsPlayerFBI( playerid ) )
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
@ -362,7 +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 ( 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_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 ( GetPlayerState( playerid ) == PLAYER_STATE_EXIT_VEHICLE ) return SendError( playerid, "You cannot use this command since you're exiting a vehicle." );
|
||||||
else if ( IsPlayerWearingParachute( playerid ) ) 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
|
||||||
{
|
{
|
||||||
SetPlayerSpecialAction( playerid, 0 );
|
SetPlayerSpecialAction( playerid, 0 );
|
||||||
@ -397,13 +397,4 @@ stock IsPlayingAnimation( playerid, const library[ ], const animation[ ] )
|
|||||||
|
|
||||||
stock IsPlayerUsingAnimation( playerid ) {
|
stock IsPlayerUsingAnimation( playerid ) {
|
||||||
return p_InAnimation{ playerid };
|
return p_InAnimation{ playerid };
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
stock IsPlayerWearingParachute( playerid )
|
|
||||||
{
|
|
||||||
if ( GetPlayerWeapon( playerid ) == 46 )
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
@ -509,7 +509,7 @@ hook OnPlayerDriveVehicle( playerid, vehicleid )
|
|||||||
if ( IsPlayerPassive( playerid ) )
|
if ( IsPlayerPassive( playerid ) )
|
||||||
{
|
{
|
||||||
ShowPlayerHelpDialog( playerid, 2000, "Passive players cannot enter business vehicles." );
|
ShowPlayerHelpDialog( playerid, 2000, "Passive players cannot enter business vehicles." );
|
||||||
RemovePlayerFromVehicle( playerid );
|
SyncObject( playerid );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,12 +20,13 @@ forward OnPlayerArrested( playerid, victimid, totalarrests, totalpeople );
|
|||||||
/* ** Hooks ** */
|
/* ** Hooks ** */
|
||||||
hook OnPlayerDisconnect( playerid, reason )
|
hook OnPlayerDisconnect( playerid, reason )
|
||||||
{
|
{
|
||||||
|
|
||||||
p_AwaitingBCAttempt{ playerid } = false;
|
p_AwaitingBCAttempt{ playerid } = false;
|
||||||
KillTimer( p_AwaitingBCAttemptTimer[ playerid ] );
|
KillTimer( p_AwaitingBCAttemptTimer[ playerid ] );
|
||||||
p_AwaitingBCAttemptTimer[ playerid ] = -1;
|
p_AwaitingBCAttemptTimer[ playerid ] = -1;
|
||||||
|
|
||||||
// Quit to Avoid - Award Handling
|
// Quit to Avoid - Award Handling
|
||||||
AwardNearestLEO( playerid, 0 );
|
if ( playerid != INVALID_PLAYER_ID ) AwardNearestLEO( playerid, 0 );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,22 +493,15 @@ function BreakPlayerCuffsAttempt( playerid ) return BreakPlayerCuffs( playerid )
|
|||||||
|
|
||||||
stock AwardNearestLEO( playerid, reason )
|
stock AwardNearestLEO( playerid, reason )
|
||||||
{
|
{
|
||||||
|
if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID )
|
||||||
|
return false;
|
||||||
|
|
||||||
new
|
new
|
||||||
Float: x, Float: y, Float: z,
|
|
||||||
closestLEO = INVALID_PLAYER_ID,
|
closestLEO = INVALID_PLAYER_ID,
|
||||||
radius = ( IsPlayerInAnyVehicle( playerid ) ? 150 : 75 ); // If player is in a vehicle, increase radius due to ability to get farther quicker.
|
Float: radius = ( IsPlayerInAnyVehicle( playerid ) ? 150.0 : 75.0 ) // If player is in a vehicle, increase radius due to ability to get farther quicker.
|
||||||
|
;
|
||||||
|
|
||||||
GetPlayerPos( playerid, x, y, z );
|
closestLEO = GetClosestPlayerEx( playerid, CLASS_POLICE, radius );
|
||||||
|
|
||||||
foreach( new pID : Player )
|
|
||||||
{
|
|
||||||
if ( p_Class[ pID ] != CLASS_POLICE ) continue;
|
|
||||||
|
|
||||||
new Float: distance = GetDistanceBetweenPlayers( playerid, pID );
|
|
||||||
|
|
||||||
if ( distance < radius && distance < closestLEO )
|
|
||||||
closestLEO = pID;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( closestLEO != INVALID_PLAYER_ID )
|
if ( closestLEO != INVALID_PLAYER_ID )
|
||||||
{
|
{
|
||||||
@ -527,13 +521,13 @@ stock AwardNearestLEO( playerid, reason )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hook OnPlayerEnterDynamicCP( playerid, checkpointid )
|
hook OnPlayerAccessEntrance( playerid, entranceid, worldid, interiorid )
|
||||||
{
|
{
|
||||||
if ( !p_InHouse[ playerid ] && GetPlayerWantedLevel( playerid ) > 2 )
|
if ( GetPlayerWantedLevel( playerid ) > 2 )
|
||||||
{
|
{
|
||||||
new Float: x, Float: y, Float: z;
|
new Float: x, Float: y, Float: z;
|
||||||
|
|
||||||
GetEntrancePos( checkpointid, x, y, z );
|
GetEntrancePos( entranceid, x, y, z );
|
||||||
|
|
||||||
foreach ( new pID : Player )
|
foreach ( new pID : Player )
|
||||||
{
|
{
|
||||||
|
@ -69,6 +69,7 @@ static stock
|
|||||||
|
|
||||||
/* ** Forwards ** */
|
/* ** Forwards ** */
|
||||||
forward OnMethamphetamineCooking( playerid, vehicleid, last_chemical );
|
forward OnMethamphetamineCooking( playerid, vehicleid, last_chemical );
|
||||||
|
forward OnPlayerVehicleDestroyed( playerid, slot );
|
||||||
|
|
||||||
/* ** Hooks ** */
|
/* ** Hooks ** */
|
||||||
hook OnPlayerDisconnect( playerid, reason )
|
hook OnPlayerDisconnect( playerid, reason )
|
||||||
@ -341,6 +342,12 @@ public OnMethamphetamineCooking( playerid, vehicleid, last_chemical )
|
|||||||
return 1;
|
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 ** */
|
/* ** Commands ** */
|
||||||
CMD:meth( playerid, params[ ] )
|
CMD:meth( playerid, params[ ] )
|
||||||
{
|
{
|
||||||
@ -521,7 +528,7 @@ stock SetPlayerCausticSoda( playerid, amount ) {
|
|||||||
|
|
||||||
stock RemovePlayersFromJourney( vehicleID )
|
stock RemovePlayersFromJourney( vehicleID )
|
||||||
{
|
{
|
||||||
new Float: x, Float: y, Float: z;
|
new Float: x, Float: y, Float: z, Float: Angle;
|
||||||
|
|
||||||
foreach ( new playerid : Player )
|
foreach ( new playerid : Player )
|
||||||
{
|
{
|
||||||
@ -530,14 +537,13 @@ stock RemovePlayersFromJourney( vehicleID )
|
|||||||
haltMethamphetamine( playerid, vehicleID );
|
haltMethamphetamine( playerid, vehicleID );
|
||||||
|
|
||||||
GetVehiclePos( vehicleID, x, y, z );
|
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 );
|
SetPlayerPos( playerid, x, y, z );
|
||||||
SetPlayerInterior( playerid, 0 );
|
SetPlayerInterior( playerid, 0 );
|
||||||
SetPlayerVirtualWorld( playerid, 0 );
|
SetPlayerVirtualWorld( playerid, 0 );
|
||||||
|
|
||||||
p_MuriaticAcid{ playerid } = 0;
|
|
||||||
p_CausticSoda{ playerid } = 0;
|
|
||||||
p_Methamphetamine{ playerid } = 0;
|
|
||||||
p_HydrogenChloride{ playerid } = 0;
|
|
||||||
|
|
||||||
SendServerMessage( playerid, "You have been removed from a player-owned Journey as the player who owned it has left the server." );
|
SendServerMessage( playerid, "You have been removed from a player-owned Journey as the player who owned it has left the server." );
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ hook OnPlayerUpdateEx( playerid )
|
|||||||
{
|
{
|
||||||
if ( IsPassivePlayerInVehicle( GetPlayerVehicleID( playerid ) ) )
|
if ( IsPassivePlayerInVehicle( GetPlayerVehicleID( playerid ) ) )
|
||||||
{
|
{
|
||||||
RemovePlayerFromVehicle( playerid );
|
SyncObject( playerid );
|
||||||
SendError( playerid, "You cannot enter vehicles with passive players in it as a wanted criminal." );
|
SendError( playerid, "You cannot enter vehicles with passive players in it as a wanted criminal." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,11 +94,11 @@ hook OnPlayerEnterVehicle( playerid, vehicleid, ispassenger )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ** Functions ** */
|
/* ** Functions ** */
|
||||||
stock GivePassivePassengersWanted( vehicleid )
|
stock GivePassivePassengersWanted( playerid, vehicleid )
|
||||||
{
|
{
|
||||||
foreach( new pID : Player )
|
foreach( new pID : Player )
|
||||||
{
|
{
|
||||||
if ( !IsPlayerPassive( pID ) || !IsPlayerInAnyVehicle( pID ) )
|
if ( !IsPlayerPassive( pID ) || IsPlayerNPC( pID ) || pID == playerid )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ( GetPlayerVehicleID( pID ) == vehicleid )
|
if ( GetPlayerVehicleID( pID ) == vehicleid )
|
||||||
|
@ -723,6 +723,8 @@ stock DestroyBuyableVehicle( playerid, vID, bool: db_remove = true )
|
|||||||
ResetBuyableVehicleMods( playerid, vID );
|
ResetBuyableVehicleMods( playerid, vID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CallLocalFunction( "OnPlayerVehicleDestroyed", "dd", playerid, vID );
|
||||||
|
|
||||||
// Reset vehicle component data (hook into module)
|
// Reset vehicle component data (hook into module)
|
||||||
DestroyVehicleCustomComponents( playerid, vID, db_remove );
|
DestroyVehicleCustomComponents( playerid, vID, db_remove );
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ stock CNR_SetPlayerWantedLevel( playerid, level )
|
|||||||
else if ( IsPlayerInAnyVehicle( playerid ) )
|
else if ( IsPlayerInAnyVehicle( playerid ) )
|
||||||
{
|
{
|
||||||
new vehicleID = GetPlayerVehicleID( playerid );
|
new vehicleID = GetPlayerVehicleID( playerid );
|
||||||
GivePassivePassengersWanted( vehicleID );
|
GivePassivePassengersWanted( playerid, vehicleID );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ stock GivePlayerWantedLevel( playerid, level )
|
|||||||
else if ( IsPlayerInAnyVehicle( playerid ) )
|
else if ( IsPlayerInAnyVehicle( playerid ) )
|
||||||
{
|
{
|
||||||
new vehicleID = GetPlayerVehicleID( playerid );
|
new vehicleID = GetPlayerVehicleID( playerid );
|
||||||
GivePassivePassengersWanted( vehicleID );
|
GivePassivePassengersWanted( playerid, vehicleID );
|
||||||
}
|
}
|
||||||
|
|
||||||
new
|
new
|
||||||
@ -107,9 +107,6 @@ stock IsWantedPlayerInVehicle( vehicleid )
|
|||||||
{
|
{
|
||||||
foreach ( new pID : Player )
|
foreach ( new pID : Player )
|
||||||
{
|
{
|
||||||
if ( !IsPlayerInAnyVehicle( pID ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ( GetPlayerVehicleID( pID ) == vehicleid && GetPlayerWantedLevel( pID ) > 1 )
|
if ( GetPlayerVehicleID( pID ) == vehicleid && GetPlayerWantedLevel( pID ) > 1 )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public Migrations_CheckMissing( )
|
|||||||
new
|
new
|
||||||
num_migrations = Migrations_GetCount( );
|
num_migrations = Migrations_GetCount( );
|
||||||
|
|
||||||
if ( executed_migrations < num_migrations )
|
if ( executed_migrations != num_migrations )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
dir: migrations_directory = dir_open( SERVER_MIGRATIONS_FOLDER ),
|
dir: migrations_directory = dir_open( SERVER_MIGRATIONS_FOLDER ),
|
||||||
|
@ -5043,7 +5043,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
|||||||
case 17 .. 22: weaponid = listitem - 12;
|
case 17 .. 22: weaponid = listitem - 12;
|
||||||
case 23 .. 24: weaponid = listitem - 9;
|
case 23 .. 24: weaponid = listitem - 9;
|
||||||
}
|
}
|
||||||
if ( IsPlayerAnyLEO( playerid ) && weaponid == 9 ) return SendError( playerid, "You cannot purchase a chainsaw as a Law Enforcement Officer." );
|
if ( GetPlayerClass( playerid ) == CLASS_POLICE && weaponid == 9 ) return SendError( playerid, "You cannot purchase a chainsaw as a Law Enforcement Officer." );
|
||||||
GivePlayerWeapon( playerid, weaponid, 0xFFFF );
|
GivePlayerWeapon( playerid, weaponid, 0xFFFF );
|
||||||
SendServerMessage( playerid, "You have redeemed a %s.", ReturnWeaponName( weaponid ) );
|
SendServerMessage( playerid, "You have redeemed a %s.", ReturnWeaponName( weaponid ) );
|
||||||
p_VIPWeaponRedeem[ playerid ] = g_iTime + ( p_VIPLevel[ playerid ] == VIP_PLATINUM ? 60 : 300 );
|
p_VIPWeaponRedeem[ playerid ] = g_iTime + ( p_VIPLevel[ playerid ] == VIP_PLATINUM ? 60 : 300 );
|
||||||
@ -5572,7 +5572,7 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
|||||||
if ( x == listitem )
|
if ( x == listitem )
|
||||||
{
|
{
|
||||||
// Chainsaw Removal for LEO through Ammunation
|
// Chainsaw Removal for LEO through Ammunation
|
||||||
if ( IsPlayerAnyLEO( playerid ) && g_AmmunationWeapons[ i ] [ E_WEPID ] == 9 ) return SendError( playerid, "You cannot purchase a chainsaw as a Law Enforcement Officer." );
|
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 ) )
|
if ( g_AmmunationWeapons[ i ] [ E_PRICE ] > GetPlayerCash( playerid ) )
|
||||||
{
|
{
|
||||||
SendError( playerid, "You don't have enough money for this." );
|
SendError( playerid, "You don't have enough money for this." );
|
||||||
@ -7162,8 +7162,5 @@ stock IsPlayerBelowSeaLevel( playerid )
|
|||||||
|
|
||||||
GetPlayerPos( playerid, x, y, z );
|
GetPlayerPos( playerid, x, y, z );
|
||||||
|
|
||||||
if ( z < 0.0 )
|
return z < 0.0;
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user