Raised This Month: $ Target: $400
 0% 

Help Plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-20-2016 , 19:25   Re: Help Plugin
Reply With Quote #2

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(id) 
{ 
    new nick[33] 
    new iHeadshot = read_data( 3 ); 
    new stats[8], body[8] 
    new rank_pos = get_user_stats(id, stats, body) 
    new rank_max = get_statsnum() 
     
    get_user_stats(id, 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[id] += 1; 
     
    // Display message if headshots > HEADSHOT_RATIO 
     
    new iKills = get_user_frags( id ); 
    new Float:fRatio = float( g_iHeadshots[id] ) / float( iKills ); 
     
    if ( fRatio >= HEADSHOT_RATIO ) 
    { 
        get_user_name(id, nick, 32) 
        ColorChat(id, 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) 
    } 
}
EFFx is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode