Raised This Month: $ Target: $400
 0% 

Checking for number of kills


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
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 #1

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 #2

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 #3

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

Devil259 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-15-2011 , 04:40   Re: Checking for number of kills
Reply With Quote #4

Quote:
Originally Posted by Devil259 View Post
You could use get_weaponname ( id, weapon[], len ) too.
That gets the weapon name for a given weapon index, not the player's id.
__________________
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 , 07:08   Re: Checking for number of kills
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
That gets the weapon name for a given weapon index, not the player's id.
Yes, sorry, I confuse.
__________________
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 #6

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
matsi
Thinkosaur
Join Date: Sep 2006
Old 06-15-2011 , 05:33   Re: Checking for number of kills
Reply With Quote #7

Use get_user_weapon( id )
matsi is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-15-2011 , 09:47   Re: Checking for number of kills
Reply With Quote #8

Quote:
Originally Posted by Erox902 View Post
so I could do if(contain(weapon, "knfe") then?
Just check if the string is equal.

Quote:
Originally Posted by matsi View Post
Won't work for grenade kills.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 06-15-2011 , 11:01   Re: Checking for number of kills
Reply With Quote #9

Quote:
Originally Posted by Exolent[jNr] View Post
Just check if the string is equal.



Won't work for grenade kills.
You're right, but what does this topic have to do with grenades? He asked for knife kills?
matsi is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-15-2011 , 14:10   Re: Checking for number of kills
Reply With Quote #10

Quote:
Originally Posted by matsi View Post
You're right, but what does this topic have to do with grenades? He asked for knife kills?
Well nothing but still better if he knows that from the beginning
Erox902 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