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

!week


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gokus
New Member
Join Date: Aug 2012
Old 09-24-2012 , 08:45   !week
Reply With Quote #1

I'm trying to write a plugin that displays a list of players from the database in the menu command !week
PHP Code:
#include <sourcemod>

public Plugin:myinfo =
{
    
name "Wins Stat",
    
author "User",
    
description "",
    
version "1" ,
    
url ""
};

 new 
Handle:g_SQL INVALID_HANDLEbool:MYSQL;

 public 
OnPluginStart()
 {
     
RegConsoleCmd("week"week);
     if (!
SQL_CheckConfig("wins_stats"))
     {
         
SetFailState("section \"wins_stats\" not found databases.cfg");
         return;
     }

     
decl String:error[256];
     
g_SQL SQL_Connect("wins_stats"trueerror256);
     if (
g_SQL == INVALID_HANDLE)
     {
         
LogError(error);
         
SetFailState("no connect DB");
         return;
     }

     new 
String:driver[15]; SQL_ReadDriver(g_SQLdriver15);
     
MYSQL StrEqual(driver"mysql"false);
     
LogMessage("set %s connection"MYSQL "MYSQL" "SQLite");

     if (!
MYSQL)
     {
         
SQL_TQuery(g_SQLSQL_DefCallback"SELECT id, week, name, steam_id, place, week_wins FROM wins");
     }
 }

 public 
SQL_DefCallback(Handle:ownerHandle:hndl, const String:error[], any:data)
 {
     if (
hndl == INVALID_HANDLELogError(error);
 }
public 
Action:week(clientargs)
 {
     if (
client && args 1ShowMyPanel(client);
     return 
Plugin_Handled;
 }

 
ShowMyPanel(client)
 {
     new 
Handle:panel CreatePanel();
     
SetPanelTitle(panel"TOP 10:\n \n");
     
DrawPanelItem(panel"Exit");
     
SendPanelToClient(panelclientSelect_Panel0);
     
CloseHandle(panel);
     
ClientCommand(client"playgamesound items/nvg_off.wav");
 }

 public 
Select_Panel(Handle:panelMenuAction:actionclientoption)
 {
     if (
action == MenuAction_Select)
     {
         if (
option 11ShowMyPanel(client);
     }
 } 
Tell me how it can be concluded that 10 players in the menu
Gokus is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 09-24-2012 , 16:08   Re: !week
Reply With Quote #2

You can sort them via SQL command, not sure which.
__________________
FaTony is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 09-24-2012 , 16:19   Re: !week
Reply With Quote #3

Code:
SELECT id, week, name, steam_id, place, week_wins FROM wins ORDER BY place LIMIT 0, 10
Leonardo 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 00:03.


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