Raised This Month: $ Target: $400
 0% 

Mysql help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Loupu.
Member
Join Date: Jul 2013
Old 02-04-2017 , 06:11   Mysql help
Reply With Quote #1

Hi, i have a plugin that announce on server when a layer made 5 kills in a rounds without Dying. Now i decided that i want to register every ace in a mysql database. Problem is that i'm really noob in mysql... So i tried something, logical i got the point but practical i have no idea how to make it work.. Can someone help me please? Want to register in a database the name of the player and the amount of the aces(5 kills in a round without dying). Here is my sma

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <csx>
#include <hamsandwich>

const MAXPLAYERS 32;

enum PlayerData
{
    
Name33 ],
    
AuthID34 ],
    
Kills,
    
Deaths,
    
Aces
}

new 
g_Vault;
new 
g_PlayerDataMAXPLAYERS ][ PlayerData ];
new 
g_pAceKills;
new 
bool:g_bIsBotMAXPLAYERS ];

//MYSQL CONNECTIONs
new Handle:g_h_Sql

public plugin_init() 
{
    
register_plugin("aces""0.1""unknown")
    
    
register_clcmd("say /ace""cmdAce"0"- display ace top")
    
    
// EVENTS
    
register_event"DeathMsg""EventDeathMsg""a" );
    
    
g_h_Sql SQL_MakeDbTuple("127.0.0.1""user13728""pass""user13728")
}

public 
client_authorizedid )
{
    if ( !( 
g_bIsBotid ] = !!( is_user_botid ) || is_user_hltvid ) ) ) )
    {
        new 
s_Query[128]
        
get_user_authidid g_PlayerDataid ][ AuthID ] , charsmaxg_PlayerData[][ AuthID ] ) );
        
get_user_nameid g_PlayerDataid ][ Name ] , charsmaxg_PlayerData[][ AuthID ] ) );
        
        
format(s_Querycharsmax(s_Query), "SELECT aces FROM aces WHERE name='%s'"g_PlayerDataid ][ Name ]);
        
SQL_ThreadQuery(g_h_Sql"Handle_Query"s_Query);
    }
}

public 
EventDeathMsg( )
{
    new 
iKiller read_data);
    new 
iVictim read_data);
    
    
CheckAceiVictim );
    
    if( 
iKiller && iKiller != iVictim && cs_get_user_teamiKiller ) != cs_get_user_teamiVictim ) )
    {
        if (
g_b_Connected_SQL
        {
        new 
Handle:h_Querys_Name[32],g_Ace[33], s_Error[128]
        
        
get_user_name(ids_Namecharsmax(s_Name))
        }
        
g_iFragsiKiller ]++;
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
CheckAceid )
{
    if( 
g_iFragsid ] >= )
    {
        
g_Ace[id]++;
        
DidAceid );
    }
    
    
g_iFragsid ] = 0;
}

public 
DidAceid )
{
    new 
iReturn PLUGIN_CONTINUE;
    
    
ExecuteForwardiForward iReturn id g_iFragsid ] );
    
    if( 
iReturn == PLUGIN_HANDLED || iReturn == PLUGIN_HANDLED_MAIN )
    {
        return 
PLUGIN_HANDLED;
    }
    
    
client_print(0print_chat," %s did an ACE."g_PlayersName[id]);
    return 
PLUGIN_HANDLED;
}  

public 
plugin_end()
{
    
SQL_FreeHandle(g_h_Sql_Connect)
    
SQL_FreeHandle(g_h_Sql)

Loupu. is offline
 


Thread Tools
Display Modes

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:43.


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