using html tables | better theme

This commit is contained in:
Felix Geyer 2004-03-07 10:43:28 +00:00
parent cca7548abc
commit 96fc4ad39c

View File

@ -177,12 +177,25 @@ getHits(id,killer) {
} }
/* get top 15 */ /* get top 15 */
getTop15(){ getTop15() {
new pos=0, stats[8], body[8], name[32] new pos, stats[8], body[8], name[32]
#if !defined NO_STEAM #if !defined NO_STEAM
pos = format(g_Buffer,2047,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>") new state[4]
#endif pos = copy(g_Buffer,2047,"<html><head><body><style type=^"text/css^">")
pos += format(g_Buffer[pos],2047-pos," # %-28.27s %6s %6s %6s %6s %6s^n", pos += copy(g_Buffer[pos],2047-pos,"body{font-family:Arial,sans-serif;font-size:12px;color:#FFCC99;background-color:#000000;margin-left:8px;margin-top:3px}.header{background-color:#9C0000;}.one{background-color:#310000;}.two{background-color:#630000;}")
pos += copy(g_Buffer[pos],2047-pos,"</style></head><body><table><tr class=^"header^"><td>#</td><td>Nick</td><td>Kills</td><td>Deaths</td><td>Hits</td><td>Shots</td><td>HS</td></tr>")
new imax = get_statsnum()
if (imax > 15) imax = 15
for(new a = 0; a < imax; ++a){
if (equal(state,"one")) copy(state,3,"two")
else copy(state,3,"one")
get_stats(a,stats,body,name,31)
pos += format(g_Buffer[pos],2047-pos,"<tr class=^"%s^"><td>%d.</td><td>%s</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr>",state,a+1,name,stats[0],stats[1],stats[5],stats[4],stats[2])
}
copy(g_Buffer[pos],2047-pos,"</table></body></html>")
#else
pos = format(g_Buffer,2047," # %-28.27s %6s %6s %6s %6s %6s^n",
"nick", "kills" , "deaths" , "hits","shots","hs" ) "nick", "kills" , "deaths" , "hits","shots","hs" )
new imax = get_statsnum() new imax = get_statsnum()
if (imax > 15) imax = 15 if (imax > 15) imax = 15
@ -190,8 +203,6 @@ getTop15(){
get_stats(a,stats,body,name,31) get_stats(a,stats,body,name,31)
pos += format(g_Buffer[pos],2047-pos,"%2d. %-28.27s %6d %6d %6d %6d %6d^n",a+1,name,stats[0],stats[1],stats[5],stats[4],stats[2]) pos += format(g_Buffer[pos],2047-pos,"%2d. %-28.27s %6d %6d %6d %6d %6d^n",a+1,name,stats[0],stats[1],stats[5],stats[4],stats[2])
} }
#if !defined NO_STEAM
format(g_Buffer[pos],2047-pos,"</pre></body></html>")
#endif #endif
} }
@ -292,7 +303,7 @@ public eRoundEndTask() {
hs , (hs == 1) ? "": "s" ) hs , (hs == 1) ? "": "s" )
} }
} }
if ( EndMostDamage ){ if ( EndMostDamage ) {
new damage = 0, who = 0, hits = 0 new damage = 0, who = 0, hits = 0
for(new i = 0; i < pnum; ++i){ for(new i = 0; i < pnum; ++i){
get_user_rstats( players[i],stats, bodyhits ) get_user_rstats( players[i],stats, bodyhits )
@ -351,12 +362,27 @@ public cmdStatsMe(id){
} }
public displayStats(id,dest) { public displayStats(id,dest) {
new pos=0, name[32], stats[8], body[8] new pos, name[32], stats[8], body[8]
get_user_wstats(id,0,stats,body) get_user_wstats(id,0,stats,body)
#if !defined NO_STEAM #if !defined NO_STEAM
pos = format(g_Buffer,2047,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>") new state[4]
#endif pos = copy(g_Buffer,2047,"<html><head><body><style type=^"text/css^">")
pos += format(g_Buffer[pos],2047-pos,"%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n^n", pos += copy(g_Buffer[pos],2047-pos,"body{font-family:Arial,sans-serif;font-size:12px;color:#FFCC99;background-color:#000000;margin-left:8px;margin-top:3px}.header{background-color:#9C0000;}.one{background-color:#310000;}.two{background-color:#630000;}")
pos += format(g_Buffer[pos],2047-pos,"</style></head><body><table><tr class=^"one^"><td>Kills:</td><td>%d</td></tr><tr class=^"two^"><td>Deaths:</td><td>%d</td></tr><tr class=^"one^"><td>Damage:</td><td>%d</td></tr><tr class=^"two^"><td>Hits:</td><td>%d</td></tr><tr class=^"one^"><td>Shots:</td><td>%d</td></tr></table><br><br>",
stats[0],stats[1],stats[6],stats[5],stats[4])
pos += copy(g_Buffer[pos],2047-pos,"<table><tr class^"header^"><td>Weapon</td><td>Shots</td><td>Hits</td><td>Damage</td><td>Kills</td><td>deaths</td></tr>")
for(new a = 1; a < 31; ++a) {
if (get_user_wstats(id,a,stats,body)) {
if (equal(state,"one")) copy(state,3,"two")
else copy(state,3,"one")
get_weaponname(a,name,31)
pos += format(g_Buffer[pos],2047-pos,"<tr class=^"%s^"><td>%s</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr>",
name[7],stats[4],stats[5],stats[6],stats[0],stats[1])
}
}
copy(g_Buffer[pos],2047-pos,"</table></body></html>")
#else
pos = format(g_Buffer,2047,"%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n^n",
"Kills",stats[0],"Deaths",stats[1],"Damage",stats[6],"Hits",stats[5],"Shots",stats[4]) "Kills",stats[0],"Deaths",stats[1],"Damage",stats[6],"Hits",stats[5],"Shots",stats[4])
pos += format(g_Buffer[pos],2047-pos, "%-12.11s %6s %6s %6s %6s %6s^n", pos += format(g_Buffer[pos],2047-pos, "%-12.11s %6s %6s %6s %6s %6s^n",
"weapon","shots","hits","damage","kills","deaths") "weapon","shots","hits","damage","kills","deaths")
@ -367,10 +393,8 @@ public displayStats(id,dest) {
name[7],stats[4],stats[5],stats[6],stats[0],stats[1]) name[7],stats[4],stats[5],stats[6],stats[0],stats[1])
} }
} }
get_user_name(id,name,31)
#if !defined NO_STEAM
format(g_Buffer[pos],2047-pos,"</pre></body></html>")
#endif #endif
get_user_name(id,name,31)
show_motd(dest,g_Buffer,name) show_motd(dest,g_Buffer,name)
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }
@ -385,19 +409,25 @@ public cmdRank(id){
} }
displayRank(id,dest) { displayRank(id,dest) {
new pos=0, name[32], stats[8], body[8] new pos, name[32], stats[8], body[8]
new rank_pos = get_user_stats(id,stats,body) new rank_pos = get_user_stats(id,stats,body)
#if !defined NO_STEAM #if !defined NO_STEAM
pos = format(g_Buffer,2047,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>") pos = copy(g_Buffer,2047,"<html><head><body><style type=^"text/css^">")
#endif pos += copy(g_Buffer[pos],2047-pos,"body{font-family:Arial,sans-serif;font-size:12px;color:#FFCC99;background-color:#000000;margin-left:8px;margin-top:3px}.header{background-color:#9C0000;}.one{background-color:#310000;}.two{background-color:#630000;}")
pos += format(g_Buffer[pos],2047-pos,"%s rank is %d of %d^n^n",(id==dest)?"Your":"His", rank_pos,get_statsnum()) pos += format(g_Buffer[pos],2047-pos,"</style></head><body><table><tr><td colspan=2>%s rank is %d of %d</td></tr>",(id==dest)?"Your":"His", rank_pos,get_statsnum())
pos += format(g_Buffer[pos],2047-pos,"<tr class=^"one^"><td>Kills:</td><td>%d</td></tr><tr class=^"two^"><td>Deaths:</td><td>%d</td></tr><tr class=^"one^"><td>Damage:</td><td>%d</td></tr><tr class=^"two^"><td>Hits:</td><td>%d</td></tr><tr class=^"one^"><td>Shots:</td><td>%d</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr>",
stats[0],stats[1],stats[6],stats[5],stats[4])
pos += format(g_Buffer[pos],2047-pos,"<tr class=^"header^"><td colspan=2>Hits</td></tr><tr class^"one^"><td>%s:</td><td>%d</td></tr><tr class^"two^"><td>%s:</td><td>%d</td></tr><tr class^"one^"><td>%s:</td><td>%d</td></tr><tr class^"two^"><td>%s:</td><td>%d</td></tr><tr class^"one^"><td>%s:</td><td>%d</td></tr><tr class^"two^"><td>%s:</td><td>%d</td></tr><tr class^"one^"><td>%s:</td><td>%d</td></tr>",
g_bodyParts[1],body[1],g_bodyParts[2],body[2],g_bodyParts[3],body[3], g_bodyParts[4],body[4],
g_bodyParts[5],body[5],g_bodyParts[6],body[6],g_bodyParts[7],body[7])
copy(g_Buffer,2047,"</table></body></html>")
#else
pos = format(g_Buffer,2047,"%s rank is %d of %d^n^n",(id==dest)?"Your":"His", rank_pos,get_statsnum())
pos += format(g_Buffer[pos],2047-pos,"%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n^n", pos += format(g_Buffer[pos],2047-pos,"%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n^n",
"Kills",stats[0],"Deaths",stats[1],"Damage",stats[6],"Hits",stats[5],"Shots",stats[4]) "Kills",stats[0],"Deaths",stats[1],"Damage",stats[6],"Hits",stats[5],"Shots",stats[4])
pos += format(g_Buffer[pos],2047-pos,"%10s:^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d", pos += format(g_Buffer[pos],2047-pos,"%10s:^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d",
"Hits",g_bodyParts[1],body[1],g_bodyParts[2],body[2],g_bodyParts[3],body[3], g_bodyParts[4],body[4], "Hits",g_bodyParts[1],body[1],g_bodyParts[2],body[2],g_bodyParts[3],body[3], g_bodyParts[4],body[4],
g_bodyParts[5],body[5],g_bodyParts[6],body[6],g_bodyParts[7],body[7]) g_bodyParts[5],body[5],g_bodyParts[6],body[6],g_bodyParts[7],body[7])
#if !defined NO_STEAM
format(g_Buffer[pos],2047-pos,"</pre></body></html>")
#endif #endif
get_user_name(id,name,31) get_user_name(id,name,31)
show_motd(dest,g_Buffer,name) show_motd(dest,g_Buffer,name)
@ -485,4 +515,4 @@ showStatsMenu(id,pos){
else format(menu_body[len],511-len,"^n0. %s" , pos ? "Back" : "Exit" ) else format(menu_body[len],511-len,"^n0. %s" , pos ? "Back" : "Exit" )
show_menu(id,keys,menu_body) show_menu(id,keys,menu_body)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }