chuffsec module can be commented to disable now

This commit is contained in:
Lorenc Pekaj 2018-09-11 18:17:37 +10:00
parent 759ee28afb
commit 070770ad22
3 changed files with 54 additions and 14 deletions

View File

@ -118,7 +118,9 @@ CMD:vrespawn( playerid, params[ ] )
return SendUsage( playerid, "/vrespawn [VEHICLE_ID]" ); return SendUsage( playerid, "/vrespawn [VEHICLE_ID]" );
} }
else if ( !IsValidVehicle( vID ) ) return SendError( playerid, "Invalid Vehicle ID" ); else if ( !IsValidVehicle( vID ) ) return SendError( playerid, "Invalid Vehicle ID" );
#if defined __cnr__chuffsec
else if ( IsVehicleSecurityVehicle( vID ) ) return SendError( playerid, "This vehicle is prohibited." ); else if ( IsVehicleSecurityVehicle( vID ) ) return SendError( playerid, "This vehicle is prohibited." );
#endif
else else
{ {
SetVehicleToRespawn( vID ); SetVehicleToRespawn( vID );
@ -145,7 +147,9 @@ CMD:vdestroy( playerid, params[ ] )
if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You're not in any vehicle." ); if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You're not in any vehicle." );
vID = GetPlayerVehicleID( playerid ); vID = GetPlayerVehicleID( playerid );
if ( IsBuyableVehicle( vID ) ) return SendError( playerid, "You cannot use this command to destroy buyable vehicles." ); if ( IsBuyableVehicle( vID ) ) return SendError( playerid, "You cannot use this command to destroy buyable vehicles." );
#if defined __cnr__chuffsec
if ( IsVehicleSecurityVehicle( vID ) ) return SendError( playerid, "This vehicle is prohibited." ); if ( IsVehicleSecurityVehicle( vID ) ) return SendError( playerid, "This vehicle is prohibited." );
#endif
if ( g_TrolleyVehicles[ 0 ] == vID || g_TrolleyVehicles[ 1 ] == vID || g_TrolleyVehicles[ 2 ] == vID || g_TrolleyVehicles[ 3 ] == vID || g_TrolleyVehicles[ 4 ] == vID ) return SendError( playerid, "This vehicle is prohibited." ); if ( g_TrolleyVehicles[ 0 ] == vID || g_TrolleyVehicles[ 1 ] == vID || g_TrolleyVehicles[ 2 ] == vID || g_TrolleyVehicles[ 3 ] == vID || g_TrolleyVehicles[ 4 ] == vID ) return SendError( playerid, "This vehicle is prohibited." );
DestroyVehicle( vID ); DestroyVehicle( vID );
if ( g_adminSpawnedCar{ vID } ) g_adminSpawnedCar{ vID } = false; if ( g_adminSpawnedCar{ vID } ) g_adminSpawnedCar{ vID } = false;
@ -154,7 +158,9 @@ CMD:vdestroy( playerid, params[ ] )
} }
else if ( !IsValidVehicle( vID ) ) return SendError( playerid, "Invalid Vehicle ID" ); else if ( !IsValidVehicle( vID ) ) return SendError( playerid, "Invalid Vehicle ID" );
else if ( IsBuyableVehicle( vID ) ) return SendError( playerid, "You cannot use this command to destroy buyable vehicles." ); else if ( IsBuyableVehicle( vID ) ) return SendError( playerid, "You cannot use this command to destroy buyable vehicles." );
#if defined __cnr__chuffsec
else if ( IsVehicleSecurityVehicle( vID ) ) return SendError( playerid, "This vehicle is prohibited." ); else if ( IsVehicleSecurityVehicle( vID ) ) return SendError( playerid, "This vehicle is prohibited." );
#endif
else if ( g_TrolleyVehicles[ 0 ] == vID || g_TrolleyVehicles[ 1 ] == vID || g_TrolleyVehicles[ 2 ] == vID || g_TrolleyVehicles[ 3 ] == vID || g_TrolleyVehicles[ 4 ] == vID ) return SendError( playerid, "This vehicle is prohibited." ); else if ( g_TrolleyVehicles[ 0 ] == vID || g_TrolleyVehicles[ 1 ] == vID || g_TrolleyVehicles[ 2 ] == vID || g_TrolleyVehicles[ 3 ] == vID || g_TrolleyVehicles[ 4 ] == vID ) return SendError( playerid, "This vehicle is prohibited." );
else else
{ {

View File

@ -186,6 +186,32 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
return 1; return 1;
} }
hook OnPlayerRequestSpawn( playerid )
{
if ( IsPlayerSecurityDriver( playerid ) )
{
SetPlayerSkin( playerid, 71 );
return Y_HOOKS_BREAK_RETURN_1;
}
return 1;
}
hook OnPlayerUpdate( playerid )
{
if ( IsPlayerSecurityDriver( playerid ) ) { // prevent unneccessary updating
return Y_HOOKS_BREAK_RETURN_1;
}
return Y_HOOKS_CONTINUE_RETURN_1;
}
hook OnPlayerSpawn( playerid )
{
if ( IsPlayerSecurityDriver( playerid ) ) {
return Y_HOOKS_BREAK_RETURN_1;
}
return Y_HOOKS_CONTINUE_RETURN_1;
}
/* ** Commands ** */ /* ** Commands ** */
CMD:chuffloc( playerid, params[ ] ) CMD:chuffloc( playerid, params[ ] )

View File

@ -4939,9 +4939,6 @@ public OnPlayerSpawn( playerid )
new new
iTick = GetTickCount( ); iTick = GetTickCount( );
if ( IsPlayerSecurityDriver( playerid ) )
return 1;
UpdatePlayerTime( playerid ); UpdatePlayerTime( playerid );
DeletePVar( playerid, "attached_mugshot" ); DeletePVar( playerid, "attached_mugshot" );
@ -7903,9 +7900,12 @@ CMD:cnr( playerid, params[ ] )
new new
Float: iClass[ 2 ]; Float: iClass[ 2 ];
for( new i = 0; i < MAX_PLAYERS; i++ ) for( new i = 0; i < MAX_PLAYERS; i++ ) if ( IsPlayerConnected( i ) ) {
if ( IsPlayerConnected( i ) && i != g_secureTruckDriver ) #if defined __cnr__chuffsec
if ( i == g_secureTruckDriver ) continue;
#endif
iClass[ ( p_Class[ i ] == CLASS_POLICE ? CLASS_POLICE : CLASS_CIVILIAN ) ] ++; iClass[ ( p_Class[ i ] == CLASS_POLICE ? CLASS_POLICE : CLASS_CIVILIAN ) ] ++;
}
new new
Float: iCivilians = ( iClass[ CLASS_CIVILIAN ] / ( iClass[ CLASS_CIVILIAN ] + iClass[ CLASS_POLICE ] ) ) * 100.0, Float: iCivilians = ( iClass[ CLASS_CIVILIAN ] / ( iClass[ CLASS_CIVILIAN ] + iClass[ CLASS_POLICE ] ) ) * 100.0,
@ -11969,10 +11969,17 @@ CMD:c4( playerid, params[ ] )
g_C4Data[ playerid ] [ ID ] [ E_INTERIOR ] = GetPlayerInterior( playerid ); g_C4Data[ playerid ] [ ID ] [ E_INTERIOR ] = GetPlayerInterior( playerid );
g_C4Data[ playerid ] [ ID ] [ E_SET ] = true; g_C4Data[ playerid ] [ ID ] [ E_SET ] = true;
if ( !iVehicle ) if ( ! iVehicle ) {
iVehicle = GetPlayerSurfingVehicleID( playerid ); iVehicle = GetPlayerSurfingVehicleID( playerid );
}
if ( IsValidVehicle( iVehicle ) && iVehicle != g_secureTruckVehicle ) #if defined __cnr__chuffsec
if ( iVehicle == g_secureTruckVehicle ) {
iVehicle = INVALID_VEHICLE_ID;
}
#endif
if ( IsValidVehicle( iVehicle ) )
{ {
GetVehiclePos( iVehicle, X, Y, Z ); GetVehiclePos( iVehicle, X, Y, Z );
@ -13999,9 +14006,6 @@ public OnRconCommand(cmd[])
public OnPlayerRequestSpawn( playerid ) public OnPlayerRequestSpawn( playerid )
{ {
if ( IsPlayerSecurityDriver( playerid ) )
return SetPlayerSkin( playerid, 71 );
// army limit // army limit
/*if ( IsPlayerArmy( playerid ) ) /*if ( IsPlayerArmy( playerid ) )
{ {
@ -15118,9 +15122,6 @@ function unpause_Player( playerid )
public OnPlayerUpdate( playerid ) public OnPlayerUpdate( playerid )
{ {
if ( IsPlayerSecurityDriver( playerid ) )
return 1;
if ( !p_PlayerLogged{ playerid } ) if ( !p_PlayerLogged{ playerid } )
return 0; return 0;
@ -20651,8 +20652,10 @@ stock GivePlayerWantedLevel( playerid, wantedlevel, bool:loadingstats = false )
if ( !IsPlayerConnected( playerid ) ) if ( !IsPlayerConnected( playerid ) )
return 0; return 0;
#if defined __cnr__chuffsec
if ( IsPlayerSecurityDriver( playerid ) ) if ( IsPlayerSecurityDriver( playerid ) )
return SetPlayerColor( playerid, COLOR_SECURITY ); return SetPlayerColor( playerid, COLOR_SECURITY );
#endif
if ( IsPlayerJailed( playerid ) ) if ( IsPlayerJailed( playerid ) )
{ {
@ -20896,7 +20899,10 @@ stock GetPlayerIDFromAccountID( iAccountID )
stock SetPlayerColorToTeam( playerid ) stock SetPlayerColorToTeam( playerid )
{ {
#if defined __cnr__chuffsec
if ( IsPlayerSecurityDriver( playerid ) ) return SetPlayerColor( playerid, COLOR_SECURITY ); if ( IsPlayerSecurityDriver( playerid ) ) return SetPlayerColor( playerid, COLOR_SECURITY );
#endif
if ( p_AdminOnDuty{ playerid } ) return SetPlayerColor( playerid, COLOR_PINK ); if ( p_AdminOnDuty{ playerid } ) return SetPlayerColor( playerid, COLOR_PINK );
switch( p_Class[ playerid ] ) switch( p_Class[ playerid ] )
@ -22326,8 +22332,10 @@ stock isValidPlayerName( szName[ ] )
//strreplacechar( szName, '.', '-' ); //strreplacechar( szName, '.', '-' );
strreplacechar( szName, '/', '-' ); strreplacechar( szName, '/', '-' );
#if defined __cnr__chuffsec
if ( strmatch( szName, SECURE_TRUCK_DRIVER_NAME ) ) if ( strmatch( szName, SECURE_TRUCK_DRIVER_NAME ) )
return false; return false;
#endif
if( !( 2 < strlen( szName ) < MAX_PLAYER_NAME ) ) if( !( 2 < strlen( szName ) < MAX_PLAYER_NAME ) )
return false; return false;