AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to get team leaders CT and T (https://forums.alliedmods.net/showthread.php?t=82917)

cLLaW 01-01-2009 07:55

how to get team leaders CT and T
 
I Want get team leaders CT and T How do i do this

SnoW 01-01-2009 08:09

Re: how to get team leaders CT and T
 
If those CT and T leaders already exists, you should inform what the game/mod is or are them on on some plugin you are using.

If you want to get a plugin where's T and CT have team leaders, you need to give more information.

Dores 01-01-2009 08:12

Re: how to get team leaders CT and T
 
I think he means the CT with best score in CT team, and T with best score in T team...

SnoW 01-01-2009 09:17

Re: how to get team leaders CT and T
 
Well that would make sense!
I'll make it if none other will, cLLaW, just confirm that it's what you want.

anakin_cstrike 01-01-2009 09:19

Re: how to get team leaders CT and T
 
Try it but is not very precise.
PHP Code:

get_leaderteam )
{
    new 
score = - 1;
    new 
fragsindex 0;
    
    
// g_maxplayers = get_maxplayers();
    
    
for( new 1<= g_maxplayersi++ )
    {
        if( !
is_user_connected) )
            continue;
        if( 
get_user_team) != team )
            continue;
        
        
frags get_user_frags);
        if( 
frags >= score )
        {
            
score frags;
            
index i;
        }
    }
    
    return 
index;


Btw, there was a plugin that glows the best player from every team.

Dores 01-01-2009 13:47

Re: how to get team leaders CT and T
 
This will count the players' kills, so even if you restart the round they will have the same kills saved(this will save the player's kills until he disconnects, so when he reconnects he'll have 0 kills).

Note: This is not a plugin, but an example. Using it won't do anything.
PHP Code:

#include <amxmodx>

new g_iKills33 ], g_iMaxPlayers;

get_best_killerteam )
{
    new 
best 0;
    for( new 
<= g_iMaxPlayers i++ ) // g_iMaxPlayers = get_maxplayers() in plugin_init
    
{
        if( !
is_user_connected) )
            continue;
        
        if( 
get_user_team) != team )
            continue;
        
        if( 
g_iKills] > g_iKillsbest ] )
        {
            
best i;
        }
    }
    
    
// best is now the best killer's id.
    
return best;
}


public 
server_changelevelmap[] )
{
    for( new 
<= g_iMaxPlayers i++ )
    {
        
g_iKills] = 0;
    }
}

public 
client_disconnectid )
{
    
g_iKillsid ] = 0;
}

public 
plugin_init()
{
    
register_event"DeathMsg""ev_Death""a" );
    
g_iMaxPlayers get_maxplayers();
}

public 
ev_Death()
{
    
g_iKillsread_data) ]++;



Exolent[jNr] 01-01-2009 17:51

Re: how to get team leaders CT and T
 
Code:
#include <fakemeta> // check_type determines which way to find best player // check_type = 0 -- most frags // check_type = 1 -- best difference in frags to deaths (frags - deaths) // check_type = 2 -- best ratio of frags per deaths (frags / deaths) get_team_leader(team, check_type) {     new bestClient = 0;     new Float:bestFrags = -9999.9;         static Float:frags, deaths;         // g_max_clients = get_maxplayers();     for( new client = 1; client <= g_max_clients; client++ )     {         if( !is_user_connected(client) || get_pdata_int(client, 114) != team) continue;                 pev(client, pev_frags, frags);                 switch( check_type )         {             //case 0: frags = frags;             case 1: frags -= get_pdata_int(client, 444);             case 2:             {                 deaths = get_pdata_int(client, 444);                 frags /= (deaths ? deaths : 1);             }         }                 if( frags > bestFrags )         {             bestFrags = frags;             bestClient = client;         }     }         return bestClient; }


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

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