Raised This Month: $ Target: $400
 0% 

Frag counter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gal_17
Junior Member
Join Date: Jul 2012
Old 02-25-2014 , 09:48   Frag counter
Reply With Quote #1

Hi, can someone make fragcounter like this:

First number is how many kills, and second how many headshoots, tnx.
gal_17 is offline
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 02-25-2014 , 09:57   Re: Frag counter
Reply With Quote #2

This?

http://forums.alliedmods.net/showpos...87&postcount=2
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
5aloOod is offline
gal_17
Junior Member
Join Date: Jul 2012
Old 02-25-2014 , 18:06   Re: Frag counter
Reply With Quote #3

not this, this plugin shows only the number of kills above croshair, what i need is is number of kills and in brackets number of hs at the left of screen
gal_17 is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 02-26-2014 , 01:35   Re: Frag counter
Reply With Quote #4

try:
PHP Code:
#include <amxmodx>

new g_hs[33]

public 
plugin_init() 
{
    
register_plugin("Frag Counter""1.0""RateX")  
    
register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
    
set_task(1.0"show_stat"___"b")
}

public 
message_DeathMsg(msg_idmsg_destid)
{
    static 
hshotiAttackeriVictim
    
    iAttacker 
get_msg_arg_int(1)
    
iVictim get_msg_arg_int(2)
    
hshot get_msg_arg_int(3)
    
    if(!
is_user_connected(iAttacker) || iAttacker == iVictim)
        return 
PLUGIN_CONTINUE
    
    
if(hshot)
    {
        
g_hs[iAttacker]++
    }
    return 
PLUGIN_CONTINUE
}

public 
show_stat()
{
    for(new 
id=1id 33id++)
    {
        if(!
is_user_connected(id))
            continue
            
        new 
g_kill
        g_kill 
get_user_frags(id)
        
set_hudmessage(025500.050.3002.02.0)
        
show_hudmessage(id"Kill: %i(%i HS)"g_killg_hs[id])
    }


Last edited by RateX; 02-26-2014 at 01:36.
RateX is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 02-26-2014 , 02:09   Re: Frag counter
Reply With Quote #5

Quote:
Originally Posted by RateX View Post
try:
Looping through indexes like that is not a good way. Use get_players() and loop through the array of indexes.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
wTf.
Senior Member
Join Date: Aug 2011
Location: This important?
Old 02-26-2014 , 03:20   Re: Frag counter
Reply With Quote #6

@hornet

Yes, agree

PHP Code:
public show_stat()
{
    for(new 
id=1id 33id++)
    {
        if(!
is_user_connected(id))
            continue
            
        new 
g_kill
        g_kill 
get_user_frags(id)
        
set_hudmessage(025500.050.3002.02.0)
        
show_hudmessage(id"Kill: %i(%i HS)"g_killg_hs[id])
    }

->

PHP Code:
public show_stat()
{
    new 
players[32], inum
    
static id
    get_players
(players,inum)
    for(new 
i;i<inum;i++) {
        
id players[i]
        
        if(!
is_user_connected(id))
            continue
        
        new 
g_kill
        g_kill 
get_user_frags(id)
        
set_hudmessage(025500.050.3002.02.0)
        
show_hudmessage(id"Kill: %i(%i HS)"g_killg_hs[id])
    }


Last edited by wTf.; 02-26-2014 at 03:21.
wTf. is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 02-26-2014 , 04:04   Re: Frag counter
Reply With Quote #7

@wTf: why is the second method better?
RateX is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 02-26-2014 , 04:16   Re: Frag counter
Reply With Quote #8

@wTf get_players() will not get disconnected players, so you can remove the connected check now.
Also not sure why you've made id static.

@RateX it's better because it iterates only as many times as required as oppose to the method you posted which checks 32 times regardless of how many players are present.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
gal_17
Junior Member
Join Date: Jul 2012
Old 02-26-2014 , 05:50   Re: Frag counter
Reply With Quote #9

it works, but the counter is not restarted when new round come

Last edited by gal_17; 02-26-2014 at 06:14.
gal_17 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 06:03.


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