From 4ebaf037a002108bf2c66e112a63a397982bce67 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Fri, 5 Oct 2018 15:48:24 +0100 Subject: [PATCH] adds /turfs - showing all the current turfs and the gang who controls it --- gamemodes/sf-cnr.pwn | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index aa00bab..bafbb0d 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -9831,7 +9831,6 @@ thread readclans( playerid ) return 1; } - CMD:gangs( playerid, params[ ] ) { if ( !Iter_Count(gangs) ) @@ -9850,6 +9849,35 @@ CMD:gangs( playerid, params[ ] ) return ShowPlayerDialog( playerid, DIALOG_GANG_LIST, DIALOG_STYLE_TABLIST_HEADERS, "Gangs List", szHugeString, "Select", "Cancel" ); } +CMD:turfs( playerid, params[ ] ) +{ + if ( !Iter_Count( turfs ) ) + return SendError( playerid, "There is currently no trufs on the server." ); + + szHugeString[ 0 ] = '\0'; + + foreach( new turfid : turfs ) + { + new + szLocation[ MAX_ZONE_NAME ], Float: min_x, Float: min_y; + + Streamer_GetFloatData( STREAMER_TYPE_AREA, g_gangTurfData[ turfid ] [ E_AREA ], E_STREAMER_MIN_X, min_x ); + Streamer_GetFloatData( STREAMER_TYPE_AREA, g_gangTurfData[ turfid ] [ E_AREA ], E_STREAMER_MIN_Y, min_y ); + + GetZoneFromCoordinates( szLocation, min_x, min_y ); + + if ( g_gangTurfData[ turfid ][ E_OWNER ] == INVALID_GANG_ID ) { + format( szHugeString, sizeof( szHugeString ), "%s%s\t"COL_GREY"Unoccupied\n", szHugeString, szLocation ); + } + else { + format( szHugeString, sizeof( szHugeString ), "%s%s\t{%06x}%s\n", szHugeString, szLocation, g_gangTurfData[ turfid ][ E_COLOR ] >>> 8 , ReturnGangName( g_gangTurfData[ turfid ][ E_OWNER ] ) ); + } + } + + return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_TABLIST, ""COL_WHITE"Gang Turfs", szHugeString, "Close", "" ); +} + + CMD:gang( playerid, params[ ] ) { if ( p_Class[ playerid ] != CLASS_CIVILIAN ) return SendError( playerid, "This is restricted to civilians only." );