AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   MOTD questions (https://forums.alliedmods.net/showthread.php?t=106808)

bwin.reebok 10-18-2009 23:46

MOTD questions
 
how to hook kills,deaths,Headshot for each player, than it updates every round and print in MOTD:cry:

Hawk552 10-19-2009 09:27

Re: MOTD questions
 
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]++
    }



bwin.reebok 10-19-2009 10:22

Re: MOTD questions
 
Quote:

Originally Posted by Hawk552 (Post 966826)
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:o

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

Hawk552 10-19-2009 10:25

Re: MOTD questions
 
Quote:

Originally Posted by bwin.reebok (Post 966867)
id is missing in public EventHLTV() that i ve added it:o

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 (Post 966867)
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.

bwin.reebok 10-19-2009 10:26

Re: MOTD questions
 
Headshots,kills,and death is 0 all the time...y it is not updating

Hawk552 10-19-2009 10:26

Re: MOTD questions
 
Quote:

Originally Posted by bwin.reebok (Post 966872)
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.

bwin.reebok 10-19-2009 11:40

Re: MOTD questions
 
Quote:

Originally Posted by Hawk552 (Post 966874)
Because you didn't fix it properly. Grab my code again.


I ve Grab ur code again :mrgreen::mrgreen::mrgreen: 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:mrgreen::mrgreen::mrgreen::mrgreen:

bwin.reebok 10-19-2009 11:50

Re: MOTD questions
 
first u ve retun id and now u change to i :(

Hawk552 10-19-2009 12:10

Re: MOTD questions
 
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.

bwin.reebok 10-19-2009 12:16

Re: MOTD questions
 
register_clcmd( "say /kills", "CmdKills", "- shows stats screen" )

Argument type mismatch on line 21


All times are GMT -4. The time now is 17:38.

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