From 2cb296835a9b436cf970142a9eb72da6382dfb7b Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Fri, 28 Sep 2018 09:24:49 +1000 Subject: [PATCH] remove redundant e_level from enumerator ... add /levels command for testing --- gamemodes/irresistible/cnr/experience.pwn | 25 ++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/gamemodes/irresistible/cnr/experience.pwn b/gamemodes/irresistible/cnr/experience.pwn index eb1536a..428ddd1 100644 --- a/gamemodes/irresistible/cnr/experience.pwn +++ b/gamemodes/irresistible/cnr/experience.pwn @@ -25,16 +25,16 @@ enum E_LEVELS { }; enum E_LEVEL_DATA { - E_LEVELS: E_LEVEL, Float: E_MAX_UNITS + E_NAME[ 16 ], Float: E_MAX_UNITS }; static const g_levelData[ ] [ E_LEVEL_DATA ] = { - // Level Requirement For Level 100 - { E_LAW_ENFORCEMENT, 25000.0 }, - { E_DEATHMATCH, 200000.0 }, - { E_ROBBERY, 100000.0 } + // Level Name Level 100 Req. + { "Law Enforcement", 25000.0 }, // 25K arrests + { "Robbery", 100000.0 }, // 100K robberies + { "Deathmatch", 200000.0 } // 200K kills } ; @@ -72,6 +72,21 @@ hook OnPlayerLogin( playerid ) return 1; } +/* ** Commands ** */ +CMD:level( playerid, params[ ] ) +{ + szLargeString = ""COL_GREY"Skill\t"COL_GREY"Current Level\t"COL_GREY"% To Next Level\n"; + + for ( new level_id; level_id < sizeof( g_levelData ); level_id ++ ) + { + new Float: current_rank = GetPlayerLevel( playerid, E_LEVELS: level_id ); + new Float: progress_to_next_level = floatfract( current_rank ) * 100.0; + + format( szLargeString, sizeof( szLargeString ), "%s%s Level\t%d\t%0.1f%\n", szLargeString, g_levelData[ level_id ] [ E_NAME ], current_rank, progress_to_next_level ); + } + return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Player Level", szLargeString, "Close", "" ); +} + /* ** Functions ** */ stock GivePlayerExperience( playerid, E_LEVELS: level, Float: experience = 1.0 ) {