AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check kills (https://forums.alliedmods.net/showthread.php?t=242947)

Freezo Begin 06-27-2014 09:06

Check kills
 
Hello Guys ! :) . i've made a plugin that shows top 3 Killers in every round with hud ( " i didn't test it " ) but I figured that the function of checking kills is useless knowing that the function that i have use is get_user_frags() !

Code:
public Hook_Death(){     new kill,vic,TopKills;         kill = read_data(1)     vic = read_data(2)     TopKills = get_user_frags(kill);         if (kill == vic){         return 1;     }     switch(TopKills)     {         case 0..2: g_Kills[kill] += 1             case 3..5: g_Kills[kill] += 2             case 6..10: g_Kills[kill] += 3         }     return 0; }

SpeeDeeR 06-27-2014 09:30

Re: Check kills
 
So what is your question/problem?

Freezo Begin 06-27-2014 10:23

Re: Check kills
 
If you read the description you will understand !!
Again . i want a function to check kill . Read the description please :) !

Flick3rR 06-27-2014 10:31

Re: Check kills
 
What I understand is that you want to loop trough all players and get the three first players with most kills. Like a top 3?

Freezo Begin 06-27-2014 10:35

Re: Check kills
 
Exactly !! i've made it the top 3 and its ranking by frags . so i need to get rank by kills every round !

SpeeDeeR 06-27-2014 12:36

Re: Check kills
 
Gather the kills in a playerkilled type event/forward in an array and on round end sort the array, get your first/last three entries(depending on your sort algorithm) and then set the array to 0.

Freezo Begin 06-27-2014 13:40

Re: Check kills
 
Well . Thank's SpeeDer ! i have try this
Code:
public Hook_Death(){     new kill,vic,TopKills;         kill = read_data(1)     vic = read_data(2)         if (kill != vic){         TopKills += 1;     }         switch(TopKills)     {         case 0..2: g_Kills[kill] += 1             case 3..5: g_Kills[kill] += 2             case 6..10: g_Kills[kill] += 3         }     return 0; }
and my question is TopKills += 1 . is it like TopKills++ ?

HamletEagle 06-27-2014 13:51

Re: Check kills
 
Quote:

Originally Posted by Freezo Begin (Post 2158270)
Well . Thank's SpeeDer ! i have try this
Code:
public Hook_Death(){     new kill,vic,TopKills;         kill = read_data(1)     vic = read_data(2)         if (kill != vic){         TopKills += 1;     }         switch(TopKills)     {         case 0..2: g_Kills[kill] += 1             case 3..5: g_Kills[kill] += 2             case 6..10: g_Kills[kill] += 3         }     return 0; }
and my question is TopKills += 1 . is it like TopKills++ ?

var ++ is the same as var += 1. It will add 1 to the actual value of the variable.

Freezo Begin 06-27-2014 13:54

Re: Check kills
 
Oké ! thanks for your fast reply !


All times are GMT -4. The time now is 21:09.

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