From 06fd6b742b0af8881e780ad8cc11346e1f9af3d9 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Tue, 25 Sep 2018 13:32:36 +1000 Subject: [PATCH] fix /reconnectchuff --- .../irresistible/cnr/commands/admin/admin_five.pwn | 10 +++++++++- gamemodes/irresistible/cnr/features/chuffsec.pwn | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn index 315609e..d3b079c 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn @@ -528,7 +528,15 @@ CMD:reconnectchuff( playerid, params[ ] ) if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); - ConnectNPC( SECURE_TRUCK_DRIVER_NAME, "secureguard" ); + new + chuffsecid = GetSecurityDriverPlayer( ); + + if ( chuffsecid != INVALID_PLAYER_ID ) { + Kick( chuffsecid ); + } else { + 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; diff --git a/gamemodes/irresistible/cnr/features/chuffsec.pwn b/gamemodes/irresistible/cnr/features/chuffsec.pwn index cfa02b3..fa0a897 100644 --- a/gamemodes/irresistible/cnr/features/chuffsec.pwn +++ b/gamemodes/irresistible/cnr/features/chuffsec.pwn @@ -279,10 +279,14 @@ stock allSecurityOffsetsShot( ) { return 1; } - stock IsSecurityDriverAFK( ) { // Damn thing bugged with range of point new Float: Z; return ( GetPlayerPos( g_secureTruckDriver, Z, Z, Z ) && Z > 1000.0 ); } + +stock GetSecurityDriverPlayer( ) +{ + return IsPlayerConnected( g_secureTruckDriver ) && IsPlayerNPC( g_secureTruckDriver ) ? g_secureTruckDriver : INVALID_PLAYER_ID; +}