Raised This Month: $51 Target: $400
 12% 

Get the player with the most frags being made


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Al3
Member
Join Date: Sep 2015
Location: Bulgaria
Old 09-28-2015 , 14:18   Get the player with the most frags being made
Reply With Quote #1

PHP Code:
get_leaders (&team1, &team2)
{
    new 
team1Frags 0team1ID 0;
    new 
team2Frags 0team2ID 0;
    
    for(new 
1<= 32i++)
    {
        new 
iFrags=        get_user_frags        (i);
        new 
CsTeams:iTeam=    cs_get_user_team    (i)
        
        if(
iFrags team1Frags && iTeam == CS_TEAM_T)
        {
            
team1Frags iFrags;
            
team1ID i;
            continue;
        }
        if(
iFrags team2Frags && iTeam == CS_TEAM_CT)
        {
            
team2Frags iFrags;
            
team2ID i;
        }
    }
    
team1 team1ID;
    
team2 team2ID;

is that the only way I can get the index of the client with the highest score ?

Last edited by Al3; 09-28-2015 at 14:19.
Al3 is offline
Send a message via Skype™ to Al3
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 09-28-2015 , 14:48   Re: Get the player with the most frags being made
Reply With Quote #2

Why do you ask? If it works, why do you want another way?
redivcram is offline
Al3
Member
Join Date: Sep 2015
Location: Bulgaria
Old 09-28-2015 , 14:52   Re: Get the player with the most frags being made
Reply With Quote #3

Because that it works doesn't mean it is good in:
- quality
- readability
- performance
- value
- works independently (in all the cases)

And when you are coding a mod, I think you must especially emphasize on these things.
And in my case, suspiciously that's the right way to go..
Though I have trouble figuring out another way.

Last edited by Al3; 09-28-2015 at 14:56.
Al3 is offline
Send a message via Skype™ to Al3
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 09-28-2015 , 15:01   Re: Get the player with the most frags being made
Reply With Quote #4

As I see it, this code is pretty damn well written... not talking about the spaces, syntaxes that satisfy me. The math looks good
redivcram is offline
Al3
Member
Join Date: Sep 2015
Location: Bulgaria
Old 09-28-2015 , 15:06   Re: Get the player with the most frags being made
Reply With Quote #5

Thanks (not sure if you are being serious or not). I just know that loops are slow, especially with fillings where the HLPL doesn't optimize with say branch prediction.
Also I am kinda new to amxmodx programming and I don't really trust myself yet.
Moreover, a lot of things I see are removed from "C". Not only syntactically but also in semantic manner.

Last edited by Al3; 09-28-2015 at 15:15.
Al3 is offline
Send a message via Skype™ to Al3
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 09-28-2015 , 15:22   Re: Get the player with the most frags being made
Reply With Quote #6

No no, I'm serious...

Well, amxmodx programming is just like every other programming, you just need to get to know modules and includes with their natives, Yes... and modified too, which makes it easier
redivcram is offline
Al3
Member
Join Date: Sep 2015
Location: Bulgaria
Old 09-28-2015 , 15:34   Re: Get the player with the most frags being made
Reply With Quote #7

Yes. Redundant features from the "C" are removed there.
I still miss pointers though. And structs on second place.
Al3 is offline
Send a message via Skype™ to Al3
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-28-2015 , 17:01   Re: Get the player with the most frags being made
Reply With Quote #8

@Al3
I will give you some friendly advice, search before posting. Because most likely the question has been asked before.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Al3
Member
Join Date: Sep 2015
Location: Bulgaria
Old 09-28-2015 , 17:04   Re: Get the player with the most frags being made
Reply With Quote #9

This trivial advice.

I searched. I could still search forever I guess..
Al3 is offline
Send a message via Skype™ to Al3
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-28-2015 , 22:25   Re: Get the player with the most frags being made
Reply With Quote #10

Do you only need to know who the single highest fragger is, his number of frags, and which team they are on? Are there any other details to your request? I don't want to code something and then you tell me it doesn't do what you want.
__________________

Last edited by Bugsy; 09-28-2015 at 22:43.
Bugsy 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 20:35.


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