#include <amxmodx>
#include <csx>

public plugin_init()
	register_plugin("Info Hud I Rangi CsGo", "1.0", "ProToTyp")

public client_putinserver(id)
	set_task(1.0, "pokaz_hud", id,_,_,"b");

public client_disconnect(id)
	remove_task(id)

public pokaz_hud(id)
{
	if(!is_user_connected(id)) return;
	
	static name[33], szData[10], ranga[30], pos;
	get_user_name(id, name, charsmax(name));
	get_time( "%X", szData, charsmax(szData));
	
	pos = rank(id, ranga);

	set_hudmessage(0, 130, 150, 0.02, 0.17, 0, 6.0, 1.1, 0.0, 0.0, -1)
	show_hudmessage(id, ">> Forum: NazwaForum.pl^n>> Nick: %s^n>> Fragi: %i^n>> Ranking: %i^n>> Ranga: %s^n>> Czas Mapy: %i^n>> Aktualna Godzina: %s",
	name, get_user_frags(id), pos, ranga, (get_timeleft()/60), szData)
}


public rank(id, ranga[])
{
    static stats[8], body[8], pos;
    pos = get_user_stats(id, stats, body)
   
    if ( stats[0] >= 0 && stats[0] <= 29)
        formatex(ranga,29,"Silver I")
    else if ( stats[0] >= 30 && stats[0] <= 59)
        formatex(ranga,29,"Silver II")
    else if ( stats[0] >= 60 && stats[0] <= 119)
        formatex(ranga,29,"Silver III")
    else if ( stats[0] >= 120 && stats[0] <= 209)
        formatex(ranga,29,"Silver IV")
    else if ( stats[0] >= 210 && stats[0] <= 324)
        formatex(ranga,29,"Silver Elite")
    else if ( stats[0] >= 325 && stats[0] <= 499)
        formatex(ranga,29,"Silver Elite Master")
    else if ( stats[0] >= 500 && stats[0] <= 729)
        formatex(ranga,29,"Gold Nova I")
    else if ( stats[0] >= 730 && stats[0] <= 999)
        formatex(ranga,29,"Gold Nova II")
    else if ( stats[0] >= 100 && stats[0] <= 1399)
        formatex(ranga,29,"Gold Nova III")
    else if ( stats[0] >= 1400 && stats[0] <= 1849)
        formatex(ranga,29,"Gold Nova IV")
    else if ( stats[0] >= 1850 && stats[0] <= 2299)
        formatex(ranga,29,"Gold Nova Master")
    else if ( stats[0] >= 2300 && stats[0] <= 2899)
        formatex(ranga,29,"Master Guardian I")
    else if ( stats[0] >= 2900 && stats[0] <= 3549)
        formatex(ranga,29,"Master Guardian II")
    else if ( stats[0] >= 4200 && stats[0] <= 4999)
        formatex(ranga,29,"Master Guardian Elite")
    else if ( stats[0] >= 5000 && stats[0] <= 5899)
        formatex(ranga,29,"Distinguished Master Guardian")
    else if ( stats[0] >= 5900 && stats[0] <= 6899)
        formatex(ranga,29,"Legendary Eagle")
    else if ( stats[0] >= 6900 && stats[0] <= 7999)
        formatex(ranga,29,"Legendary Eagle Master")
    else if ( stats[0] >= 8000 && stats[0] <= 9299)
        formatex(ranga,29,"Supreme Master First Class")
    else if ( stats[0] >= 9300 && stats[0] <= 12000)
        formatex(ranga,29,"The Global Elite")
	
	return pos;
}
