Raised This Month: $ Target: $400
 0% 

Checking for number of kills


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 06-14-2011 , 11:59   Checking for number of kills
Reply With Quote #1

So hey guys. I was wondering how could I check if a player has made 3 Kills with a knife?
dreamedward is offline
DjOptimuS
Senior Member
Join Date: Jan 2009
Old 06-14-2011 , 12:01   Re: Checking for number of kills
Reply With Quote #2

use an array with all players and count the knife kills
DjOptimuS is offline
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 06-14-2011 , 14:18   Re: Checking for number of kills
Reply With Quote #3

Could you give me a sample?
dreamedward is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-15-2011 , 03:22   Re: Checking for number of kills
Reply With Quote #4

Quote:
Originally Posted by dreamedward View Post
Could you give me a sample?
Code:
#include <amxmodx> #include <amxmisc> new KnifeKills[33] public plugin_init() {     register_plugin("KnifeCount" ,"0,1", " AUTHOR")     register_event("event_DeathMsg", "eventDeath", "a") } public eventDeath() {     new iAtkr = read_data(1)     static weapon[20]     read_data(4, weapon, charsmax(weapon))         if(weapon[iAtkr] == CSW_KNIFE)     {         KnifeKills[iAtkr] ++         if(KnifeKills[iAtkr] == 2)         {             //do your function         }     }     else     {         return PLUGIN_CONTINUE;     }     return PLUGIN_HANDLED; }
Something like this I believe he ment
Erox902 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-15-2011 , 03:33   Re: Checking for number of kills
Reply With Quote #5

Quote:
Originally Posted by Erox902 View Post
Code:
    static weapon[20]     read_data(4, weapon, charsmax(weapon))         if(weapon[iAtkr] == CSW_KNIFE)
Completely wrong.

weapon is a string containing the weapon name.
It is not an array that you would index by a player's index to get the weapon index.

You would need to check if the string is "knife".
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 06-15-2011 , 04:08   Re: Checking for number of kills
Reply With Quote #6

You could use get_weaponname ( id, weapon[], len ) too.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-15-2011 , 05:18   Re: Checking for number of kills
Reply With Quote #7

Quote:
Originally Posted by Exolent[jNr] View Post
Completely wrong.

weapon is a string containing the weapon name.
It is not an array that you would index by a player's index to get the weapon index.

You would need to check if the string is "knife".
so I could do if(contain(weapon, "knfe") then?
Erox902 is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-15-2011 , 17:28   Re: Checking for number of kills
Reply With Quote #8

Quote:
Originally Posted by dreamedward View Post
So this won't work?
nope
Quote:
Originally Posted by Exolent[jNr] View Post
Completely wrong.

weapon is a string containing the weapon name.
It is not an array that you would index by a player's index to get the weapon index.

You would need to check if the string is "knife".
ok so I did this and tested:
Code:
static weapon[20] read_data(4, weapon, charsmax(weapon)) if(equal(weapon, "knife"))

but tried to just send a client_print chat msg but it did'nt work :S

Last edited by Erox902; 06-15-2011 at 17:30.
Erox902 is offline
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 06-15-2011 , 16:29   Re: Checking for number of kills
Reply With Quote #9

Quote:
Originally Posted by Erox902 View Post
Code:
#include <amxmodx>
#include <amxmisc>

new KnifeKills[33]

public plugin_init()
{
    register_plugin("KnifeCount" ,"0,1", " AUTHOR")
    register_event("event_DeathMsg", "eventDeath", "a")
}

public eventDeath()
{
    new iAtkr = read_data(1)
    static weapon[20]
    read_data(4, weapon, charsmax(weapon))
    
    if(weapon[iAtkr] == CSW_KNIFE)
    {        KnifeKills[iAtkr] ++
        if(KnifeKills[iAtkr] == 2)
        {
            //do your function
        }
    }
    else
    {
        return PLUGIN_CONTINUE;
    }
    return PLUGIN_HANDLED;
}
Something like this I believe he ment
So this won't work?
dreamedward 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 23:24.


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