From a3be94a4b868af21982882e2caaa50b2cbd05942 Mon Sep 17 00:00:00 2001 From: Dusan Date: Fri, 31 May 2019 10:36:46 +0200 Subject: [PATCH] Fixed turf bug --- .../irresistible/cnr/features/gangs/turfs.pwn | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/gangs/turfs.pwn b/gamemodes/irresistible/cnr/features/gangs/turfs.pwn index ed33b22..aaeebc1 100644 --- a/gamemodes/irresistible/cnr/features/gangs/turfs.pwn +++ b/gamemodes/irresistible/cnr/features/gangs/turfs.pwn @@ -285,14 +285,7 @@ hook OnPlayerEnterDynArea( playerid, areaid ) new first_turf = Turf_GetFirstTurf( playerid ); - if ( ! IsPlayerMovieMode( playerid ) ) - { - if ( first_turf == INVALID_GANG_TURF ) - return PlayerTextDrawSetString( playerid, g_ZoneOwnerTD[ playerid ], "_" ); - - // if ( p_GangID[ playerid ] != INVALID_GANG_ID && g_gangTurfData[ first_turf ] [ E_OWNER ] == INVALID_GANG_ID ) ShowPlayerHelpDialog( playerid, 2000, "You can take over this turf by typing ~g~/takeover" ); - PlayerTextDrawSetString( playerid, g_ZoneOwnerTD[ playerid ], sprintf( "~r~~h~(%s)~n~~w~~h~%s", g_gangTurfData[ first_turf ] [ E_FACILITY_GANG ] != INVALID_GANG_ID ? ( "FACILITY" ) : ( "TERRITORY" ), ReturnGangName( g_gangTurfData[ first_turf ] [ E_OWNER ] ) ) ); - } + CallLocalFunction( "OnPlayerUpdateGangZone", "dd", playerid, first_turf ); } return Y_HOOKS_CONTINUE_RETURN_1; } @@ -346,6 +339,21 @@ hook OnPlayerLeaveDynArea( playerid, areaid ) return Y_HOOKS_CONTINUE_RETURN_1; } +public OnPlayerUpdateGangZone( playerid, zoneid ) +{ + if ( ! IsPlayerMovieMode( playerid ) ) + { + if ( zoneid == INVALID_GANG_TURF ) + return PlayerTextDrawSetString( playerid, g_ZoneOwnerTD[ playerid ], "_" ); + + if ( p_GangID[ playerid ] != INVALID_GANG_ID && g_gangTurfData[ zoneid ] [ E_OWNER ] == INVALID_GANG_ID ) + ShowPlayerHelpDialog( playerid, 6000, "You can take over this turf by typing ~g~/takeover" ); + + PlayerTextDrawSetString( playerid, g_ZoneOwnerTD[ playerid ], sprintf( "~r~~h~(%s)~n~~w~~h~%s", g_gangTurfData[ zoneid ] [ E_FACILITY_GANG ] != INVALID_GANG_ID ? ( "FACILITY" ) : ( "TERRITORY" ), g_gangTurfData[ zoneid ] [ E_OWNER ] == -1 ? ( "Uncaptured" ) : ( ReturnGangName( g_gangTurfData[ zoneid ] [ E_OWNER ] ) ) ) ); + } + return 1; +} + /* ** Commands ** */ CMD:takeover( playerid, params[ ] ) {