Raised This Month: $ Target: $400
 0% 

MOTD questions


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-19-2009 , 12:10   Re: MOTD questions
Reply With Quote #9

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

new gMaxPlayers

new gHeadshots[33]
new 
gUniqueID[33]

new 
pStats

#define SHOW_COMMAND (1<<0)
#define SHOW_ROUND (1<<1)

public plugin_init()
{
    
register_plugin"Stats MOTD""1.0""Hawk552" )

    
register_event"HLTV""EventHLTV""a""1=0""2=0" )
    
register_event"DeathMsg""EventDeathMsg""a" )

    
register_clcmd"say /kills""CmdKills""- shows stats screen" )

    
// Add up 1 for /kills and 2 for new round.
    
pStats register_cvar"amx_motd_stats""3" )

    
gMaxPlayers get_maxplayers()
}

public 
EventHLTV()
    if ( 
get_pcvar_numpStats ) & SHOW_ROUND )
        for ( new 
1<= gMaxPlayersi++ )
            if ( 
is_user_alive) )
                
ShowMOTD)

public 
EventDeathMsg()
{
    new 
attacker read_data)
    if ( 
<= attacker <= gMaxPlayers && read_data) )
    {
        new 
uniqueID get_user_useridattacker )
        if ( 
uniqueID != gUniqueID[attacker] )
        {
            
gHeadshots[attacker] = 0
            gUniqueID
[attacker] = uniqueID
        
}

        
gHeadshots[attacker]++
    }
}

public 
CmdKillsid )
{
    if ( 
get_pcvar_numpStats ) & SHOW_COMMAND )
    {
        
ShowMOTDid )
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}

ShowMOTDid )
{
    new 
len
    
static MOTD[4096], name[33]
    
get_user_nameidname32 )

    
len formatexMOTDcharsmaxMOTD ), "Name: %s"name )
    
len += formatexMOTD[len], charsmaxMOTD ) - len"Kills: %d<br>"get_user_fragsid ) )
    
len += formatexMOTD[len], charsmaxMOTD ) - len"Deaths: %d<br>"get_user_deathsid ) )
    
len += formatexMOTD[len], charsmaxMOTD ) - len"Headshots: %d"gHeadshots[id] )

    
show_motdidMOTD"Stats" )

Try that. Cvar:

amx_motd_stats: flags 1 & 2.
1 - allow /kills command
2 - show on round start

You can use one, both or neither. To use both, add them up. The default value is 3. Untested and uncompiled, again.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
 



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 17:38.


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