Raised This Month: $32 Target: $400
 8% 

Solved Frags Count


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
toki
Junior Member
Join Date: Feb 2021
Old 03-16-2021 , 12:42   Frags Count
Reply With Quote #1

Hi, I would like that in the part where it shows who you have killed you can count how many frags you have, for example:

"Player +1 💀 Player 2"
"Player +2 💀 Player 3"
"Player +3 💀 Player 4"

And when they kill you, reset the account to zero.

Last edited by toki; 03-23-2021 at 17:16.
toki is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 03-16-2021 , 13:38   Re: Kills count
Reply With Quote #2

Quote:
Originally Posted by toki View Post
Hi, I would like that in the part where it shows who you have killed you can count how many frags you have, for example:

"Player +1 💀 Player 2"
"Player +2 💀 Player 3"
"Player +3 💀 Player 4"

And when they kill you, reset the account to zero.
you mean how many frags he has over the killed player or overall? if it is over the players he killed, i like the idea like

PHP Code:
"PlayerA +5 💀 PlayerB"
"PlayerC +15 💀 PlayerD"
"PlayerE 💀 PlayerF +68" 
showing only the +frags player had in positive, so we dont take much of the characters of nicknames
tarsisd2 is offline
toki
Junior Member
Join Date: Feb 2021
Old 03-16-2021 , 14:04   Re: Kills count
Reply With Quote #3

Quote:
Originally Posted by tarsisd2 View Post
you mean how many frags he has over the killed player or overall? if it is over the players he killed, i like the idea like
The idea is that it be in general, but it would not be bad if there is also the option that you can remember the frags that you are doing to "X" player and if the "X" player kills you, your count will be returned to 0.
toki is offline
toki
Junior Member
Join Date: Feb 2021
Old 03-22-2021 , 01:26   Re: Kills count
Reply With Quote #4

Someone please help me with this request.
toki is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 03-22-2021 , 03:17   Re: Frags Count
Reply With Quote #5

Where do you want to show the counter tbh?
When they got kill? Above HP HUD? Right side? or you print in chat?
__________________
My plugin:
Celena Luna is offline
toki
Junior Member
Join Date: Feb 2021
Old 03-22-2021 , 13:18   Re: Recuento de frags
Reply With Quote #6

Quote:
Originally Posted by Celena Luna View Post
Where do you want to show the counter tbh?
When they got kill? Above HP HUD? Right side? or you print in chat?
Thank you for your response, just like the example in the picture (top right)

toki is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 03-22-2021 , 19:16   Re: Frags Count
Reply With Quote #7

Hello, can you try this to see if it works? I couldnt test it on my lan so its a little blind try
It should change name of killer to 'his_nick + his_frags_on_map' in the same moment as he kills someone, and after 0.1sec setting back his nickname to what he had while connection on your server:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new g_msgDeath, g_msgSay
new g_iFrags[ 33 ]
new g_szName[ 33 ][ 32 ], g_szWeapon[ 33 ][ 11 ]

public plugin_init()
{
    register_plugin( "DeathMSG Frags", "1.0", "amxx" )

    g_msgDeath = get_user_msgid( "DeathMsg" )
    g_msgSay =   get_user_msgid( "SayText" )
    register_message( g_msgDeath, "event_dmg" )
    register_message( g_msgSay, "event_saytxt" ) //prevent chat spam of changing nicks
}
public client_putinserver( id )
{
    g_iFrags[ id ] = 0
    g_szWeapon[ id ][ 0 ] = EOS
    get_user_name( id, g_szName[ id ], charsmax( g_szName ) )
}
public event_saytxt( msg_id, msg_dest, msg_entity )
{
    new arg[ 32 ]
    get_msg_arg_string( 2, arg, charsmax( arg ) )

    if( equal( arg, "#Cstrike_Name_Change" ) ) 
        return PLUGIN_HANDLED //prevent chat spam of changing nicks

    return PLUGIN_CONTINUE
}
public event_dmg()
{
    new data[ 4 ]
    data[ 0 ] = get_msg_arg_int( 1 ) //credits to Bugsy
    data[ 1 ] = get_msg_arg_int( 2 )
    data[ 2 ] = get_msg_arg_int( 3 )
    get_msg_arg_string( 4 , g_szWeapon[ data[ 0 ] ], charsmax( g_szWeapon[] ) ) //not so smart part here, but i think it will work properly with set_task

    if( data[ 0 ] == data[ 1 ] )
        return PLUGIN_CONTINUE //do nothing if its suicide..

    g_iFrags[ data[ 0 ] ]++
    static name2[ 32 ]
    formatex( name2, charsmax( name2 ), "%s + %d", g_szName[ data[ 0 ] ], g_iFrags[ data[ 0 ] ] )
    set_user_info( data[ 0 ], "name", name2 )

    set_task( 0.1, "send_info", 0, data, sizeof data )
    return PLUGIN_HANDLED
}
public send_info( data[] )
{
    message_begin( MSG_ALL, g_msgDeath )
    write_byte( data[ 0 ] )
    write_byte( data[ 1 ] )
    write_byte( data[ 2 ] )
    write_string( g_szWeapon[ data[ 0 ] ] )
    message_end()

    set_user_info( data[ 0 ], "name", g_szName[ data[ 0 ] ] )
}
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 03-22-2021 at 19:24.
JocAnis is offline
toki
Junior Member
Join Date: Feb 2021
Old 03-23-2021 , 02:01   Re: Frags Count
Reply With Quote #8

Quote:
Originally Posted by JocAnis View Post
Hello, can you try this to see if it works? I couldnt test it on my lan so its a little blind try
It should change name of killer to 'his_nick + his_frags_on_map' in the same moment as he kills someone, and after 0.1sec setting back his nickname to what he had while connection on your server:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new g_msgDeath, g_msgSay
new g_iFrags[ 33 ]
new g_szName[ 33 ][ 32 ], g_szWeapon[ 33 ][ 11 ]

public plugin_init()
{
    register_plugin( "DeathMSG Frags", "1.0", "amxx" )

    g_msgDeath = get_user_msgid( "DeathMsg" )
    g_msgSay =   get_user_msgid( "SayText" )
    register_message( g_msgDeath, "event_dmg" )
    register_message( g_msgSay, "event_saytxt" ) //prevent chat spam of changing nicks
}
public client_putinserver( id )
{
    g_iFrags[ id ] = 0
    g_szWeapon[ id ][ 0 ] = EOS
    get_user_name( id, g_szName[ id ], charsmax( g_szName ) )
}
public event_saytxt( msg_id, msg_dest, msg_entity )
{
    new arg[ 32 ]
    get_msg_arg_string( 2, arg, charsmax( arg ) )

    if( equal( arg, "#Cstrike_Name_Change" ) ) 
        return PLUGIN_HANDLED //prevent chat spam of changing nicks

    return PLUGIN_CONTINUE
}
public event_dmg()
{
    new data[ 4 ]
    data[ 0 ] = get_msg_arg_int( 1 ) //credits to Bugsy
    data[ 1 ] = get_msg_arg_int( 2 )
    data[ 2 ] = get_msg_arg_int( 3 )
    get_msg_arg_string( 4 , g_szWeapon[ data[ 0 ] ], charsmax( g_szWeapon[] ) ) //not so smart part here, but i think it will work properly with set_task

    if( data[ 0 ] == data[ 1 ] )
        return PLUGIN_CONTINUE //do nothing if its suicide..

    g_iFrags[ data[ 0 ] ]++
    static name2[ 32 ]
    formatex( name2, charsmax( name2 ), "%s + %d", g_szName[ data[ 0 ] ], g_iFrags[ data[ 0 ] ] )
    set_user_info( data[ 0 ], "name", name2 )

    set_task( 0.1, "send_info", 0, data, sizeof data )
    return PLUGIN_HANDLED
}
public send_info( data[] )
{
    message_begin( MSG_ALL, g_msgDeath )
    write_byte( data[ 0 ] )
    write_byte( data[ 1 ] )
    write_byte( data[ 2 ] )
    write_string( g_szWeapon[ data[ 0 ] ] )
    message_end()

    set_user_info( data[ 0 ], "name", g_szName[ data[ 0 ] ] )
}
Shows the +1,+2,+3...

The only thing missing would be for the frag count to return to 0 at death, and it occurred to me that at the start of another round it would also return to 0.

Last edited by toki; 03-23-2021 at 02:31.
toki is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 03-23-2021 , 03:29   Re: Frags Count
Reply With Quote #9

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

new g_msgDeathg_msgSay
new g_iFrags33 ]
new 
g_szName33 ][ 32 ], g_szWeapon33 ][ 11 ]

public 
plugin_init()
{
    
register_plugin"DeathMSG Frags""1.0""amxx" )

    
g_msgDeath get_user_msgid"DeathMsg" )
    
g_msgSay =   get_user_msgid"SayText" )
    
register_messageg_msgDeath"event_dmg" )
    
register_messageg_msgSay"event_saytxt" //prevent chat spam of changing nicks
    
register_event("HLTV""event_new_round""a""1=0""2=0"

}
public 
client_putinserverid )
{
    
g_iFragsid ] = 0
    g_szWeapon
id ][ ] = EOS
    get_user_name
idg_szNameid ], charsmaxg_szName ) )
}
public 
event_saytxtmsg_idmsg_destmsg_entity )
{
    new 
arg32 ]
    
get_msg_arg_string2argcharsmaxarg ) )

    if( 
equalarg"#Cstrike_Name_Change" ) ) 
        return 
PLUGIN_HANDLED //prevent chat spam of changing nicks

    
return PLUGIN_CONTINUE
}
public 
event_dmg()
{
    new 
data]
    
data] = get_msg_arg_int//credits to Bugsy
    
data] = get_msg_arg_int)
    
data] = get_msg_arg_int)
    
get_msg_arg_stringg_szWeapondata] ], charsmaxg_szWeapon[] ) ) //not so smart part here, but i think it will work properly with set_task                       

    
if( data] == data] )
        return 
PLUGIN_CONTINUE //do nothing if its suicide..

    
g_iFragsdata] ]++
    
g_iFragsdata] ] = //Reset Victim kill streak
    
static name232 ]
    
formatexname2charsmaxname2 ), "%s + %d"g_szNamedata] ], g_iFragsdata] ] )
    
set_user_infodata], "name"name2 )

    
set_task0.1"send_info"0datasizeof data )
    return 
PLUGIN_HANDLED
}

public 
event_new_round()
{
    for(new 
i=0;get_maxplayers();i++)
        
g_iFrags[i] = 0
}

public 
send_infodata[] )
{
    
message_beginMSG_ALLg_msgDeath )
    
write_bytedata] )
    
write_bytedata] )
    
write_bytedata] )
    
write_stringg_szWeapondata] ] )
    
message_end()

    
set_user_infodata], "name"g_szNamedata] ] )

His code is OK already so I just add kill reset and new round reset
__________________
My plugin:

Last edited by Celena Luna; 03-23-2021 at 03:30. Reason: didn't use any Ham
Celena Luna is offline
toki
Junior Member
Join Date: Feb 2021
Old 03-23-2021 , 12:28   Re: Frags Count
Reply With Quote #10

Working thanks to both of you for helping me just a small detail, I was checking the console and when a user with "flags" makes a frag appears in console "[admin.amxx] Login:" and it makes a huge spam haha żis there a way to fix that tiny detail?
toki 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 00:11.


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