This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

If score 16 add T or CT to /matchranks page.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
4ever16
Veteran Member
Join Date: Apr 2015
Old 07-16-2015 , 05:19   If score 16 add T or CT to /matchranks page.
Reply With Quote #1

It was hard to find a good topic name for this thread.

Anyways im saying it again im running automix server.

It would be cool if there was or if someone could create a plugin which does this.

When some team wins 16 rounds all players is added to /matchranks page.
/matchranks opens a MOTD with wins & lost matches.
So if u say /matchranks MOTD opens and i can see this.

Heaton ( 20 win matches ) ( 1 lost matches )
Heaton ( 20 win matches ) ( 1 lost matches )
Heaton ( 20 win matches ) ( 1 lost matches )
Heaton ( 20 win matches ) ( 1 lost matches )
Heaton ( 20 win matches ) ( 1 lost matches )

The plugin registers all players in the team who has team score 16. ( Win )
The plugin registers all players in the other team when the score is 16. ( Lost )

Do you understand what i mean? Can someone make it? Is this possible?
4ever16 is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 07-18-2015 , 01:50   Re: If score 16 add T or CT to /matchranks page.
Reply With Quote #2

I think this runs CS PUG MOD.

http://91.211.244.124/mix/suzaisti.php

It uses pugstats.amxx https://forums.alliedmods.net/showth...=played+rounds

So can anyone re-make this to nvault or separate plugin cause i dont run pspugmod i run hartmans automix.

Here is the pugstats.sma code.

Code:
#include <amxmodx>
#include <fakemeta>
#include <csx>
#include <sqlx>

#include <PugConst>
#include <PugStocks>
#include <PugNatives>
#include <PugForwards>
#include <PugCS>

#pragma semicolon 1

#define isPlayer(%0) (1 <= %0 <= MaxClients)

new bool:g_bStats;

new g_pHost;
new g_pUser;
new g_pPass;
new g_pDBSE;

new g_pRankedServer;
new g_pStatsURL;

enum _:eStats
{
    eKills,
    eAssists,
    eDeaths,
    eHeadshots,
    eShots,
    eHits,
    eDamage,
    Float:eRWS,
    eRoundsPlayed,
    eRoundsLose,
    eRoundsWin,
    eMatchsPlayed,
    eMatchsLose,
    eMatchsWin
};

new g_iStats[MAX_PLAYERS][eStats];

enum _:eBomb
{
    bDefuses,
    bDefused,
    bPlants,
    bExplosions
};

new g_iBomb[MAX_PLAYERS][eBomb];

enum _:eStreak
{
    K1,
    K2,
    K3,
    K4,
    K5
};

new g_iStreak[MAX_PLAYERS][eStreak];

enum _:eVersus
{
    V1,
    V2,
    V3,
    V4,
    V5
};

new g_iVersus[MAX_PLAYERS][eVersus];

enum _:eWeaponStats
{
    wKills,
    wDeaths,
    wHeadshots,
    wShots,
    wHits,
    wDamage
};

new g_iWeapon[MAX_PLAYERS][MAX_PLAYERS][eWeaponStats];

enum _:eMatch
{
    mServer[32],
    mAddress[23],
    mMap[32]
};

new g_aMatch[eMatch];

new g_iKills[MAX_PLAYERS];
new g_iDamage[MAX_PLAYERS][MAX_PLAYERS];
new g_iLastManVersus[MAX_PLAYERS];
new g_iGunsEventsIdBitSum;

new Handle:g_hSQL;

public plugin_init()
{
    register_plugin("Pug MOD (Stats)",PUG_MOD_VERSION,PUG_MOD_AUTHOR);
    
    register_dictionary("PugStats.txt");
    
    g_pHost = get_cvar_pointer("pug_sql_host");
    g_pUser = get_cvar_pointer("pug_sql_user");
    g_pPass = get_cvar_pointer("pug_sql_pass");
    g_pDBSE = get_cvar_pointer("pug_sql_db");
    
    g_pRankedServer = create_cvar("pug_ranked_server","1",FCVAR_NONE,"Rank the server to database");
    g_pStatsURL = create_cvar("pug_web_url","http://localhost",FCVAR_NONE,"URL of stats pages for pug mod");
    
    new const sGunsEvents[][] =
    {
        "events/awp.sc","events/g3sg1.sc","events/ak47.sc","events/scout.sc","events/m249.sc",
        "events/m4a1.sc","events/sg552.sc","events/aug.sc","events/sg550.sc","events/m3.sc",
        "events/xm1014.sc","events/usp.sc","events/mac10.sc","events/ump45.sc","events/fiveseven.sc",
        "events/p90.sc","events/deagle.sc","events/p228.sc","events/glock18.sc","events/mp5n.sc",
        "events/tmp.sc","events/elite_left.sc","events/elite_right.sc","events/galil.sc","events/famas.sc"
    };
    
    for(new i;i < sizeof(sGunsEvents);++i)
    {
        g_iGunsEventsIdBitSum |= 1 << engfunc(EngFunc_PrecacheEvent,1,sGunsEvents[i]);
    }
    
    register_forward(FM_PlaybackEvent,"FwPlaybackEvent");
    
    PugRegisterCommand("stats","PugCommandStats",ADMIN_ALL,"PUG_DESC_STATS");
    PugRegisterCommand("rank","PugCommandRank",ADMIN_ALL,"PUG_DESC_RANK");
    PugRegisterCommand("match","PugCommandMatch",ADMIN_ALL,"PUG_DESC_MATCH");
}

public plugin_end()
{
    if(g_hSQL != Empty_Handle)
    {
        SQL_FreeHandle(g_hSQL);
    }
}

public client_putinserver(id)
{
    if(get_pcvar_num(g_pRankedServer))
    {
        arrayset(g_iBomb[id],0,sizeof(g_iBomb[]));
        arrayset(g_iStats[id],0,sizeof(g_iStats[]));
        arrayset(g_iStreak[id],0,sizeof(g_iStreak[]));
        arrayset(g_iVersus[id],0,sizeof(g_iVersus[]));
        
        for(new iWeapon;iWeapon < sizeof(g_iWeapon[]);iWeapon++)
        {
            arrayset(g_iWeapon[id][iWeapon],0,sizeof(g_iWeapon[][]));
        }
    }
}

public client_disconnect(id)
{
    if(get_pcvar_num(g_pRankedServer) && !is_user_bot(id) && !is_user_hltv(id))
    {
        if(g_iStats[id][eRoundsPlayed])
        {
            PugSaveStats(id);
        }
    }
}

public PugEventWarmup()
{
    new sHost[32],sUser[32],sPass[32],sDBSE[32];
    
    get_pcvar_string(g_pHost,sHost,charsmax(sHost));
    get_pcvar_string(g_pUser,sUser,charsmax(sUser));
    get_pcvar_string(g_pPass,sPass,charsmax(sPass));
    get_pcvar_string(g_pDBSE,sDBSE,charsmax(sDBSE));
    
    g_hSQL = SQL_MakeDbTuple(sHost,sUser,sPass,sDBSE);
    
    if(get_pcvar_num(g_pRankedServer))
    {
        g_bStats = false;
        
        get_mapname(g_aMatch[mMap],charsmax(g_aMatch[mMap]));
        get_cvar_string("hostname",g_aMatch[mServer],charsmax(g_aMatch[mServer]));
        get_cvar_string("net_address",g_aMatch[mAddress],charsmax(g_aMatch[mAddress]));
    }
}

public PugEventFirstHalf()
{
    if(get_pcvar_num(g_pRankedServer))
    {
        g_bStats = true;
    }
}

public PugEventHalfTime()
{
    if(get_pcvar_num(g_pRankedServer))
    {
        g_bStats = false;
    }
}

public PugEventSecondHalf()
{
    if(get_pcvar_num(g_pRankedServer))
    {
        g_bStats = true;
    }
}

public PugEventOvertime()
{
    if(get_pcvar_num(g_pRankedServer))
    {
        g_bStats = true;
    }
}

public PugEventEnd(iWinner)
{
    if(get_pcvar_num(g_pRankedServer))
    {
        g_bStats = false;
    
        new iTeam;
        
        for(new i = 1;i <= MaxClients;i++)
        {
            if(is_user_connected(i))
            {
                iTeam = get_user_team(i);
                
                if(1 <= iTeam <= 2)
                {
                    g_iStats[i][eMatchsPlayed]++;
                    
                    if(iTeam == iWinner)
                    {
                        g_iStats[i][eMatchsWin]++;
                    }
                    else
                    {
                        g_iStats[i][eMatchsLose]++;
                    }
                }
            }
        }
        
        new sQuery[256];
        
        format
        (
            sQuery,
            charsmax(sQuery),
            "CALL PugSaveMatch('%s', '%s', '%s', %i, %i, %f)",
            g_aMatch[mServer],
            g_aMatch[mAddress],
            g_aMatch[mMap],
            PugGetTeamScore(1),
            PugGetTeamScore(2),
            get_gametime()
        );
        
        SQL_ThreadQuery(g_hSQL,"PugHandlerSQL",sQuery);
    }
}

public client_death(iKiller,iVictim,iWeapon,iPlace,TK)
{
    if(g_bStats)
    {
        if(iKiller != iVictim)
        {
            g_iStats[iKiller][eKills]++;
            g_iStats[iVictim][eDeaths]++;
    
            g_iWeapon[iKiller][iWeapon][wKills]++;
            g_iWeapon[iVictim][iWeapon][wDeaths]++;
            
            g_iKills[iKiller]++;
            
            if(iPlace == HIT_HEAD)
            {
                g_iStats[iKiller][eHeadshots]++;
                g_iWeapon[iKiller][iWeapon][wHeadshots]++;
            }
        }
        
        for(new i = 1;i <= MaxClients;i++)
        {
            if(is_user_connected(i))
            {
                if((g_iDamage[i][iVictim] >= 50) && (i != iKiller))
                {
                    g_iStats[i][eAssists]++;
                }
                else
                {
                    g_iDamage[i][iVictim] = 0;
                }
                
                if(IsAlone(i) && !g_iLastManVersus[i])
                {
                    g_iLastManVersus[i] = GetAliveEnemies(i);
                }
            }
        }
    }
}

public client_damage(iAttacker,iVictim,iDamage,iWeapon,iPlace,iTA)
{
    if(g_bStats && (iAttacker != iVictim))
    {
        g_iStats[iAttacker][eHits]++;
        g_iStats[iAttacker][eDamage] += iDamage;
        
        g_iDamage[iAttacker][iVictim] += iDamage;
        
        g_iWeapon[iAttacker][iWeapon][wHits]++;
        g_iWeapon[iAttacker][iWeapon][wDamage] += iDamage;
    }
}

public FwPlaybackEvent(iFlags,id,iEvent)
{
    if(g_bStats && isPlayer(id) && (g_iGunsEventsIdBitSum & (1 << iEvent)))
    {
        g_iStats[id][eShots]++;
        g_iWeapon[id][get_user_weapon(id)][wShots]++;
    }
}

public bomb_planted(iPlanter)
{
    if(g_bStats)
    {
        g_iBomb[iPlanter][bPlants]++;
    }
}

public bomb_defusing(iDefuser)
{
    if(g_bStats)
    {
        g_iBomb[iDefuser][bDefuses]++;
    }
}
public bomb_defused(iDefuser)
{
    if(g_bStats)
    {
        g_iBomb[iDefuser][bDefused]++;
    }
}

public bomb_explode(iPlanter,iDefuser)
{
    if(g_bStats)
    {
        g_iBomb[iPlanter][bExplosions]++;
    }
}

public PugEventRoundStart()
{
    if(g_bStats)
    {
        arrayset(g_iKills,0,sizeof(g_iKills));
        arrayset(g_iLastManVersus,0,sizeof(g_iLastManVersus));
        
        for(new i;i < sizeof(g_iDamage);i++)
        {
            arrayset(g_iDamage[i],0,sizeof(g_iDamage[]));
        }
    }
}

public PugEventRoundWinner(iWinner)
{
    if(g_bStats)
    {
        new i,iTeam[MAX_PLAYERS],iStats[8],iBody[8],iTeamDamage,iDamageDone[MAX_PLAYERS];
        
        for(i = 1;i <= MaxClients;i++)
        {
            if(is_user_connected(i))
            {
                iTeam[i] = get_user_team(i);
                
                if(1 <= iTeam[i] <= 2)
                {
                    if(iTeam[i] == iWinner)
                    {
                        g_iStats[i][eRoundsWin]++;
        
                        if(IsAlone(i))
                        {
                            g_iVersus[i][g_iLastManVersus[i]]++;
                        }
                        
                        get_user_rstats(i,iStats,iBody);
                        iTeamDamage += (iDamageDone[i] = iStats[6]);
                    }
                    else
                    {
                        g_iStats[i][eRoundsLose]++;
                    }
                
                    g_iStats[i][eRoundsPlayed]++;
                    
                    if(g_iKills[i])
                    {
                        g_iStreak[i][g_iKills[i]]++;
                    }
                }
            }
        }
     
        for(i = 1;i <= MaxClients;i++)
        {
            if(is_user_connected(i) && (iTeam[i] == iWinner))
            {
                g_iStats[i][eRWS] += float(iDamageDone[i]) / float(iTeamDamage);
            }
        }
    }
}

bool:IsAlone(id)
{
    if(is_user_alive(id))
    {
        new sTeam[12];
        
        if(1 <= get_user_team(id,sTeam,charsmax(sTeam)) <= 2)
        {
            new iPlayers[32],iNum;
            get_players(iPlayers,iNum,"ae",sTeam);
            
            return (iNum == 1) ? true : false;
        }
    }

    return false;
}

GetAliveEnemies(id)
{
    if(is_user_alive(id))
    {
        new iPlayers[32],iNum;
        get_players(iPlayers,iNum,"ae",(get_user_team(id) == 1) ? "CT" : "TERRORIST");
    
        return iNum;
    }

    return -1;
}

PugSaveStats(id)
{
    new sQuery[1536];
    
    new sSteam[35];
    get_user_authid(id,sSteam,charsmax(sSteam));
    
    format
    (
        sQuery,
        charsmax(sQuery),
        "CALL PugSaveStats('%s', %i, %i, %i, %i, %i, %i, %i, %f, %i, %i, %i, %i, %i, %i)",
        sSteam,
        g_iStats[id][eKills],
        g_iStats[id][eAssists],
        g_iStats[id][eDeaths],
        g_iStats[id][eHeadshots],
        g_iStats[id][eShots],
        g_iStats[id][eHits],
        g_iStats[id][eDamage],
        g_iStats[id][eRWS],
        g_iStats[id][eRoundsPlayed],
        g_iStats[id][eRoundsLose],
        g_iStats[id][eRoundsWin],
        g_iStats[id][eMatchsPlayed],
        g_iStats[id][eMatchsLose],
        g_iStats[id][eMatchsWin]
    );
    
    format
    (
        sQuery,
        charsmax(sQuery),
        "%s;CALL PugSaveBomb('%s', %i, %i, %i, %i)",
        sQuery,
        sSteam,
        g_iBomb[id][bDefuses],
        g_iBomb[id][bDefused],
        g_iBomb[id][bPlants],
        g_iBomb[id][bExplosions]
    );
    
    format
    (
        sQuery,
        charsmax(sQuery),
        "%s;CALL PugSaveStreak('%s', %i, %i, %i, %i, %i)",
        sQuery,
        sSteam,
        g_iStreak[id][K1],
        g_iStreak[id][K2],
        g_iStreak[id][K3],
        g_iStreak[id][K4],
        g_iStreak[id][K5]
    );
    
    format
    (
        sQuery,
        charsmax(sQuery),
        "%s;CALL PugSaveVersus('%s', %i, %i, %i, %i, %i)",
        sQuery,
        sSteam,
        g_iVersus[id][V1],
        g_iVersus[id][V2],
        g_iVersus[id][V3],
        g_iVersus[id][V4],
        g_iVersus[id][V5]
    );
    
    format(sQuery,charsmax(sQuery),"%s;CALL PugCalcStats('%s')",sQuery,sSteam);

    SQL_ThreadQuery(g_hSQL,"PugHandlerSQL",sQuery);
    
    sQuery = "^0";
    new sWeapon[32];
    
    for(new iWeapon;iWeapon < sizeof(g_iWeapon[]);iWeapon++)
    {
        if(g_iWeapon[id][iWeapon][wShots] || g_iWeapon[id][iWeapon][wDeaths])
        {
            get_weaponname(iWeapon,sWeapon,charsmax(sWeapon));
            
            format
            (
                sQuery,
                charsmax(sQuery),
                "CALL PugSaveWeapon(%i, '%s', %i, %i, %i, %i, %i, %i, '%s');%s",
                iWeapon,
                sWeapon,
                g_iWeapon[id][iWeapon][wKills],
                g_iWeapon[id][iWeapon][wDeaths],
                g_iWeapon[id][iWeapon][wHeadshots],
                g_iWeapon[id][iWeapon][wShots],
                g_iWeapon[id][iWeapon][wHits],
                g_iWeapon[id][iWeapon][wDamage],
                sSteam,
                sQuery
            );
        }
    }
    
    if(sQuery[0])
    {
        SQL_ThreadQuery(g_hSQL,"PugHandlerSQL",sQuery);
    }
}

public PugHandlerSQL(iState,Handle:hQuery,sError[],iError,sData[],iData)
{
    if(iState != TQUERY_SUCCESS)
    {
        if(iError)
        {
            server_print(sError);
        }
    }
    
    SQL_FreeHandle(hQuery);
}

public PugCommandStats(id)
{
    new sAlias[35];
    read_args(sAlias,charsmax(sAlias));
    remove_quotes(sAlias);
    
    if(!sAlias[0])
    {
        get_user_authid(id,sAlias,charsmax(sAlias));
    }
    
    new sURL[128];
    get_pcvar_string(g_pStatsURL,sURL,charsmax(sURL));
    
    format(sURL,charsmax(sURL),"%s/stats.php?Alias=%s",sURL,sAlias);
    
    show_motd(id,sURL,sAlias);
    
    return PLUGIN_HANDLED;
}

public PugCommandRank(id)
{
    new sTitle[32];
    format(sTitle,charsmax(sTitle),"%L",LANG_PLAYER,"PUG_MOTD_TOP");
    
    new sURL[128];
    get_pcvar_string(g_pStatsURL,sURL,charsmax(sURL));
    
    add(sURL,charsmax(sURL),"/top.php");
    
    show_motd(id,sURL,sTitle);
    
    return PLUGIN_HANDLED;
}

public PugCommandMatch(id)
{
    new sTitle[32];
    format(sTitle,charsmax(sTitle),"%L",LANG_PLAYER,"PUG_MOTD_MATCH");
    
    new sURL[128];
    get_pcvar_string(g_pStatsURL,sURL,charsmax(sURL));
    
    add(sURL,charsmax(sURL),"/match.php");
    
    show_motd(id,sURL,sTitle);

    return PLUGIN_HANDLED;
}
4ever16 is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 07-24-2015 , 04:25   Re: If score 16 add T or CT to /matchranks page.
Reply With Quote #3

Sad that amxx coders are retiered to old for this old game.

Anyone has time to make this?
4ever16 is offline
Hartmann
Senior Member
Join Date: Nov 2014
Old 07-25-2015 , 09:01   Re: If score 16 add T or CT to /matchranks page.
Reply With Quote #4

You can put where you share the points for the lost and won the match, this is just an example:

Code:
new win[33], los[33]

win[id]++
los[id]++
and then you have to put to save with points.
__________________

RETAKES v1.0
github.com/alghtryer/retakes

Contact : [email protected]

BTC Donate: 1QAh1NLmeHy81LF9r8PaeGjYqHL2BBcJTx

Hartmann is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 07-25-2015 , 16:23   Re: If score 16 add T or CT to /matchranks page.
Reply With Quote #5

I understand where you are going but im not a programmer.
I will try to learn program amxx really need this function.
4ever16 is offline
Hartmann
Senior Member
Join Date: Nov 2014
Old 07-25-2015 , 18:29   Re: If score 16 add T or CT to /matchranks page.
Reply With Quote #6

If you want to contact me, I'll do to you.
__________________

RETAKES v1.0
github.com/alghtryer/retakes

Contact : [email protected]

BTC Donate: 1QAh1NLmeHy81LF9r8PaeGjYqHL2BBcJTx

Hartmann is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 07-26-2015 , 05:52   Re: If score 16 add T or CT to /matchranks page.
Reply With Quote #7

U know where to find me. Steam Tnx
4ever16 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 16:14.


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