Hello
, i need help , this plugin work's on my Jailbreak Server but it doesn't show the %hs , second is , if i put this plugin on my public server and write /rank , it doesn't appear on chat , can some one fix it pls?
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <csx>
#include <csstats>
#include <colorchat>
#define PLUGIN "User Stats"
#define VERSION "1.0"
#define AUTHOR "Sempz"
#define HEADSHOT_RATIO 0.50
new g_iHeadshots[33];
// this set's when the message will display again
#define advertisemystats 60.0
new pcvar_mystats
new const g_Tag[ ] = "^04[SMART TEAM PORTUGAL]^01";
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd( "say /rank", "FragsDeathsRatioMin" )
//ADVERTISE
pcvar_mystats = register_cvar("sv_advertise", "1");
if(get_cvar_num("sv_advertise") == 1)
{
set_task(advertisemystats, "advertise", _, _, _, "b")
}
}
public FragsDeathsRatioMin()
{
new nick[33]
new kId = read_data( 1 ); // Killer Index
new iHeadshot = read_data( 3 );
new stats[8], body[8]
new rank_pos = get_user_stats(kId, stats, body)
new rank_max = get_statsnum()
get_user_stats(kId, stats, body)
get_statsnum()
static Deaths = 0, Kills = 0, Float:Ratio = 0.0
Deaths = stats[1], Kills = stats[0], Ratio = Deaths == 0 ? (float(Kills)) : (float(Kills) / float(Deaths))
if ( iHeadshot )
g_iHeadshots[kId] += 1;
// Display message if headshots > HEADSHOT_RATIO
new iKills = get_user_frags( kId );
new Float:fRatio = float( g_iHeadshots[kId] ) / float( iKills );
if ( fRatio >= HEADSHOT_RATIO )
{
get_user_name(kId, nick, 32)
ColorChat(kId, NORMAL, "%s ^03%s^01 o teu ^04rank^01 e ^04%d^01 de ^04%d^01 com ^03%d^01 Frags ,^03%d^01 Mortes , KD: ^03%.2f^01 e ^03%0.0f%%^01 HS.", g_Tag, nick, rank_pos,rank_max, stats[0], stats[1], Ratio, fRatio * 100.0, "%%" );
}
}
//Advertise Connect
public client_putinserver(id)
{
if(get_pcvar_num(pcvar_mystats) == 1)
{
set_task(10.0, "connectmessage", id, _, _, "a", 1)
}
}
//this display the message after 10 seconds, you can edit this on line 111
public connectmessage(id)
{
if(is_user_connected(id))
{
new name[33]
get_user_name(id, name, 32)
ColorChat(id, NORMAL, "%s ^03%s^01 Se escreveres ^04/rank^01 tu ves as ^03Frags^01 , ^03Deaths^01 e ^03KD^01.", g_Tag , name)
}
}