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


Raised This Month: $ Target: $400
 0% 

Miniduels! + Top15 + Stats!


Post New Thread Reply   
 
Thread Tools Display Modes
ShiiTake
Member
Join Date: May 2010
Old 06-07-2012 , 12:39   Re: Miniduels! + Top15 + Stats!
Reply With Quote #31

I tested your plugin and I really liked. I have some tips. The Duel in the last 30 minutes of the map and a long time. You could put ma option to choose the amount of duel. example: a cvar: duel_duelendlimit 10 So the duel will end after 10 duels. Why be dueling map for 30 minutes just to win a duel is very annoying. In TF2 the duel lasts for 1 round and not the weather map. Cs could be in every 10 matches, whoever wins gets the duel. Example: player 1 10x5 player2 . Soon the player is a winner, then it is only duel again to mark a kind of revenge. Sorry for the English, I used a translator.
__________________
ShiiTake is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 06-08-2012 , 12:08   Re: Miniduels! + Top15 + Stats!
Reply With Quote #32

If i'm not wrong , you mean , a limit of frags ?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
ShiiTake
Member
Join Date: May 2010
Old 06-09-2012 , 08:01   Re: Miniduels! + Top15 + Stats!
Reply With Quote #33

Out instead of the 30-minute duel the duel would be only 10 times. Players will duel in a match of 10 duels, whoever wins eg: 10x5 or 3x10. Whoever gets to 10 wins in a duel active win a duel VICTORY.
__________________
ShiiTake is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 06-09-2012 , 09:07   Re: Miniduels! + Top15 + Stats!
Reply With Quote #34

Okei , now i understand , you want a limit , the first that get 10 frags with the dueler win the duel . i will try to code it , thanks anyway for the suggerest.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Lokogaditano
Senior Member
Join Date: Apr 2009
Old 06-10-2012 , 05:04   Re: Miniduels! + Top15 + Stats!
Reply With Quote #35

can you make that do duels at the same team? for jailbreak....a tt duel other tt...and stats for this...thx
Lokogaditano is offline
ShiiTake
Member
Join Date: May 2010
Old 06-10-2012 , 14:06   Re: Miniduels! + Top15 + Stats!
Reply With Quote #36

Quote:
Originally Posted by lucas_7_94 View Post
Okei , now i understand , you want a limit , the first that get 10 frags with the dueler win the duel . i will try to code it , thanks anyway for the suggerest.
This!

So go make your plugin more interesting.

Why be a map around to win a duel just not much fun. Now able to win several duels on a map would be good.

/ Sorry for any mistakes, I am using a translator.
__________________
ShiiTake is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 06-10-2012 , 22:52   Re: Miniduels! + Top15 + Stats!
Reply With Quote #37

No problem , but , i dont play tf2 some time ago , but if i'm not wrong ( maybe had more changes / updates ) the duels finish when a player disconnect , is kicked , or map changes.
EDIT: Try this

PHP Code:

/*      Copyright © 2012, lucas_7_94

    'MiniDuels!' is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with 'MiniDuels!'; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
    
    ///////////////////////////////////////////////////////////////////////////////////
        
    I want to send a greeting to a friend of this forum
    that according to information, he died in an accident, L//, may he rest in peace.    
*/


#include < amxmisc >
#include < fakemeta_util >
#include < cstrike > 
#include < sqlx >
#include < hamsandwich >

#pragma semicolon 1
#define ROUNDS 10

new bool:bPlayerDueling33 ] , gPlayerTeam33 ] ,CountOfKills], gDuelPlayers33 ];
new 
gDuelPlayerNames][ 33 ] , gMenuCallBack gLastMapToSave20 ] , szSteamID][ 33 ];

new 
bool:gPlayerInTheDatabase33 ] , gWinCount33 ] , gLosesCount33 ] , gLastPlayerPlayed33 ][ 33 ];
new 
gLastDayPlayed33 ][ 33 ] , gLastMap33 ][ 20 ] , gWinTheLastDuel33 ][ 33 ], Handle:gSqlTuple;

new 
szBuffer512 ] , bool:WhoWins], gGlowPlayers], ParseColors][ ];

new 
gMotd2048 ], len k;

new 
gTable[] = "duels";

enum
{
    
DUEL_SENDER,
    
DUEL_RECEIVER
}

public 
plugin_init( ) {
    
    static const 
szAuthor[ ] = "Luqqas";
    static const 
szPluginName[ ] = "MiniDuels!";
    static const 
szVersion[ ] = "1.0";
    
    
register_pluginszPluginNameszVersionszAuthor );
    
    
register_clcmd"say /duel""clcmd_duel" );
    
    
register_clcmd("amx_kick""cmd_amx_cvar");
    
    
get_mapnamegLastMapToSavecharsmaxgLastMapToSave ) );
    
    
gMenuCallBack  menu_makecallback"DuelPlayerEnabled" );
    
    
register_menu("Duel Stats"MENU_KEY_1"Duel_Stats");
    
    
register_clcmd"say /duelstats""clcmd_duelstats" );
    
    
register_forwardFM_AddToFullPack "func_AddToFullPack");
    
    
register_event"DeathMsg" "OnDeathMsg" "a" );
    
    
register_event("TeamInfo""join_spect""a""2=SPECTATOR" );
    
    
register_event"30" "event_intermission" "a" );
    
    
RegisterHam(Ham_Spawn"player""PlayerSpawn"1);
    
    
gGlowPlayers] = register_cvar"dl_tt_glow""255000000" );
    
gGlowPlayers] = register_cvar"dl_ct_glow""000000255" );
        
    
/* SQL Data */
        
    
static szHost[]    = "";
    static 
szUser[]    = "";
    static 
szPass[]    = "";
    static 
szDB[]      = "";

    
gSqlTuple SQL_MakeDbTupleszHostszUserszPassszDB );
    
    
/* END SQL Data */
    
    
register_cvar("dl_version"szVersionFCVAR_SERVER|FCVAR_SPONLY);
    
    
// Check if the table exists!
    
set_task(2.0"CheckTableIfExists");
    
    
// Multilang
    
register_dictionary"MiniDuelsML.txt" );
    

}

public 
cmd_amx_cvarid )
{
    if( 
accessidADMIN_ADMIN ) )
    {
        new 
get_kicked32 ], playerindexszName32 ];
        
read_argv1get_kicked31 );
        
        new 
player cmd_targetidget_kicked ,); 
        if( !
player 
            return 
PLUGIN_HANDLED;
        
        
get_user_nameplayerszName31 );
        
playerindex get_user_indexszName );

        if( 
bPlayerDuelingplayerindex ] ) // One of the dueler's kicked ... :(
        
{
            
client_printprint_chat"%L"LANG_PLAYER"MD_PLAYERKICKED"gDuelPlayerNames], gDuelPlayerNames]);
            
bPlayerDuelinggDuelPlayersDUEL_SENDER ] ] = bPlayerDuelinggDuelPlayersDUEL_RECEIVER ] ] = false;
            
CountOfKills] = CountOfKills] = 0;
        }
        
    }
    return 
PLUGIN_CONTINUE;
}
public 
client_putinserverid )
{
    for( 
k++ )
        
gDuelPlayerNames][ id ] = EOS;
        
    if( !
is_user_botid ) )
        
CheckIfPlayerIsInDbid );
        
    
gLastPlayerPlayedid ][ ] = gLastDayPlayedid ][ ] = gLastMapid ][ ] = gWinTheLastDuelid ][ ] = EOS;

}

public 
PlayerSpawn(id)
{
    if ( !
is_user_aliveid ) )
        return 
HAM_IGNORED;
        
    if( 
bPlayerDuelingid ] && ( cs_get_user_teamgDuelPlayersDUEL_SENDER ] ) == cs_get_user_teamgDuelPlayersDUEL_RECEIVER ] ) ) ) // possible bug ? ok , duel closed.
    
{
        
client_print0print_chat"%L"LANG_PLAYER"MD_CANCELLED"gDuelPlayerNames] , gDuelPlayerNames]);
        
        
bPlayerDuelinggDuelPlayersDUEL_SENDER ] ] = bPlayerDuelinggDuelPlayersDUEL_RECEIVER ] ] = false;
        
CountOfKills] = CountOfKills] = 0;
    }
    new 
color[10];
    
    for( 
k++ )
    {
         
get_pcvar_stringgGlowPlayers], color9);
         new 
strtonum str_to_num(color);
         
ParseColors][ ] = str_to_num(color) / 1000000;
         
strtonum %= 1000000;
         
ParseColors][ ] = strtonum 1000;
         
ParseColors][ ] = strtonum 1000;

         
#pragma unused strtonum     
    
}
    
    return 
HAM_IGNORED;
}
        
public 
join_spect( )
{
    new 
id read_data);

    if( 
bPlayerDuelingid ] )
    {        
        
client_print0print_chat"%L"LANG_PLAYER"MD_CHANGETOSPECT", (gDuelPlayersDUEL_SENDER ] == id) ? gDuelPlayerNames] : gDuelPlayerNames] , (gDuelPlayersDUEL_RECEIVER ] == id) ? gDuelPlayerNames] : gDuelPlayerNames] );    
        
        
WhoWins] = ( gDuelPlayersDUEL_SENDER ] == id ) ? false true;
        
WhoWins] = ( gDuelPlayersDUEL_SENDER ] == id ) ? true false;
        
Save_DbWhoWins );
        
bPlayerDuelinggDuelPlayersDUEL_SENDER ] ] = bPlayerDuelinggDuelPlayersDUEL_RECEIVER ] ] = false;
    }
    
}

public 
event_intermission( ) 
{
    if( !
bPlayerDuelinggDuelPlayersDUEL_SENDER ] ] && !bPlayerDuelinggDuelPlayersDUEL_RECEIVER ] ] ) return;
    
    if( 
CountOfKills] == CountOfKills] )
        
client_print(0print_chat"%L"LANG_PLAYER"MD_TIE"gDuelPlayerNames], gDuelPlayerNames]);
    else
    {    
        static 
result;
        
result CountOfKills] > CountOfKills];
        
client_print(0print_chat"%L"LANG_PLAYER"MD_WIN"
        ( 
result ) ? gDuelPlayerNames] : gDuelPlayerNames], 
        ( 
result ) ? gDuelPlayerNames] : gDuelPlayerNames], 
        ( 
result ) ? CountOfKills] : CountOfKills], 
        ( 
result ) ? CountOfKills] : CountOfKills]);
        
        
WhoWins] = ( result ) ? true false;
        
WhoWins] = ( result ) ? false true;
        
Save_DbWhoWins );
    }
}

public 
OnDeathMsg()
{
    new 
killer read_data);
    new 
victim read_data);
    
    if ( !
killer || killer == victim )
        return;
    
    if( 
bPlayerDuelingkiller ] && bPlayerDuelingvictim ] ) // DUEL HERE SIRS!
    
{
        if( 
CountOfKills] >= ROUNDS || CountOfKills] >= ROUNDS )
        {
            
// BETA NO TESTED
            
static result;
            
result CountOfKills] > CountOfKills];
            
client_print(0print_chat"%L"LANG_PLAYER"MD_WIN"
            ( 
result ) ? gDuelPlayerNames] : gDuelPlayerNames], 
            ( 
result ) ? gDuelPlayerNames] : gDuelPlayerNames], 
            ( 
result ) ? CountOfKills] : CountOfKills], 
            ( 
result ) ? CountOfKills] : CountOfKills]);
            
            
WhoWins] = ( result ) ? true false;
            
WhoWins] = ( result ) ? false true;
            
Save_DbWhoWins );
            
            
bPlayerDuelinggDuelPlayersDUEL_SENDER ] ] = bPlayerDuelinggDuelPlayersDUEL_RECEIVER ] ] = false;
            
// NO TESTED
        
}
        else
        {
            ( 
gDuelPlayersDUEL_SENDER ] == killer ) ? CountOfKills]++ : CountOfKills]++;
            
client_print0print_chat"%L"LANG_PLAYER"MD_STATUSDUEL"gDuelPlayerNames], CountOfKills] , gDuelPlayerNames], CountOfKills] );
        }
    }
    
}

public 
client_disconnectid )
{
    if( !
bPlayerDuelinggDuelPlayersDUEL_SENDER ] ] && !bPlayerDuelinggDuelPlayersDUEL_RECEIVER ] ] ) 
        return;
    
    
client_printprint_chat"%L"LANG_PLAYER"MD_PLAYERLEAVESERVER"
    ( 
gDuelPlayersDUEL_SENDER ] == id) ? gDuelPlayerNames[1] : gDuelPlayerNames[0],
    ( 
gDuelPlayersDUEL_SENDER ] == id) ? gDuelPlayerNames[0] : gDuelPlayerNames[1] );
    
    
WhoWins] = ( gDuelPlayersDUEL_SENDER ] == id ) ? false true;
    
WhoWins] = ( gDuelPlayersDUEL_SENDER ] == id ) ? true false;
    
    
Save_DbWhoWins );
    
    
bPlayerDuelinggDuelPlayersDUEL_SENDER ] ] = bPlayerDuelinggDuelPlayersDUEL_RECEIVER ] ] = false;
    
    return;
    
}

public 
clcmd_duelid )
{
    if(  
bPlayerDuelingid ] )
    {
        
client_printid print_chat"%L" id"MD_INDUEL");
        return 
PLUGIN_HANDLED;
    }
    
    if( 
cs_get_user_teamid ) == CS_TEAM_SPECTATOR || cs_get_user_teamid ) == CS_TEAM_UNASSIGNED )
        return 
PLUGIN_HANDLED;
    
    static 
title[250];
    
formatextitle charsmax(title) , "%L"id"MD_MENUTITLE" );
    
    new 
menu menu_createtitle "Duel_Handled" );
    
    new 
players32 ], pnumtempid;
    
    new 
szName32 ], szTempid10 ];
    
get_playersplayerspnum );
    
    for( new 
pnum i++ )
    {
        
tempid players];
        
        if( 
get_user_teamtempid ) == get_user_teamid ) || cs_get_user_teamtempid ) == CS_TEAM_SPECTATOR )
            continue;
            
        
        
get_user_nametempidszNamecharsmaxszName ) );
        
num_to_strtempidszTempidcharsmaxszTempid ) );
        
menu_additemmenuszNameszTempidgMenuCallBack );        
    }
    
    
menu_displayidmenu);    
    return 
PLUGIN_HANDLED;
}

public 
DuelPlayerEnabled(idmenuitem)
{
    new 
data], szName64 ];
    new 
accesscallback;
    
    
menu_item_getinfomenuitemaccessdata,charsmax(data), szName,charsmax(szName), callback );
    
    new 
tempid str_to_numdata );
    
    if( 
bPlayerDuelingtempid ] )
        return 
ITEM_DISABLED;
    
    return 
ITEM_ENABLED;
}

public 
Duel_Handled(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data], szName64 ];
    new 
accesscallback;
    
menu_item_getinfomenuitemaccessdata,charsmaxdata ), szName,charsmaxszName ), callback );
    
    new 
tempid str_to_numdata );
    
    if( 
bPlayerDuelingtempid ] )
    {
        
client_print(idprint_chat"%L"id "MD_CANTINVITE");
        
clcmd_duelid );
        return 
PLUGIN_HANDLED;
    }

    
gDuelPlayersDUEL_SENDER ] = id;
    
gDuelPlayersDUEL_RECEIVER ] = tempid;
    
    
get_user_namegDuelPlayersDUEL_RECEIVER ], gDuelPlayerNames], charsmaxgDuelPlayerNames[ ] ) );
    
get_user_namegDuelPlayersDUEL_SENDER ] , gDuelPlayerNames], charsmaxgDuelPlayerNames[ ] ) );
    
    
client_print0print_chat"%L"LANG_PLAYER"MD_SENDINVITATION",  gDuelPlayerNames] , gDuelPlayerNames]);
    
    
receive_menu_duelgDuelPlayersDUEL_RECEIVER ] );
    
    return 
PLUGIN_HANDLED;
    
}

receive_menu_duel( const Receiver )
{    
    static 
buffer65 ], szOptions][ 100 ];
    
formatexbuffersizeofbuffer ) - "%L"Receiver"MD_RECEIVEINVITATION"gDuelPlayerNames] ) ;
    
    new 
menu menu_createbuffer "Receive_Handled");
    
    
formatexszOptions] , charsmaxszOptions[ ] ), "%L"Receiver"MD_ACCEPTDUEL" );
    
formatexszOptions] , charsmaxszOptions[ ] ), "%L"Receiver"MD_CANCELDUEL" );
    
    
menu_additemmenuszOptions], "1");
    
menu_additemmenuszOptions], "2");
    
    
menu_setpropmenuMPROP_EXITMEXIT_NEVER );
    
    
menu_displayReceiver menu);
    
    return;
    
}
public 
Receive_Handled(idmenuitem)
{
    new 
data], szName64 ];
    new 
accesscallback;
    
    
menu_item_getinfomenuitemaccessdata,charsmax(data), szName,charsmax(szName), callback );
    
    new 
key str_to_numdata );
    
    if( 
bPlayerDuelinggDuelPlayersDUEL_SENDER ] ] )
    {
        
client_print(idprint_chat"%L"id "MD_CANTINVITE" );
        return 
PLUGIN_HANDLED;
    }
    
    switch(
key)
    {
        case 
1:
        {
            
client_printprint_chat"%L"LANG_PLAYER"MD_DUELACCEPTED"gDuelPlayerNames], gDuelPlayerNames] );
            
bPlayerDuelinggDuelPlayersDUEL_SENDER ] ] = bPlayerDuelinggDuelPlayersDUEL_RECEIVER ] ] = true;
            
gPlayerTeamgDuelPlayersDUEL_SENDER ] ] = _:cs_get_user_teamgDuelPlayersDUEL_SENDER ] );
            
gPlayerTeamgDuelPlayersDUEL_RECEIVER ] ] = _:cs_get_user_teamgDuelPlayersDUEL_RECEIVER ] );
            
get_user_authidgDuelPlayersDUEL_SENDER ], szSteamID] , 32 );
            
get_user_authidgDuelPlayersDUEL_RECEIVER ], szSteamID] , 32 );

        }
        case 
2:
        {
            
client_printprint_chat"%L"LANG_PLAYER"MD_DUELCANCELLED"gDuelPlayerNames], gDuelPlayerNames] );
            
gDuelPlayers[DUEL_SENDER] = gDuelPlayers[id] = EOS;
        }
    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}


public 
func_AddToFullPack(eseenthosthostflagsplayerpSet)
{     
    if( !
player || !pev_valident ) ||  !get_orig_retval( ) || host == ent )
        return 
FMRES_IGNORED;
    
    if( 
bPlayerDuelinghost ] && bPlayerDuelingent ] )
    {
        
set_eses ES_RenderFxkRenderFxGlowShell );
        switch( 
gPlayerTeam[ ( host ) ? host ent ] ) 
        { 
            case 
CS_TEAM_T:set_eses ES_RenderColorParseColors][ ], ParseColors][ ] , ParseColors][ ] );
            case 
CS_TEAM_CT:set_eses ES_RenderColorParseColors][ ], ParseColors][ ] , ParseColors][ ] );
            

        }
        switch( 
gPlayerTeament ] ) 
        { 
            case 
CS_TEAM_T:set_eses ES_RenderColorParseColors][ ], ParseColors][ ] , ParseColors][ ] );
            case 
CS_TEAM_CT:set_eses ES_RenderColorParseColors][ ], ParseColors][ ] , ParseColors][ ] );
        }
        
set_eses ES_RenderAmt25 );
    }
    return 
FMRES_IGNORED;
}

CheckIfPlayerIsInDbid )
{
    static 
iData];
        
    static 
szSteamid[33];
    
get_user_authidid szSteamid 32 );
    
    
szBuffer] = EOS ;
    
    
formatexszBuffer 511 "SELECT * FROM %s WHERE steam = '%s'"gTableszSteamid );
    
    
iData] = id ;
    
    
SQL_ThreadQuerygSqlTuple"CheckPlayer"szBuffer iData);
}

public 
CheckPlayerFailStateHandle:QueryError[ ], ErrcodeData[ ], DataSize )
{
    if( 
FailState == TQUERY_CONNECT_FAILED || FailState == TQUERY_QUERY_FAILED 
    { 
        
log_amx"%s"Error );
        return;
    } 
    else 
    { 
        new 
id Data];
        
        if( 
SQL_NumResultsQuery ) < )
        {
            
gPlayerInTheDatabaseid ] = false;
        }
        else
        {
            
gPlayerInTheDatabaseid ] = true;
            
SQL_ReadResultQuerygLastPlayerPlayedid ] , charsmaxgLastPlayerPlayed[ ] ));
            
SQL_ReadResultQuerygWinTheLastDuelid ] , charsmaxgWinTheLastDuel[ ] ) );
            
SQL_ReadResultQuerygLastMapid ] , charsmaxgLastMap[ ] ));
            
SQL_ReadResultQuerygLastDayPlayedid ] , charsmaxgLastDayPlayed[ ] ));
            
gWinCountid ] = SQL_ReadResultQuery);
            
gLosesCountid ] = SQL_ReadResultQuery);    
        }
        
    }
}

public 
clcmd_duelstatsid 
{
    static 
szTitle90 ];
    
formatexszTitlecharsmaxszTitle ) , "%L"id"MD_STATSTITLE2" );
    new 
menu menu_createszTitle"DuelStats_Handled" );
    
    new 
players32 ], pnumtempid;
    
    new 
szName32 ], szTempid10 ];
    
get_playersplayerspnum );

    for( new 
pnum i++ )
    {
        
tempid players];
                
        
get_user_nametempidszNamecharsmaxszName ) );
        
num_to_strtempidszTempidcharsmaxszTempid ) );
        
menu_additemmenuszNameszTempid );        
    }
    
    
menu_displayidmenu);
}

public 
DuelStats_Handled(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data], szName64 ];
    new 
accesscallback;
    
menu_item_getinfomenuitemaccessdata,charsmaxdata ), szName,charsmaxszName ), callback );
    
    new 
tempid str_to_numdata );
    
    
get_user_nametempidszNamecharsmaxszName ) );
    
    
look_menu_statsid tempid szName "Duel Stats" );
    
    return 
PLUGIN_HANDLED;
    
}
                 
// my id , idplayer , nameplayer , menutittle 
look_menu_statsid playertolook, const szPlayerName[] = "" , const MenuTitle[] = "" )
{    
    static 
menu512 ], len;
    
len 0;
    
    
len += formatexmenulen ], charsmaxmenu ) - len"%L^n^n"id"MD_STATSTITLE"szPlayerName );
    
    if( !
gPlayerInTheDatabaseplayertolook ] )
        
len += formatexmenulen ], charsmaxmenu ) - len"%L^n^n"id"MD_NOSTATSFOUNDED" );
    else
    {
        
len += formatexmenulen ], charsmaxmenu ) - len"%L^n"id"MD_LASTPLAYERPLAYED"gLastPlayerPlayedplayertolook ] );
        
len += formatexmenulen ], charsmaxmenu ) - len"%L^n"id"MD_WINLASTDUEL"idgWinTheLastDuelplayertolook ][ ] == 'Y' "MD_YES" "MD_NO");
        
len += formatexmenulen ], charsmaxmenu ) - len"%L^n"id"MD_LASTMAPPLAYED"gLastMapplayertolook ] );
        
len += formatexmenulen ], charsmaxmenu ) - len"%L^n"id"MD_LASTDAYPLAYED"gLastDayPlayedplayertolook ] );
        
len += formatexmenulen ], charsmaxmenu ) - len"%L^n"id"MD_WINCOUNT"gWinCountplayertolook ] );
        
len += formatexmenulen ], charsmaxmenu ) - len"%L^n^n"id"MD_LOSESCOUNT"gLosesCountplayertolook ] );
    }
    
len += formatexmenulen ], charsmaxmenu ) - len"\r1.%L^n"id"MD_EXIT");
    
show_menuidMENU_KEY_1menu, -1MenuTitle );
}

public 
Duel_Statsidkey )
{
    return 
PLUGIN_HANDLED;
}

public 
CheckTableIfExists()
{
    
szBuffer] = EOS;
    
    
formatexszBuffercharsmaxszBuffer ) , "CREATE TABLE IF NOT EXISTS duels (`steam` VARCHAR(32) NOT NULL, `name` VARCHAR(32) NOT NULL, `LastPlayerPlayed` VARCHAR(32) NOT NULL, `WinLastGame` VARCHAR(32) NOT NULL, `LastMapPlayedInDuel` VARCHAR(32) NOT NULL, `LastDayPlayedDuel` VARCHAR(32) NOT NULL, `WinCount` INT(10) NOT NULL, `LosesCount` INT(10) NOT NULL, PRIMARY KEY (`steam`))");
    
    
SQL_ThreadQuerygSqlTuple"CreateTableHandle"szBuffer );
}

public 
CreateTableHandleFailStateHandle:QueryError[ ], ErrcodeData[ ], DataSize )
{
    if( 
FailState )
    {
        
log_amx"SQL Error: %s (%d)"ErrorErrcode );
        return 
PLUGIN_HANDLED;
    }
    
    
szBuffer] = EOS;
    
    
formatexszBuffercharsmaxszBuffer ), "SELECT * FROM `%s` ORDER BY WinCount DESC, LosesCount DESC LIMIT 15;"gTable );
    
    
SQL_ThreadQuerygSqlTuple"duel_top"szBuffer );
    return 
PLUGIN_CONTINUE;
}

public 
duel_topFailStateHandle:QueryError[ ], ErrcodeData[ ], DataSize )
{
    if( 
FailState )
    {
        
log_amx"SQL Error: %s (%d)"ErrorErrcode );
        return 
PLUGIN_HANDLED;
    }
    
    if( 
SQL_NumResultsQuery ) > )
    {
        
register_clcmd"say /topduels" "clcmd_topduels" );
        
        new 
Name64 ], steam64 ];
        
        
0;
        
        
len += formatexgMotdlen ], charsmaxgMotd ) - len"<meta charset=UTF-8><style>body{color:#FFFFFF;background-color:black;margin-top:5;font-family:arial}table{border-collapse:separate;border-spacing:1px;text-align:left;}" );
        
len += formatexgMotdlen ], charsmaxgMotd ) - len"td{font-size:15px;}</style>" );
        
len += formatexgMotdlen ], charsmaxgMotd ) - len"<table border=1 width=700>" );
        
len += formatexgMotdlen ], charsmaxgMotd ) - len"%s","<br><tr bgcolor=##ffffff><td>  #<td>    Name<td>   Steam<td>Win Count<td>Loses Count</tr>");
        
        new 
isteam SQL_FieldNameToNumQuery"steam" );
        new 
iname SQL_FieldNameToNumQuery"name" );
        new 
iwincount SQL_FieldNameToNumQuery"WinCount" );
        new 
ilosescount SQL_FieldNameToNumQuery"LosesCount" );
        
        
        while ( 
SQL_MoreResultsQuery ) )
        {
            
len += formatexgMotdlen ], charsmaxgMotd ) - len"%s%d", (++!= 1) ? "<tr><td>" "<tr bgcolor=#00ff00><td>"k);
            
            
SQL_ReadResult(QueryinameNamecharsmax(Name));
            
SQL_ReadResult(Queryisteamsteamcharsmax(steam));
            
            
len += formatexgMotdlen ], charsmaxgMotd ) - len"<td>%-22.22s"Name );
            
len += formatexgMotdlen ], charsmaxgMotd ) - len"<td>%-22.22s"steam );
            
len += formatexgMotdlen ], charsmaxgMotd ) - len"<td>%d"SQL_ReadResultQueryiwincount ) );
            
len += formatexgMotdlen ], charsmaxgMotd ) - len"<td>%d"SQL_ReadResultQueryilosescount ) );
    
            
SQL_NextRowQuery );
        }
    
        
len += formatexgMotdlen ], charsmaxgMotd ) - len"</table></font>" );
        
    }
        
    return 
PLUGIN_HANDLED;
    
}

public 
clcmd_topduelsid show_motdidgMotd "Duel Stats!" );

Save_Db( const Winner[] )
{
    static 
Player1Player2;
    
Player1 gDuelPlayersDUEL_SENDER ];
    
Player2 gDuelPlayersDUEL_RECEIVER ];  // index of players
    
    
static Query][ 1024 ], gTime[18]; 
    
get_time"%c"gTime 17 );
    
    static 
kQuestion];
    for( 
k++ )
    {
        
replace_allgDuelPlayerNames], charsmaxgDuelPlayerNames[ ] ), "`""" );
        
replace_allgDuelPlayerNames], charsmaxgDuelPlayerNames[ ] ), "'""''" );
        
        
Question] = ( !) ? 1;
        
Question] = ( !) ? Player1 Player2;
        
        
formatexQueryQuestion] ] , sizeofQuery[ ] ) , "%s %s SET `steam` = '%s' , `name` = '%s' , `LastPlayerPlayed` = '%s', `LastDayPlayedDuel` = '%s', `WinLastGame` = '%s', `LastmapPlayedInDuel` = '%s', `WinCount` = %s, `LosesCount` = %s",
        (
gPlayerInTheDatabaseQuestion] ]) ? "UPDATE" "INSERT INTO" ,gTableszSteamIDQuestion] ], gDuelPlayerNamesQuestion] ], gDuelPlayerNames[ ( !) ? ], gTime, (WinnerQuestion] ] ) ? "Yes" "No" gLastMapToSave, (WinnerQuestion] ] ) ? "`WinCount` + 1" "`WinCount`" , (WinnerQuestion] ] ) ? "`LosesCount`" "`LosesCount` + 1");
        
        if( 
gPlayerInTheDatabaseQuestion] ] )
        {
            static 
AddBuffer512 ];
            
formatexAddBuffer charsmaxAddBuffer ), " WHERE steam = '%s'"szSteamIDQuestion] ] );
            
addQueryQuestion] ] , charsmaxQuery[ ] ), AddBuffer );
        }
        
        
gPlayerInTheDatabaseQuestion] ] = true;
        
CountOfKills] = 0;
        
SQL_ThreadQuerygSqlTuple"SaveHandled"Query] );
    }
}

public 
SaveHandledFailStateHandle:QueryError[ ], ErrcodeData[ ], DataSize )
{
    if( 
FailState )
    {
        
log_amx"SQL Error: %s (%d)"ErrorErrcode );
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
plugin_end() 
    
SQL_FreeHandlegSqlTuple ); 
To change max rounds , change:

Code:
#define ROUNDS 10

Sorry , i can't test it , i use a modem 3g with proxy and i can't connect to steam to test it.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.

Last edited by lucas_7_94; 06-10-2012 at 23:28.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Lokogaditano
Senior Member
Join Date: Apr 2009
Old 06-11-2012 , 15:10   Re: Miniduels! + Top15 + Stats!
Reply With Quote #38

can you ask my question?
Lokogaditano is offline
ShiiTake
Member
Join Date: May 2010
Old 06-13-2012 , 15:30   Re: Miniduels! + Top15 + Stats!
Reply With Quote #39

Lucas u update the first post ?
__________________
ShiiTake is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 06-13-2012 , 22:11   Re: Miniduels! + Top15 + Stats!
Reply With Quote #40

Nope , its a simple edition , if it works (because for the moment i cant test for the reason's that i posted) i will add this little version to the first post.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
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:47.


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