Raised This Month: $51 Target: $400
 12% 

add command client in plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BackStats
Senior Member
Join Date: Oct 2008
Old 11-13-2010 , 06:54   add command client in plugin
Reply With Quote #1

I'm looking to make some changes in that code.
I want to do it with information that shows the format client_chat through a command /stats.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <csstats>

#define HUD_INTERVAL 1.0

new msgtext 

public plugin_init() 
{
    
register_plugin("Stats Display","1.3","Kensai")
    
    
register_cvar("amx_display","1")
    
msgtext get_user_msgid("StatusText"
}

public 
client_putinserver(id)
{    
    if(
get_cvar_num("amx_display") == 0)
    return 
PLUGIN_HANDLED
    
    set_task
(HUD_INTERVAL,"ShowHUD",id)
    return 
PLUGIN_CONTINUE
}

public 
ShowHUD(id)     
{  
    if(
get_cvar_num("amx_display") == 0)
    return 
PLUGIN_HANDLED
    
    
if(!is_user_connected(id))
        return 
0;
    
    new 
stats[8]
    new 
hits[8]
    
get_user_stats(id,stats,hits)    
    
    new 
name[33]
    
get_user_name(id,name,32)
    
    new 
HUD[101
    
    
format(HUD100"%s [K: %i|D: %i|Hs: %i|KD Ratio: %i]",name,stats[0],stats[1],stats[2],stats[0]/stats[1])
    
message_begin(MSG_ONEmsgtext, {0,0,0}, id)  
    
write_byte(0)  
    
write_string(HUD)  
    
message_end()  
    
    
set_task(HUD_INTERVAL,"ShowHUD",id);
    
    return 
PLUGIN_CONTINUE

BackStats is offline
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 11-13-2010 , 11:41   Re: add command client in plugin
Reply With Quote #2

PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <csstats> 

#define HUD_INTERVAL 1.0 

new msgtext  

public plugin_init()  

    
register_plugin("Stats Display","1.3","Kensai"
     
    
register_cvar("amx_display","1"
    
msgtext get_user_msgid("StatusText")
    
register_clcmd("say /stats""ShowHud")


public 
client_putinserver(id
{     
    if(
get_cvar_num("amx_display") == 0
    return 
PLUGIN_HANDLED 
     
    set_task
(HUD_INTERVAL,"ShowHUD",id
    return 
PLUGIN_CONTINUE 


public 
ShowHUD(id)      
{   
    if(
get_cvar_num("amx_display") == 0
    return 
PLUGIN_HANDLED 
     
    
if(!is_user_connected(id)) 
        return 
0
     
    new 
stats[8
    new 
hits[8
    
get_user_stats(id,stats,hits)     
     
    new 
name[33
    
get_user_name(id,name,32
     
    new 
HUD[101]  
     
    
format(HUD100"%s [K: %i|D: %i|Hs: %i|KD Ratio: %i]",name,stats[0],stats[1],stats[2],stats[0]/stats[1]) 
    
message_begin(MSG_ONEmsgtext, {0,0,0}, id)   
    
write_byte(0)   
    
write_string(HUD)   
    
message_end()   
     
    
set_task(HUD_INTERVAL,"ShowHUD",id); 
     
    return 
PLUGIN_CONTINUE 

__________________
  • Project : Level Plugin
o [||||||||||] - 100%
  • Project : OnePieceMod
o [||||||||||] - 20%
SaM.ThE.MaN is offline
Reply



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 12:04.


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