Raised This Month: $ Target: $400
 0% 

MOTD questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bwin.reebok
BANNED
Join Date: Oct 2009
Location: Land(IND)
Old 10-18-2009 , 23:46   MOTD questions
Reply With Quote #1

how to hook kills,deaths,Headshot for each player, than it updates every round and print in MOTD
bwin.reebok is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-19-2009 , 09:27   Re: MOTD questions
Reply With Quote #2

Untested, uncompiled (the web compiler seems to be broken and also missing charsmax).

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

new gMaxPlayers

new gHeadshots[33]
new 
gUniqueID[33]

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

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

    
gMaxPlayers get_maxplayers()
}

public 
EventHLTV()
    for ( new 
1len<= gMaxPlayersi++ )
        if ( 
is_user_alive) )
        {
            static 
MOTD[4096]
            
len formatexMOTDcharsmaxMOTD ), "Kills: %d<br>"get_user_frags) )
            
len += formatexMOTD[len], charsmaxMOTD ) - len"Deaths: %d<br>"get_user_deaths) )
            
len += formatexMOTD[len], charsmaxMOTD ) - len"Headshots: %d"gHeadshots[i] )

            
show_motdiMOTD"Stats" )
        }

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]++
    }

__________________

Last edited by Hawk552; 10-19-2009 at 10:26.
Hawk552 is offline
Send a message via AIM to Hawk552
bwin.reebok
BANNED
Join Date: Oct 2009
Location: Land(IND)
Old 10-19-2009 , 10:22   Re: MOTD questions
Reply With Quote #3

Quote:
Originally Posted by Hawk552 View Post
Untested, uncompiled (the web compiler seems to be broken and also missing charsmax).

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

new gMaxPlayers

new gHeadshots[33]
new 
gUniqueID[33]

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

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

    
gMaxPlayers get_maxplayers()
}

public 
EventHLTV()
    for ( new 
1len<= gMaxPlayersi++ )
        if ( 
is_user_alive) )
        {
            static 
MOTD[4096]
            
len formatexMOTDcharsmaxMOTD ), "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_motdiMOTD"Stats" )
        }

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]++
    }


id is missing in public EventHLTV() that i ve added it

but when motd will appear..i also need name beside kills,headshots and death....and when it will appear can u make by adding that when clients type /kills than motd appear
bwin.reebok is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-19-2009 , 10:25   Re: MOTD questions
Reply With Quote #4

Quote:
Originally Posted by bwin.reebok View Post
id is missing in public EventHLTV() that i ve added it
HLTV is a global event. There is no id because it is not sent to an individual player. I have edited the script to replace id -> i.

Quote:
Originally Posted by bwin.reebok View Post
but when motd will appear..i also need name beside kills,headshots and death....and when it will appear can u make by adding that when clients type /kills than motd appear
Not only did you not state any of those things when you originally posted, but this is the scripting help section. You should come here only when you need help scripting something. I wrote this up because I figured that you just needed a base and that you could add to it yourself. I suggest that you take this to the "Suggestions / Requests" board.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
bwin.reebok
BANNED
Join Date: Oct 2009
Location: Land(IND)
Old 10-19-2009 , 10:26   Re: MOTD questions
Reply With Quote #5

Headshots,kills,and death is 0 all the time...y it is not updating
bwin.reebok is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-19-2009 , 10:26   Re: MOTD questions
Reply With Quote #6

Quote:
Originally Posted by bwin.reebok View Post
Headshots,kills,and death is 0 all the time...y it is not updating
Because you didn't fix it properly. Grab my code again.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
bwin.reebok
BANNED
Join Date: Oct 2009
Location: Land(IND)
Old 10-19-2009 , 11:40   Re: MOTD questions
Reply With Quote #7

Quote:
Originally Posted by Hawk552 View Post
Because you didn't fix it properly. Grab my code again.

I ve Grab ur code again working fyn....
Thanks dude
+karma for u .....
can u just hook player name and it appear only whn clients type /kills
please....

and also i want all players states visible plz if u can
bwin.reebok is offline
bwin.reebok
BANNED
Join Date: Oct 2009
Location: Land(IND)
Old 10-19-2009 , 11:50   Re: MOTD questions
Reply With Quote #8

first u ve retun id and now u change to i
bwin.reebok is offline
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
bwin.reebok
BANNED
Join Date: Oct 2009
Location: Land(IND)
Old 10-19-2009 , 12:16   Re: MOTD questions
Reply With Quote #10

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

Argument type mismatch on line 21
bwin.reebok 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 17:38.


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