modularize chuffsec

This commit is contained in:
Lorenc Pekaj 2018-09-11 17:30:24 +10:00
parent 3e739ffd48
commit a99e86216b
8 changed files with 295 additions and 252 deletions

View File

@ -5,7 +5,15 @@
This framework allows you to easily collaborate on Irresistible Gaming servers. This framework allows you to easily collaborate on Irresistible Gaming servers.
Internal Server Hooks: Internal Server Callbacks (Hookable):
- SetPlayerRandomSpawn( ) - SetPlayerRandomSpawn( )
* When a player is attempting to spawn somewhere randomly * When a player is attempting to spawn somewhere randomly
- OnServerUpdate( )
- OnPlayerUpdateEx( )
- OnNpcConnect( npcid )
- OnPlayerDriveVehicle( playerid, vehicleid )
*/ */

View File

@ -28,7 +28,7 @@ CMD:acmds( playerid, params[ ] )
SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /createhouse, /destroyhouse, /respawnallv, /achangename, /toggleviewpm, /unban(ip)" ); SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /createhouse, /destroyhouse, /respawnallv, /achangename, /toggleviewpm, /unban(ip)" );
SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /createcar, /destroycar, /stripcarmods, /createbribe, /destroybribe, /doublexp, /(h/v)adminsell" ); SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /createcar, /destroycar, /stripcarmods, /createbribe, /destroybribe, /doublexp, /(h/v)adminsell" );
SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /autovehrespawn, /megaban, /acunban, /creategate, /editgate, /connectsong, /discordurl" ); SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /autovehrespawn, /megaban, /acunban, /creategate, /editgate, /connectsong, /discordurl" );
SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /creategarage, /destroygarage, /check" ); SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /creategarage, /destroygarage, /check, /reconnectchuff" );
if ( p_AdminLevel[ playerid ] > 5 ) { if ( p_AdminLevel[ playerid ] > 5 ) {
SendClientMessage( playerid, COLOR_WHITE, " LEVEL 6: /setirc, /seteventhost, /setlevel, /setleveloffline, /svrstats, /playaction, /playanimation" ); SendClientMessage( playerid, COLOR_WHITE, " LEVEL 6: /setirc, /seteventhost, /setlevel, /setleveloffline, /svrstats, /playaction, /playanimation" );

View File

@ -511,7 +511,7 @@ CMD:respawnallv( playerid, params[ ] )
else else
{ {
for( new i; i < MAX_VEHICLES; i++ ) if ( IsValidVehicle( i ) ) { for( new i; i < MAX_VEHICLES; i++ ) if ( IsValidVehicle( i ) ) {
#if ENABLED_SECURE_TRUCK #if defined __cnr__chuffsec
if ( g_secureTruckVehicle == i ) continue; if ( g_secureTruckVehicle == i ) continue;
#endif #endif
SetVehicleToRespawn( i ); SetVehicleToRespawn( i );
@ -522,6 +522,19 @@ CMD:respawnallv( playerid, params[ ] )
return 1; return 1;
} }
#if defined __cnr__chuffsec
CMD:reconnectchuff( playerid, params[ ] )
{
if ( p_AdminLevel[ playerid ] < 5 )
return SendError( playerid, ADMIN_COMMAND_REJECT );
ConnectNPC( SECURE_TRUCK_DRIVER_NAME, "secureguard" );
AddAdminLogLineFormatted( "%s(%d) has attempted to reconnect %s", ReturnPlayerName( playerid ), playerid, SECURE_TRUCK_DRIVER_NAME );
SendServerMessage( playerid, "You are now attempting to reconnect %s.", SECURE_TRUCK_DRIVER_NAME );
return 1;
}
#endif
CMD:createbribe( playerid, params[ ] ) CMD:createbribe( playerid, params[ ] )
{ {
new new

View File

@ -259,16 +259,6 @@ thread OnQueryServerViaRCON( playerid )
return 1; return 1;
} }
#if ENABLED_SECURE_TRUCK == true
CMD:connectnpc( playerid, params[ ] )
{
if ( !IsPlayerAdmin( playerid ) ) return 0;
ConnectNPC( SECURE_TRUCK_DRIVER_NAME, "secureguard" );
SendServerMessage( playerid, "Connecting NPC now." );
return 1;
}
#endif
CMD:addcomponent( playerid, params[ ] ) CMD:addcomponent( playerid, params[ ] )
{ {
new new

View File

@ -27,6 +27,7 @@
#include "irresistible\cnr\features\crowdfund.pwn" #include "irresistible\cnr\features\crowdfund.pwn"
#include "irresistible\cnr\features\paintball.pwn" #include "irresistible\cnr\features\paintball.pwn"
#include "irresistible\cnr\features\random_messages.pwn" #include "irresistible\cnr\features\random_messages.pwn"
#include "irresistible\cnr\features\chuffsec.pwn"
// #include "irresistible\cnr\features\pilot.pwn" // #include "irresistible\cnr\features\pilot.pwn"
// #include "irresistible\cnr\features\fishing.pwn" // #include "irresistible\cnr\features\fishing.pwn"
// #include "irresistible\cnr\features\vote.pwn" // #include "irresistible\cnr\features\vote.pwn"

View File

@ -0,0 +1,262 @@
/*
* Irresistible Gaming (c) 2018
* Developed by Lorenc Pekaj
* Module:
* Purpose:
*/
/* ** Error checking ** */
#if !defined __cnr__chuffsec
#define __cnr__chuffsec
#endif
/* ** Includes ** */
#include < YSI\y_hooks >
/* ** Definitions ** */
#define SECURE_TRUCK_DRIVER_NAME ( "ChuffSec" )
#define SECURE_TRUCK_DISTANCE ( 6.0 )
#define SECURE_TRUCK_RADIUS ( 4.0 )
#define COLOR_SECURITY 0xFF440500
#define PROGRESS_ROBTRUCK 2
/* ** Variables ** */
enum E_SECURE_OFFSET {
Float: E_X, Float: E_Y, Float: E_Z,
bool: E_LEFT, bool: E_ENABLED, Float: E_HP
};
enum E_SECURE_VEHICLE {
E_LOOT, bool: E_ROBBED, bool: E_OPEN,
bool: E_BEING_ROBBED, E_MAP_ICON
};
new
Float: g_secureTruckOffsets[ ] [ E_SECURE_OFFSET ] =
{
{ 0.6641840, -3.134811, -0.072469, false, true, 100.0 },
{ 0.6666250, -3.096450, 1.2469670, false, true, 100.0 },
{ -0.641235, -3.098449, 1.2477970, true , true, 100.0 },
{ -0.637695, -3.136108, -0.079330, true , true, 100.0 }
},
g_secureTruckData [ E_SECURE_VEHICLE ],
g_secureTruckDriver = INVALID_PLAYER_ID,
g_secureTruckVehicle = INVALID_VEHICLE_ID,
Text3D: g_secureTruckVehicleLabel [ sizeof( g_secureTruckOffsets ) ] = { Text3D: INVALID_3DTEXT_ID, ... }
;
/* ** Hooks ** */
hook OnScriptInit( )
{
g_secureTruckVehicle = AddStaticVehicle( 428, 2000.0, 2000.0, 2000.0, 180.0, -1, -1 );
for( new i = 0; i < sizeof( g_secureTruckOffsets ); i++ ) {
g_secureTruckVehicleLabel[ i ] = CreateDynamic3DTextLabel( "100%", setAlpha( COLOR_GREY, 0x90 ), g_secureTruckOffsets[ i ] [ E_X ], g_secureTruckOffsets[ i ] [ E_Y ], g_secureTruckOffsets[ i ] [ E_Z ], 25.0, INVALID_PLAYER_ID, g_secureTruckVehicle );
}
ConnectNPC( SECURE_TRUCK_DRIVER_NAME, "secureguard" );
return 1;
}
hook OnPlayerUpdateEx( playerid )
{
static
Float: fX, Float: fY, Float: fZ;
if ( IsPlayerConnected( g_secureTruckDriver ) )
{
if ( IsSecurityDriverAFK( ) )
{
if ( GetPlayerSurfingVehicleID( playerid ) == g_secureTruckVehicle || IsPlayerInVehicle( playerid, g_secureTruckVehicle ) ) {
SendServerMessage( playerid, "You seemed to fly away with the security guard. You've been teleported to a spawn." );
CallLocalFunction( "SetPlayerRandomSpawn", "d", playerid );
}
if ( g_secureTruckData[ E_MAP_ICON ] != 0xFFFF ) {
SetVehicleParamsCarDoors( g_secureTruckVehicle, 0, 0, 0, 0 );
DestroyDynamicMapIcon( g_secureTruckData[ E_MAP_ICON ] );
g_secureTruckData[ E_MAP_ICON ] = 0xFFFF;
}
}
else
{
if ( GetPlayerPos( g_secureTruckDriver, fX, fY, fZ ) ) {
DestroyDynamicMapIcon( g_secureTruckData[ E_MAP_ICON ] ); // Should not look sketchy
g_secureTruckData[ E_MAP_ICON ] = CreateDynamicMapIcon( fX, fY, fZ, 52, 0, -1, -1, -1, 300.0 );
}
}
}
return 1;
}
hook OnNpcConnect( npcid )
{
static
npc_name[ MAX_PLAYER_NAME ];
GetPlayerName( npcid, npc_name, sizeof( npc_name ) );
if ( strmatch( npc_name, SECURE_TRUCK_DRIVER_NAME ) ) {
g_secureTruckDriver = npcid;
g_secureTruckData[ E_MAP_ICON ] = 0xFFFF;
SetPlayerColor( npcid, COLOR_SECURITY );
PutPlayerInVehicle( npcid, g_secureTruckVehicle, 0 );
return Y_HOOKS_BREAK_RETURN_1;
}
return Y_HOOKS_CONTINUE_RETURN_1;
}
hook OnNpcDisconnect( npcid, reason )
{
if ( g_secureTruckDriver == npcid )
{
restartSecurityGuardProcess( .inform_npc = false );
g_secureTruckDriver = INVALID_PLAYER_ID;
print( "Driver Crashed, Restablishing." );
ConnectNPC( SECURE_TRUCK_DRIVER_NAME, "secureguard" );
return Y_HOOKS_BREAK_RETURN_1;
}
return 1;
}
hook OnPlayerText( playerid, text[ ] )
{
if ( IsPlayerSecurityDriver( playerid ) )
{
if ( strmatch( text, "End Security Guard" ) )
{
restartSecurityGuardProcess( );
return Y_HOOKS_BREAK_RETURN_0;
}
return Y_HOOKS_BREAK_RETURN_1;
}
return 1;
}
hook OnPlayerDriveVehicle(playerid, vehicleid)
{
if ( IsPlayerConnected( g_secureTruckDriver ) && vehicleid == g_secureTruckVehicle ) {
SendError( playerid, "This vehicle cannot be accessed." );
SyncObject( playerid, 1 ); // Just sets the players position where the vehicle is.
return Y_HOOKS_BREAK_RETURN_1;
}
return 1;
}
hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
new Float: X, Float: Y, Float: Z, Float: Angle;
new player_vehicle = GetPlayerVehicleID( playerid );
if ( PRESSED( KEY_WALK ) )
{
if ( CanPlayerExitEntrance( playerid ) && player_vehicle )
{
new Float: fX, Float: fY;
UpdatePlayerEntranceExitTick( playerid );
GetVehiclePos( g_secureTruckVehicle, X, Y, Z );
GetVehicleZAngle( g_secureTruckVehicle, Angle );
fX = X + ( SECURE_TRUCK_DISTANCE * floatsin( -Angle + 180, degrees ) );
fY = Y + ( SECURE_TRUCK_DISTANCE * floatcos( -Angle + 180, degrees ) );
if ( IsPlayerInRangeOfPoint( playerid, SECURE_TRUCK_RADIUS, fX, fY, Z ) && p_Class[ playerid ] != CLASS_POLICE )
{
new
every_thing_shot = allSecurityOffsetsShot( );
if ( every_thing_shot && g_secureTruckData[ E_OPEN ] == true )
{
if ( IsSecurityDriverAFK( ) ) return 1;
if ( g_secureTruckData[ E_BEING_ROBBED ] ) return SendError( playerid, "This truck is currently being robbed." );
if ( g_secureTruckData[ E_ROBBED ] ) return SendError( playerid, "This truck has been robbed." );
SetPlayerFacePoint( playerid, X, Y );
//SetPlayerPos( playerid, fX, fY, Z );
g_secureTruckData[ E_BEING_ROBBED ] = true;
ApplyAnimation( playerid, "CARRY", "liftup105", 4.0, 1, 0, 0, 1, 0 );
ShowProgressBar( playerid, "Robbing Truck", PROGRESS_ROBTRUCK, 4000, COLOR_GOLD );
}
return Y_HOOKS_BREAK_RETURN_1;
}
}
}
return 1;
}
/* ** Commands ** */
CMD:chuffloc( playerid, params[ ] )
{
static
Float: X, Float: Y, Float: Z,
szCity[ MAX_ZONE_NAME ], szLocation[ MAX_ZONE_NAME ]
;
if ( IsSecurityDriverAFK( ) ) SendServerMessage( playerid, "ChuffSec is currently immobile and not making any deliveries at present." );
else
{
if ( GetPlayerPos( g_secureTruckDriver, X, Y, Z ) )
{
Get2DCity( szCity, X, Y, Z );
GetZoneFromCoordinates( szLocation, X, Y, Z );
SendServerMessage( playerid, "ChuffSec schedules show that the security truck is located near %s in %s.", szLocation, szCity );
}
else SendServerMessage( playerid, "ChuffSec is currently immobile and not making any deliveries at present." );
}
return 1;
}
/* ** Functions ** */
stock IsPlayerSecurityDriver( playerid ) {
new
npc_id = IsPlayerNPC( playerid );
if ( strmatch( ReturnPlayerName( playerid ), SECURE_TRUCK_DRIVER_NAME ) && !npc_id ) {
return 0;
}
return ( npc_id && playerid == g_secureTruckDriver );
}
stock IsVehicleSecurityVehicle( vehicleid )
{
return vehicleid == g_secureTruckVehicle;
}
stock restartSecurityGuardProcess( bool: inform_npc = true ) {
g_secureTruckData[ E_LOOT ] = 0;
g_secureTruckData[ E_ROBBED ] = false;
g_secureTruckData[ E_BEING_ROBBED ] = false;
g_secureTruckData[ E_OPEN ] = false;
DestroyDynamicMapIcon( g_secureTruckData[ E_MAP_ICON ] );
g_secureTruckData[ E_MAP_ICON ] = 0xFFFF;
for( new i = 0; i < sizeof( g_secureTruckOffsets ); i++ ) {
g_secureTruckOffsets[ i ] [ E_LEFT ] = false;
g_secureTruckOffsets[ i ] [ E_ENABLED ] = true;
g_secureTruckOffsets[ i ] [ E_HP ] = 100.0;
UpdateDynamic3DTextLabelText( g_secureTruckVehicleLabel[ i ], setAlpha( COLOR_GREY, 0x90 ), "100%" );
}
if ( inform_npc ) SendClientMessage( g_secureTruckDriver, 0x112233FF, "[0x03] 300 SECOND START." );
}
stock allSecurityOffsetsShot( ) {
for( new i = 0; i < sizeof( g_secureTruckOffsets ); i++ )
if ( g_secureTruckOffsets[ i ] [ E_ENABLED ] )
return 0;
return 1;
}
stock IsSecurityDriverAFK( ) { // Damn thing bugged with range of point
new
Float: Z;
return ( GetPlayerPos( g_secureTruckDriver, Z, Z, Z ) && Z > 1000.0 );
}

View File

@ -151,7 +151,6 @@ enum E_DONATION_DATA
/* ** Progress Bars ** */ /* ** Progress Bars ** */
#define PROGRESS_CRACKING 0 #define PROGRESS_CRACKING 0
#define PROGRESS_ROBTRUCK 2
#define PROGRESS_MINING 3 #define PROGRESS_MINING 3
#define PROGRESS_ROBBING 4 #define PROGRESS_ROBBING 4
#define PROGRESS_SAFEPICK 5 #define PROGRESS_SAFEPICK 5
@ -1361,39 +1360,6 @@ new
p_HighrollersBarrier [ MAX_PLAYERS ] [ 2 ] p_HighrollersBarrier [ MAX_PLAYERS ] [ 2 ]
; ;
/* ** Secure Truck Mod ** */
#define ENABLED_SECURE_TRUCK true
#define SECURE_TRUCK_DRIVER_NAME ( "ChuffSec" )
#define SECURE_TRUCK_DISTANCE ( 6.0 )
#define SECURE_TRUCK_RADIUS ( 4.0 )
#define COLOR_SECURITY 0xFF440500
#if ENABLED_SECURE_TRUCK == true
enum E_SECURE_OFFSET {
Float: E_X, Float: E_Y, Float: E_Z,
bool: E_LEFT, bool: E_ENABLED, Float: E_HP
};
enum E_SECURE_VEHICLE {
E_LOOT, bool: E_ROBBED, bool: E_OPEN,
bool: E_BEING_ROBBED, E_MAP_ICON
};
new
Float: g_secureTruckOffsets[ ] [ E_SECURE_OFFSET ] =
{
{ 0.6641840, -3.134811, -0.072469, false, true, 100.0 },
{ 0.6666250, -3.096450, 1.2469670, false, true, 100.0 },
{ -0.641235, -3.098449, 1.2477970, true , true, 100.0 },
{ -0.637695, -3.136108, -0.079330, true , true, 100.0 }
},
g_secureTruckData [ E_SECURE_VEHICLE ],
g_secureTruckDriver = INVALID_PLAYER_ID,
g_secureTruckVehicle = INVALID_VEHICLE_ID,
Text3D: g_secureTruckVehicleLabel [ sizeof( g_secureTruckOffsets ) ] = { Text3D: INVALID_3DTEXT_ID, ... }
;
#endif
/* ** Admin Ban Codes ** */ /* ** Admin Ban Codes ** */
enum E_BAN_CODE enum E_BAN_CODE
{ {
@ -2796,17 +2762,6 @@ public OnGameModeInit()
CreateWeedPlant( 2454.947, -1718.407, 13.5094, 0.0, 0.0, -21.49 ); CreateWeedPlant( 2454.947, -1718.407, 13.5094, 0.0, 0.0, -21.49 );
#endif #endif
/* ** Secure Truck Mod ** */
#if ENABLED_SECURE_TRUCK == true
g_secureTruckVehicle = AddStaticVehicle( 428, 2000.0, 2000.0, 2000.0, 180.0, -1, -1 );
for( new i = 0; i < sizeof( g_secureTruckOffsets ); i++ ) {
g_secureTruckVehicleLabel[ i ] = CreateDynamic3DTextLabel( "100%", setAlpha( COLOR_GREY, 0x90 ), g_secureTruckOffsets[ i ] [ E_X ], g_secureTruckOffsets[ i ] [ E_Y ], g_secureTruckOffsets[ i ] [ E_Z ], 25.0, INVALID_PLAYER_ID, g_secureTruckVehicle );
}
ConnectNPC( SECURE_TRUCK_DRIVER_NAME, "secureguard" );
#endif
/* ** Custom Vehicles ** */ /* ** Custom Vehicles ** */
g_TrolleyVehicles[ 0 ] = AddStaticVehicle( 457, -2511.7935, 760.5610, 34.8990, 90.6223, 123, 1 ); // trolley g_TrolleyVehicles[ 0 ] = AddStaticVehicle( 457, -2511.7935, 760.5610, 34.8990, 90.6223, 123, 1 ); // trolley
g_TrolleyVehicles[ 1 ] = AddStaticVehicle( 457, -2511.5742, 766.5329, 34.8990, 91.5108, 112, 1 ); // trolley g_TrolleyVehicles[ 1 ] = AddStaticVehicle( 457, -2511.5742, 766.5329, 34.8990, 91.5108, 112, 1 ); // trolley
@ -3790,27 +3745,6 @@ public OnServerUpdateTimer( )
} }
} }
#if ENABLED_SECURE_TRUCK == true
if ( IsPlayerConnected( g_secureTruckDriver ) )
{
if ( IsSecurityDriverAFK( ) )
{
if ( g_secureTruckData[ E_MAP_ICON ] != 0xFFFF ) {
SetVehicleParamsCarDoors( g_secureTruckVehicle, 0, 0, 0, 0 );
DestroyDynamicMapIcon( g_secureTruckData[ E_MAP_ICON ] );
g_secureTruckData[ E_MAP_ICON ] = 0xFFFF;
}
}
else
{
if ( GetPlayerPos( g_secureTruckDriver, fX, fY, fZ ) ) {
DestroyDynamicMapIcon( g_secureTruckData[ E_MAP_ICON ] ); // Should not look sketchy
g_secureTruckData[ E_MAP_ICON ] = CreateDynamicMapIcon( fX, fY, fZ, 52, 0, -1, -1, -1, 300.0 );
}
}
}
#endif
if ( IsPlayerInAnyVehicle( playerid ) ) if ( IsPlayerInAnyVehicle( playerid ) )
{ {
if ( iState == PLAYER_STATE_PASSENGER ) if ( iState == PLAYER_STATE_PASSENGER )
@ -4536,27 +4470,16 @@ thread OnPlayerDuplicateAccountCheck( playerid )
public OnNpcConnect( npcid ) public OnNpcConnect( npcid )
{ {
static static
npc_name[ MAX_PLAYER_NAME ], npc_ip[ 16 ]; npc_ip[ 16 ];
GetPlayerIp( npcid, npc_ip, sizeof( npc_ip ) ); GetPlayerIp( npcid, npc_ip, sizeof( npc_ip ) );
GetPlayerName( npcid, npc_name, sizeof( npc_name ) );
#if ENABLED_SECURE_TRUCK == true
if ( strmatch( npc_name, SECURE_TRUCK_DRIVER_NAME ) ) {
g_secureTruckDriver = npcid;
g_secureTruckData[ E_MAP_ICON ] = 0xFFFF;
SetPlayerColor( npcid, COLOR_SECURITY );
PutPlayerInVehicle( npcid, g_secureTruckVehicle, 0 );
return 1;
}
#endif
#if ENABLED_NPC_ROBBERIES == true #if ENABLED_NPC_ROBBERIES == true
if ( strmatch( npc_ip, "127.0.0.1" ) ) { if ( strmatch( npc_ip, "127.0.0.1" ) ) {
SetPlayerColor( npcid, 0xFFFFFF20 ); SetPlayerColor( npcid, 0xFFFFFF20 );
return 1; return 1;
} }
#endif #endif
print( "Kicked" );
return Kick( npcid ), 1; return Kick( npcid ), 1;
} }
@ -4785,16 +4708,6 @@ thread OnPlayerBanCheck( playerid )
}*/ }*/
public OnNpcDisconnect( npcid, reason ) public OnNpcDisconnect( npcid, reason )
{ {
#if ENABLED_SECURE_TRUCK == true
if ( g_secureTruckDriver == npcid )
{
restartSecurityGuardProcess( .inform_npc = false );
g_secureTruckDriver = INVALID_PLAYER_ID;
print( "Driver Crashed, Restablishing." );
ConnectNPC( SECURE_TRUCK_DRIVER_NAME, "secureguard" );
return 1;
}
#endif
return 1; return 1;
} }
@ -5402,7 +5315,7 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float:fX, Float:f
Damage = GetWeaponDamageFromDistance( weaponid, GetVehicleDistanceFromPoint( hitid, X, Y, Z ) ); Damage = GetWeaponDamageFromDistance( weaponid, GetVehicleDistanceFromPoint( hitid, X, Y, Z ) );
#if ENABLED_SECURE_TRUCK == true #if defined __cnr__chuffsec
// Secured Truck! // Secured Truck!
if ( g_secureTruckVehicle == hitid && GetPlayerSurfingVehicleID( playerid ) != g_secureTruckVehicle && IsPlayerConnected( g_secureTruckDriver ) && p_Class[ playerid ] != CLASS_POLICE ) if ( g_secureTruckVehicle == hitid && GetPlayerSurfingVehicleID( playerid ) != g_secureTruckVehicle && IsPlayerConnected( g_secureTruckDriver ) && p_Class[ playerid ] != CLASS_POLICE )
{ {
@ -6320,16 +6233,6 @@ public OnPlayerText( playerid, text[ ] )
new new
time = g_iTime; time = g_iTime;
#if ENABLED_SECURE_TRUCK == true
if ( IsPlayerSecurityDriver( playerid ) ) {
if ( strmatch( text, "End Security Guard" ) ) {
restartSecurityGuardProcess( );
return 0;
}
return 1;
}
#endif
if ( GetPlayerScore( playerid ) < 10 ) if ( GetPlayerScore( playerid ) < 10 )
return SendServerMessage( playerid, "You need at least 10 score to talk. "COL_GREY"Use /ask or /report to talk to an admin in the meanwhile." ), 0; return SendServerMessage( playerid, "You need at least 10 score to talk. "COL_GREY"Use /ask or /report to talk to an admin in the meanwhile." ), 0;
@ -6676,7 +6579,7 @@ public OnPlayerProgressUpdate( playerid, progressid, params )
if ( !IsPlayerInRangeOfPoint( playerid, 2.0, 2084.2842, 1234.0254, 414.7454 ) || !IsPlayerInMethlab( playerid ) || canceled ) if ( !IsPlayerInRangeOfPoint( playerid, 2.0, 2084.2842, 1234.0254, 414.7454 ) || !IsPlayerInMethlab( playerid ) || canceled )
return DeletePVar( playerid, "pouring_chemical" ), StopProgressBar( playerid ), 1; return DeletePVar( playerid, "pouring_chemical" ), StopProgressBar( playerid ), 1;
} }
#if ENABLED_SECURE_TRUCK == true #if defined __cnr__chuffsec
else if ( progressid == PROGRESS_ROBTRUCK ) else if ( progressid == PROGRESS_ROBTRUCK )
{ {
static Float: Angle; static Float: Angle;
@ -7010,7 +6913,7 @@ public OnProgressCompleted( playerid, progressid, params )
SendServerMessage( playerid, "You've yielded a pound of meth. Take your bags over to "COL_GREY"Cluckin' Bell"COL_WHITE" for exportation." ); SendServerMessage( playerid, "You've yielded a pound of meth. Take your bags over to "COL_GREY"Cluckin' Bell"COL_WHITE" for exportation." );
} }
} }
#if ENABLED_SECURE_TRUCK == true #if defined __cnr__chuffsec
case PROGRESS_ROBTRUCK: case PROGRESS_ROBTRUCK:
{ {
static Float: Angle; static Float: Angle;
@ -8091,31 +7994,6 @@ CMD:pl( playerid, params[ ] )
return 1; return 1;
} }
CMD:chuffloc( playerid, params[ ] )
{
#if ENABLED_SECURE_TRUCK == true
static
Float: X, Float: Y, Float: Z,
szCity[ MAX_ZONE_NAME ], szLocation[ MAX_ZONE_NAME ]
;
if ( IsSecurityDriverAFK( ) ) SendServerMessage( playerid, "ChuffSec is currently immobile and not making any deliveries at present." );
else
{
if ( GetPlayerPos( g_secureTruckDriver, X, Y, Z ) )
{
Get2DCity( szCity, X, Y, Z );
GetZoneFromCoordinates( szLocation, X, Y, Z );
SendServerMessage( playerid, "ChuffSec schedules show that the security truck is located near %s in %s.", szLocation, szCity );
}
else SendServerMessage( playerid, "ChuffSec is currently immobile and not making any deliveries at present." );
}
#else
SendServerMessage( playerid, "This feature is currently disabled." );
#endif
return 1;
}
CMD:deathmessage( playerid, params[ ] ) return cmd_deathmsg( playerid, params ); CMD:deathmessage( playerid, params[ ] ) return cmd_deathmsg( playerid, params );
CMD:deathmsg( playerid, params[ ] ) CMD:deathmsg( playerid, params[ ] )
{ {
@ -12044,7 +11922,7 @@ CMD:c4( playerid, params[ ] )
if ( IsPlayerInPaintBall( playerid ) || IsPlayerDueling( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an arena." ); if ( IsPlayerInPaintBall( playerid ) || IsPlayerDueling( playerid ) ) return SendError( playerid, "You cannot use this command since you're in an arena." );
if ( p_C4Amount[ playerid ] < 1 ) return SendError( playerid, "You don't have any C4's" ); if ( p_C4Amount[ playerid ] < 1 ) return SendError( playerid, "You don't have any C4's" );
#if ENABLED_SECURE_TRUCK == true #if defined __cnr__chuffsec
if ( IsPlayerInVehicle( playerid, g_secureTruckVehicle ) ) return SendError( playerid, "You cannot be in this vehicle while planting C4." ); if ( IsPlayerInVehicle( playerid, g_secureTruckVehicle ) ) return SendError( playerid, "You cannot be in this vehicle while planting C4." );
#endif #endif
@ -13151,7 +13029,7 @@ stock getVehicleSlotFromID( vID, &playerid=0, &slot=0 )
return -1; return -1;
} }
public OnPlayerDriveVehicle(playerid, vehicleid) public OnPlayerDriveVehicle( playerid, vehicleid )
{ {
new new
model = GetVehicleModel( vehicleid ), model = GetVehicleModel( vehicleid ),
@ -13167,14 +13045,6 @@ public OnPlayerDriveVehicle(playerid, vehicleid)
return 1; return 1;
} }
#if ENABLED_SECURE_TRUCK == true
if ( IsPlayerConnected( g_secureTruckDriver ) && vehicleid == g_secureTruckVehicle ) {
SendError( playerid, "This vehicle cannot be accessed." );
SyncObject( playerid, 1 ); // Just sets the players position where the vehicle is.
return 1;
}
#endif
if ( ! g_Driveby ) { if ( ! g_Driveby ) {
SetPlayerArmedWeapon( playerid, 0 ); SetPlayerArmedWeapon( playerid, 0 );
} }
@ -15111,33 +14981,6 @@ public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{ {
p_CheckpointEnterTick[ playerid ] = g_iTime + 2; p_CheckpointEnterTick[ playerid ] = g_iTime + 2;
#if ENABLED_SECURE_TRUCK == true
// Secured Truck!
new Float: fX, Float: fY;
GetVehiclePos( g_secureTruckVehicle, X, Y, Z );
GetVehicleZAngle( g_secureTruckVehicle, Angle );
fX = X + ( SECURE_TRUCK_DISTANCE * floatsin( -Angle + 180, degrees ) );
fY = Y + ( SECURE_TRUCK_DISTANCE * floatcos( -Angle + 180, degrees ) );
if ( IsPlayerInRangeOfPoint( playerid, SECURE_TRUCK_RADIUS, fX, fY, Z ) && p_Class[ playerid ] != CLASS_POLICE )
{
new
every_thing_shot = allSecurityOffsetsShot( );
if ( every_thing_shot && g_secureTruckData[ E_OPEN ] == true ) {
if ( IsSecurityDriverAFK( ) ) return 1;
if ( g_secureTruckData[ E_BEING_ROBBED ] ) return SendError( playerid, "This truck is currently being robbed." );
if ( g_secureTruckData[ E_ROBBED ] ) return SendError( playerid, "This truck has been robbed." );
SetPlayerFacePoint( playerid, X, Y );
//SetPlayerPos( playerid, fX, fY, Z );
g_secureTruckData[ E_BEING_ROBBED ] = true;
ApplyAnimation( playerid, "CARRY", "liftup105", 4.0, 1, 0, 0, 1, 0 );
ShowProgressBar( playerid, "Robbing Truck", PROGRESS_ROBTRUCK, 4000, COLOR_GOLD );
}
return 1;
}
#endif
return handlePlayerRobbery( playerid, newkeys, oldkeys ); return handlePlayerRobbery( playerid, newkeys, oldkeys );
} }
} }
@ -15309,16 +15152,6 @@ public OnPlayerUpdate( playerid )
SetPlayerAttachedObject( playerid, 1, 1210, 7, 0.302650, -0.002469, -0.193321, 296.124053, 270.396881, 8.941717, 1.000000, 1.000000, 1.000000 ); SetPlayerAttachedObject( playerid, 1, 1210, 7, 0.302650, -0.002469, -0.193321, 296.124053, 270.396881, 8.941717, 1.000000, 1.000000, 1.000000 );
} }
// Don't teleport with the car!
#if ENABLED_SECURE_TRUCK == true
if ( GetPlayerSurfingVehicleID( playerid ) == g_secureTruckVehicle || IsPlayerInVehicle( playerid, g_secureTruckVehicle ) ) {
if ( IsSecurityDriverAFK( ) ) {
CallLocalFunction( "SetPlayerRandomSpawn", "d", playerid );
SendServerMessage( playerid, "You seemed to fly away with the security guard. You've been teleported to a spawn." );
}
}
#endif
// FPS Counter // FPS Counter
iDrunkLevel = GetPlayerDrunkLevel( playerid ); iDrunkLevel = GetPlayerDrunkLevel( playerid );
if ( iDrunkLevel < 100 ) SetPlayerDrunkLevel( playerid, 2000 ); if ( iDrunkLevel < 100 ) SetPlayerDrunkLevel( playerid, 2000 );
@ -24701,60 +24534,6 @@ stock ShowPlayerShopMenu( playerid )
return ShowPlayerDialog( playerid, DIALOG_SHOP_MENU, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Shop Items", szString, "Select", "Cancel" ); return ShowPlayerDialog( playerid, DIALOG_SHOP_MENU, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Shop Items", szString, "Select", "Cancel" );
} }
stock IsPlayerSecurityDriver( playerid ) {
#if ENABLED_SECURE_TRUCK == true
new
npc_id = IsPlayerNPC( playerid );
if ( strmatch( ReturnPlayerName( playerid ), SECURE_TRUCK_DRIVER_NAME ) && !npc_id ) {
return 0;
}
return ( npc_id && playerid == g_secureTruckDriver );
#else
#pragma unused playerid
return 0;
#endif
}
stock IsVehicleSecurityVehicle( vehicleid )
{
#if ENABLED_SECURE_TRUCK == true
return vehicleid == g_secureTruckVehicle;
#else
#pragma unused vehicleid
return 0;
#endif
}
#if ENABLED_SECURE_TRUCK == true
stock restartSecurityGuardProcess( bool: inform_npc = true ) {
g_secureTruckData[ E_LOOT ] = 0;
g_secureTruckData[ E_ROBBED ] = false;
g_secureTruckData[ E_BEING_ROBBED ] = false;
g_secureTruckData[ E_OPEN ] = false;
DestroyDynamicMapIcon( g_secureTruckData[ E_MAP_ICON ] );
g_secureTruckData[ E_MAP_ICON ] = 0xFFFF;
for( new i = 0; i < sizeof( g_secureTruckOffsets ); i++ ) {
g_secureTruckOffsets[ i ] [ E_LEFT ] = false;
g_secureTruckOffsets[ i ] [ E_ENABLED ] = true;
g_secureTruckOffsets[ i ] [ E_HP ] = 100.0;
UpdateDynamic3DTextLabelText( g_secureTruckVehicleLabel[ i ], setAlpha( COLOR_GREY, 0x90 ), "100%" );
}
if ( inform_npc ) SendClientMessage( g_secureTruckDriver, 0x112233FF, "[0x03] 300 SECOND START." );
}
stock allSecurityOffsetsShot( ) {
for( new i = 0; i < sizeof( g_secureTruckOffsets ); i++ )
if ( g_secureTruckOffsets[ i ] [ E_ENABLED ] )
return 0;
return 1;
}
#endif
stock KillEveryoneInShamal( vehicleid ) stock KillEveryoneInShamal( vehicleid )
{ {
static static
@ -25628,17 +25407,6 @@ stock GetVehicleDriver( vehicleid )
return INVALID_PLAYER_ID; return INVALID_PLAYER_ID;
} }
stock IsSecurityDriverAFK( ) { // Damn thing bugged with range of point
new
Float: Z;
#if ENABLED_SECURE_TRUCK == true
return ( GetPlayerPos( g_secureTruckDriver, Z, Z, Z ) && Z > 1000.0 );
#else
return 1;
#endif
}
/*stock CreateNoDeathmatchZone( const Float: fRadius, const Float: fX, const Float: fY, const fSize = 15 ) // Warning: do not change size! /*stock CreateNoDeathmatchZone( const Float: fRadius, const Float: fX, const Float: fY, const fSize = 15 ) // Warning: do not change size!
{ {
new new

View File

@ -1,2 +1,3 @@
(+) Adds "/p" to be able to chat inside the paintball lobby (+) Adds "/p" to be able to chat inside the paintball lobby
(+) Adds "/b production" to see what the status of your business production is. (+) Adds "/b production" to see what the status of your business production is.
(+) Adds "/reconnectchuff" for level 5 administrators.