Raised This Month: $ Target: $400
 0% 

Kill Counter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 02-15-2022 , 10:54   Kill Counter
Reply With Quote #1

Hello, I would like to make a counter with my kills, but also that it counts every time a teammate dies

Currently it only counts every time I kill someone, and every time someone on the other team dies, and I would like it to only count my kills and when someone on my team dies

PHP Code:
new g_KillCount 0

//----------------------------------------------------------------------------------------------
public client_death(victimattacker)
{
    if ( 
victim == attacker ) return
    
    new 
CsTeams:attackerTeam cs_get_user_team(attacker)
    new 
CsTeams:victimTeam cs_get_user_team(victim)
    
    if ( 
is_user_alive(attacker) || victimTeam != attackerTeam ) {
        
g_KillCount g_KillCount 1
            client_print
(attackerprint_chatYou have %i kills.", g_KillCount)
    } 

Arje is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-15-2022 , 13:36   Re: Kill Counter
Reply With Quote #2

Then remove the part of the code that checks the team?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 02-15-2022 , 13:37   Re: Kill Counter
Reply With Quote #3

Take example:
PHP Code:
new g_iPlayerKillsMAX_PLAYERS ]

register_event"DeathMsg""OnPlayerKilled""a" )

public 
OnPlayerKilled( )
{
    new 
iAttacker read_data), iVictim read_data)
        
    if( 
is_user_connectediAttacker ) && iAttacker != iVictim )
    {
        
g_iPlayerKillsiAttacker ]++;
        
client_print_coloriAttackerprint_team_default"Your Kills: %i"g_iPlayerKillsiAttacker ] )
    }

__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 02-15-2022 at 13:41.
Supremache is offline
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 02-15-2022 , 17:15   Re: Kill Counter
Reply With Quote #4

I think I did not explain well.

I want that if I am tt(or ct) and kill one of the other team: g_KillCount + 1
I already achieved this, it's easy to do

but i want besides that, that when someone of my team dies, (for example if I am tt, if another tt dies) too: g_KillCount + 1

I don't know if I explain it better now, but I can try again, excuse me for my english.
Arje is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 02-15-2022 , 19:21   Re: Kill Counter
Reply With Quote #5

Quote:
Originally Posted by Arje View Post
I think I did not explain well.

I want that if I am tt(or ct) and kill one of the other team: g_KillCount + 1
I already achieved this, it's easy to do

but i want besides that, that when someone of my team dies, (for example if I am tt, if another tt dies) too: g_KillCount + 1

I don't know if I explain it better now, but I can try again, excuse me for my english.
Want to increase "g_KillCount" when you or someone on your team dies? If yes, then create a loop with get_players
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 02-15-2022 at 19:23.
Supremache is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-16-2022 , 07:16   Re: Kill Counter
Reply With Quote #6

Quote:
Originally Posted by Supremache View Post
Take example:
PHP Code:
new g_iPlayerKillsMAX_PLAYERS ]

register_event"DeathMsg""OnPlayerKilled""a" )

public 
OnPlayerKilled( )
{
    new 
iAttacker read_data), iVictim read_data)
        
    if( 
is_user_connectediAttacker ) && iAttacker != iVictim )
    {
        
g_iPlayerKillsiAttacker ]++;
        
client_print_coloriAttackerprint_team_default"Your Kills: %i"g_iPlayerKillsiAttacker ] )
    }

Don't hook DeathMsg to count the killer kills, hook the player killed post event and do the count, DeathMsg could be blocked by other various plugins.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 08:07.


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