top15
zGraferz
02.06.2009
witam!
proszę o przerobieine tego pluginu, aby pokazywał rankstats oraz top15
proszę o przerobieine tego pluginu, aby pokazywał rankstats oraz top15
#include <amxmodx> #include <amxmisc> #include <csstats> #define PLUGIN "Rank Stats motd" #define VERSION "1.0" #define AUTHOR "Alka" public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("say /rank", "cmdShowRank"); } public cmdShowRank(id) { static stats[8], stats2[4], body[8] new rank_pos = get_user_stats(id, stats, body); new max_rank = get_statsnum(); get_user_stats2(id, stats2); static host_name[32]; get_cvar_string("hostname", host_name, 31); static motd[1501], len; len = format(motd, 1500,"<body bgcolor=#2C2C2C><font color=#158CD7><pre>"); len += format(motd[len], 1500-len,"<center><img src=^"http://img3.imagebanana.com/img/k88khrud/obrazek.png^"></center></img>"); len += format(motd[len], 1500-len,"<center><h4><font color=^"blue^"> Twoje Statystyki na'%s' </font></h4></center>", host_name); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">[b]Rank :[/b] <font color=^"white^">%d / %d</color></left>^n", rank_pos, max_rank); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">[b]Zabojstwa :[/b] <font color=^"white^"> %d</color></left>^n", stats[0]); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">[b]Zginiecia :[/b] <font color=^"white^"> %d</color></left>^n", stats[1]); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">[b]Head Shoty :[/b] <font color=^"white^"> %d</color></left>^n", stats[2]); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">[b]Obrazenia :[/b] <font color=^"white^"> %d</color></left>^n", stats[6]); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">[b]Strzaly :[/b] <font color=^"white^"> %d</color></left>^n", stats[4]); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">[b]Trafienia ;[/b] <font color=^"white^"> %d</color></left>^n", stats[5]); len += format(motd[len], 1500-len,"<left><font color=^"blue^">----------------------------------</color></left>^n"); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">Eff : <font color=^"white^"> %3.0f%%</color></left>^n", effec(stats)); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">Acc : <font color=^"white^"> %3.0f%%</color></left>^n", accuracy(stats)); len += format(motd[len], 1500-len,"<left><font color=^"blue^">----------------------------------</color></left>^n^n"); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">[b]Rozbrojone bomby :[/b] <font color=^"white^">%d </color></left>^n", stats2[1]); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">[b]Podlozone bomby :[/b] <font color=^"white^">%d </color></left>^n", stats2[2]); len += format(motd[len], 1500-len,"<left><font color=^"#158CD7^">[b]Wybuchy bomb :[/b] <font color=^"white^">%d </color></left>^n^n", stats2[3]); show_motd(id, motd, "You'r Rank"); return 0; } stock Float:accuracy(stats[8]) { if(!stats[4]) return ( 0.0 ); new Float:result result = 100.0 * float( stats[5] ) / float( stats[4] ); return (result > 100.0) ? 100.0 : result } stock Float:effec(stats[8]) { if(!stats[0]) return ( 0.0 ); new Float:result result = 100.0 * float( stats[0] ) / float( stats[0] + stats[1] ); return (result > 100.0) ? 100.0 : result }
R3X
02.06.2009
w statsx.sma znalazłem to:
#define MAX_BUFFER_LENGTH 2047 // User stats parms id #define STATS_KILLS 0 #define STATS_DEATHS 1 #define STATS_HS 2 #define STATS_TKS 3 #define STATS_SHOTS 4 #define STATS_HITS 5 #define STATS_DAMAGE 6 // Get and format top 15. format_top15(sBuffer[MAX_BUFFER_LENGTH + 1]) { new iMax = get_statsnum() new izStats[8], izBody[8] new iLen = 0 if (iMax > 15) iMax = 15 new lKills[16], lDeaths[16], lHits[16], lShots[16], lEff[16], lAcc[16] format(lKills, 15, "%L", LANG_SERVER, "KILLS") format(lDeaths, 15, "%L", LANG_SERVER, "DEATHS") format(lHits, 15, "%L", LANG_SERVER, "HITS") format(lShots, 15, "%L", LANG_SERVER, "SHOTS") format(lEff, 15, "%L", LANG_SERVER, "EFF") format(lAcc, 15, "%L", LANG_SERVER, "ACC") ucfirst(lEff) ucfirst(lAcc) iLen = format(sBuffer, MAX_BUFFER_LENGTH, "<body bgcolor=#000000><font color=#FFB000><pre>") iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2s %-22.22s %6s %6s %6s %6s %4s %4s %4s^n", "#", "Nick", lKills, lDeaths, lHits, lShots, "HS", lEff, lAcc) for (new i = 0; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++) { get_stats(i, izStats, izBody, t_sName, MAX_NAME_LENGTH) replace_all(t_sName, MAX_NAME_LENGTH, "<", "[") replace_all(t_sName, MAX_NAME_LENGTH, ">", "]") iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2d %-22.22s %6d %6d %6d %6d %4d %3.0f%% %3.0f%%^n", i + 1, t_sName, izStats[STATS_KILLS], izStats[STATS_DEATHS], izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_HS], effec(izStats), accuracy(izStats)) } }
R3X
02.06.2009
łap
Plugin w plugin_init() sformatuje motd top15 do globalnego stringa gBuffer[]
Plugin w plugin_init() sformatuje motd top15 do globalnego stringa gBuffer[]