AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Double/Triple Kill with the same bullet (https://forums.alliedmods.net/showthread.php?t=163938)

sparkey 08-05-2011 11:51

Double/Triple Kill with the same bullet
 
How can i hook this event in a smart way? time would be one way but then it does not have to be the same bullet :)

Best regards

ConnorMcLeod 08-05-2011 13:41

Re: Double/Triple Kill with the same bullet
 
death gametime and death killer should be the same.

sparkey 08-05-2011 18:27

Re: Double/Triple Kill with the same bullet
 
Would you mind showing me and example?

Would i have to put the gametime in an array and pass it on to the next kill to compare?

Thanks for your answer.

xPaw 08-05-2011 18:53

Re: Double/Triple Kill with the same bullet
 
Something like this. You need to add counter yourself (for triple kills).
Code:
public EventDeathMsg( ) {     new iKiller = read_data( 1 );         if( !iKiller || iKiller == read_data( 2 ) )     {         return;     }         static iLastKiller, Float:flLastKill;         new Float:flGameTime = get_gametime( );         if( iLastKiller == iKiller && flGameTime == flLastKill )     {         // Double kill :)     }         flLastKill  = flGameTime;     iLastKiller = iKiller; }

sparkey 08-05-2011 18:57

Re: Double/Triple Kill with the same bullet
 
Thanks alot m8! :) Will try it out right away :)

sparkey 08-06-2011 00:30

Re: Double/Triple Kill with the same bullet
 
Have been troubleshooting this for a while now and just realized that the timestamp is not the same when it reaches the second death.

Code:

First Death: flGameTime 109.524772
Second Death: flGameTime 109.530891

Any ideas?

nikhilgupta345 08-06-2011 00:35

Re: Double/Triple Kill with the same bullet
 
Maybe cut down to a tenth of a second?

Or if you want, might be a lot less accurate, just same second?

Exolent[jNr] 08-06-2011 00:40

Re: Double/Triple Kill with the same bullet
 
Use a global variable to count player kills.
Reset this variable when a player shoots a bullet.
Increase the variable when player kills another player.
Check variable for double kill.

sparkey 08-06-2011 01:07

Re: Double/Triple Kill with the same bullet
 
Quote:

Originally Posted by Exolent[jNr] (Post 1526699)
Use a global variable to count player kills.
Reset this variable when a player shoots a bullet.
Increase the variable when player kills another player.
Check variable for double kill.

That sounds like a wonderful and easy solution!

What function or event is called when a player shoots a bullet?

Thanks for your answer!

avril-lavigne 08-06-2011 03:25

Re: Double/Triple Kill with the same bullet
 
you can check weapon
in event curWeapon
new weapon = get_user_weapon(id)
case CSW_DEAGLE : client_cmd(id,"say oops I have deagle")


some thing like that , also check buttons && IN_ATTACK

I have another questionn how to check If player killed some one with one bullet and then again the second with another bullet to give him reward * ( similar to awp kills - 1st and 2nd)

lets see I have AWP

PHP Code:

if (weapon == AWP) {

new 
iKiller read_data);
new  
iVictim read_data);

 if(
get_user_team(iVictim) != get_user_team(iKiller))  {

// got kill ..
but how to count 2  -3-4-5-6 kills in a rowto give him medal or something
do I need to store his result and do +

Ok I will use miscstats and put AWP condition there.


All times are GMT -4. The time now is 03:26.

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