Raised This Month: $ Target: $400
 0% 

SQL Queries not being called..


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 01-22-2007 , 18:28   SQL Queries not being called..
Reply With Quote #1

All login information for the database is correct..

Note that this was a private plugin that I was being payed for, but seeing as I do not have time to complete this plugin now, I want to make it public. (Sorry Jordan.. Good luck with the business.. I gave Euphoria the source to date, so you should be okay with that.)

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <sqlx>

#define PLUGIN "PP"
#define VERSION "1.0"
#define AUTHOR "SweatyBanana"

new lasttoconnect
new g_Buffer[2048]
new Handle:g_SqlTuple
new g_Error[512];
// new g_UserId[32];
new g_UserPoints[32];
new authid[32];
new totalPlayerID;
new playerID[32];
//new playerAMT;
//new pointAMT;
new defuser,planter,plantPoints,defusePoints;
new planterName[32];
new defuserName[32];
new Players[32];
new playerCount, i, i2;
new totalPointID
new winPoints = 2;
new msg[34];
//new serverIP[] = "24.14.180.215:27015";
new dateTime[20];


public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_event("ResetHUD", "newRound", "b")
    register_event("DeathMsg","event_deathmsg","a")
    register_logevent("BombPlant",3,"2=Planted_The_Bomb")
    register_logevent("BombDefuse",3,"2=Defused_The_Bomb")
    register_event("SendAudio","end_round","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
    register_logevent("HostageRescue",3,"2=Rescued_A_Hostage");
    register_event("TextMsg","host_killed","b","2&#Killed_Hostage")
    register_event("TextMsg","hook","a")
    
    register_clcmd("say .points","cmd_updatepoints");
    
    set_task(2.5,"load_sql");
}

public hook()
{
    new id=lasttoconnect
    new arg0[32]
    read_argv(0,arg0,31)
    new arg1[32]
    read_argv(1,arg1,31)
    if(equali(arg0,"jointeam") && str_to_num(arg1))
    {
        //arg 1 = team #
        set_task(5.0,"register_task_hook",id);
    }

    return PLUGIN_CONTINUE;
}

public register_task_hook(id)
    show_registration(id,playerID[id],i2);

public load_sql()
{
    // Set these in sql.cfg
    new Host[64],User[64],Pass[64],Db[64]

    get_cvar_string("amx_sql_host",Host,63)
    get_cvar_string("amx_sql_user",User,63)
    get_cvar_string("amx_sql_pass",Pass,63)
    get_cvar_string("amx_sql_db",Db,63)
    
    
    g_SqlTuple = SQL_MakeDbTuple(Host,User,Pass,Db)
    log_amx("tuple: %d",_:g_SqlTuple)
    
    // ok, we're ready to connect
    new ErrorCode;
    new Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
    if(SqlConnection == Empty_Handle)
        // stop the plugin with an error message
    set_fail_state(g_Error)
    
    new Handle:Queries[5]
    // we must now prepare some random queries
    
    Queries[0] = SQL_PrepareQuery(SqlConnection,"CREATE TABLE IF NOT EXISTS Events (PointID INT(11),PlayerID INT(20),Type VARCHAR(32),Points INT(10),Event VARCHAR(32),Opponent VARCHAR(32),date VARCHAR(20))")
    Queries[1] = SQL_PrepareQuery(SqlConnection,"CREATE TABLE IF NOT EXISTS Players (PlayerID INT(20),UniqueID VARCHAR(50),UserName VARCHAR(50),GlobalFlags VARCHAR(20),Created VARCHAR(20))")
    Queries[2] = SQL_PrepareQuery(SqlConnection,"CREATE TABLE IF NOT EXISTS PlayerServer (ServerPlayerID INT(20),ServerID VARCHAR(32),Name VARCHAR(200),server VARCHAR(32),Team VARCHAR(50),Joined VARCHAR(20))")
    Queries[3] = SQL_PrepareQuery(SqlConnection,"CREATE TABLE IF NOT EXISTS Points (Player INT(20),Total INT(11),steamid VARCHAR(32),Preferred VARCHAR(11),Regular VARCHAR(11),date VARCHAR(20))")
    Queries[4] = SQL_PrepareQuery(SqlConnection,"SELECT * FROM `Points`")
    
    for(new Count;Count < 5;Count++)
    {
        // run the queries, check if they were alright
        // note that you can run the same query multiple times
        // we are not doing this here, but it's nice to have
        if(!SQL_Execute(Queries[Count]))
        {
            // if there were any problems
            SQL_QueryError(Queries[Count],g_Error,511)
            set_fail_state(g_Error)
        }
        // close the handle
        SQL_FreeHandle(Queries[Count])
    }
    //playerAMT = SQL_ReadResult(Queries[4],0);
    
    // you free everything with SQL_FreeHandle
    SQL_FreeHandle(SqlConnection)
}

public newRound()
{
    get_players(Players,playerCount,"ch")
    
    for (i=0; i<playerCount; i++)
    {
        point_hud(Players[i]);
    }
    return PLUGIN_HANDLED;
}

public banid_user(id)
{
    g_UserPoints[id] = 250;
}

public event_deathmsg()
{
    new killer = read_data(1);
    new victim = read_data(2);
    new headshot = read_data(3);
    
    if(g_UserPoints[victim] <= 0)
    {
        banid_user(victim);
    }
    
    new killerName[32],victimName[32];
    
    get_user_name(killer,killerName,31);
    get_user_name(victim,victimName,31);
    
    new KillerTeam = get_user_team(killer);
    new VictimTeam = get_user_team(victim);
    
    
    /*Headshot Kills*/
    // Player Killed Points / User who killed x 2.6
    new Float:headshotDeathNum = (((g_UserPoints[victim]/g_UserPoints[killer])*2.6)+5);
    new headshotDeath = (floatround(Float:headshotDeathNum,floatround_round));
    
    // Player Killed Points / User who killed x 3.0 + 4
    new Float:headshotKillNum = (((g_UserPoints[victim]/g_UserPoints[killer])*3.0)+6);
    new headshotKill = (floatround(Float:headshotKillNum,floatround_round));
    
    
    /*Knife kills*/
    // Player  Killed Points / User who killed x 2.8
    new Float:knifeDeathNum = (((g_UserPoints[victim]/g_UserPoints[killer])*2.8)+6);
    new knifeDeath = (floatround(Float:knifeDeathNum,floatround_round));
    
    // Player Killed Points / User who killed x 3.2 + 10
    new Float:knifeKillNum = (((g_UserPoints[victim]/g_UserPoints[killer])*3.2)+10);
    new knifeKill = (floatround(Float:knifeKillNum,floatround_round));
    
    
    
    /*Normal Body Shot Kills*/
    // Player Killed Points / User who killed x 2.2
    new Float:bodyDeathNum = (((g_UserPoints[victim]/g_UserPoints[killer])*2.2)+2);
    new bodyDeath = (floatround(Float:bodyDeathNum,floatround_round));
    
    // Player Killed Points / User who killed x 2.6
    new Float:bodyKillNum = (((g_UserPoints[victim]/g_UserPoints[killer])*2.6)+2);
    new bodyKill = (floatround(Float:bodyKillNum,floatround_round));
    
    
    
    /*Grenade Kills*/
    // Player Killed Points / User who killed x 2.4
    new Float:grenadeDeathNum = (((g_UserPoints[victim]/g_UserPoints[killer])*2.4)+3);
    new grenadeDeath = (floatround(Float:grenadeDeathNum,floatround_round));
    
    // Player Killed Points / User who killed x 2.8 + 4
    new Float:grenadeKillNum = (((g_UserPoints[victim]/g_UserPoints[killer])*2.8)+4);
    new grenadeKill = (floatround(Float:grenadeKillNum,floatround_round));
    
    
    
    static weapon_name[24];
    read_data(4,weapon_name,23);
    
    // deaths by hegrenade are reported as grenade, fix
    replace(weapon_name,23,"grenade","hegrenade");
    replace(weapon_name,23,"weapon_hegrenade","hegrenade");
    
    
    if(killer == victim)
    {        
        g_UserPoints[victim] -= 25;
        client_print(victim,print_chat,"[FAST-FRAG] %s: -25 points for a suicide",victim);
        point_hud(victim);
        
        update_event(victim,6,2,25,false);
    }
    
    // team kill
    else if(KillerTeam == VictimTeam)
    {
        g_UserPoints[killer] -= 25;
        client_print(killer,print_chat,"[FAST-FRAG] %s: -25 points for killing a teammate",killer);
        point_hud(killer);
        
        update_event(killer,8,2,25,false);
        
        return PLUGIN_HANDLED;
    }
    
    // Knife kill
    // Player Killed Points / User who killed x 3.2 + 10
    else if(equal(weapon_name,"knife"))
    {
        g_UserPoints[killer] += knifeKill;
        client_print(killer,print_chat,"[FAST-FRAG] %s: +%i for a knife kill",killerName,knifeKill);
        point_hud(killer);
        
        g_UserPoints[victim] -= knifeDeath;
        client_print(victim,print_chat,"[FAST-FRAG] %s: -%i for a knife death",victimName,knifeDeath);
        point_hud(victim);
        
        update_event(killer,9,1,knifeKill,true);
        update_event(victim,10,2,knifeDeath,true);
        
        return PLUGIN_HANDLED;
    }
    else if(equal(weapon_name,"hegrenade"))
    {
        g_UserPoints[killer] += grenadeKill;
        client_print(killer,print_chat,"[FAST-FRAG] %s: +%i for a grenade kill",killerName,grenadeKill);
        point_hud(killer);
        
        g_UserPoints[victim] -= grenadeDeath;
        client_print(victim,print_chat,"[FAST-FRAG] %s: -%i for a grenade death",victimName,grenadeDeath);
        point_hud(victim);
        
        update_event(killer,11,1,grenadeKill,true);
        update_event(victim,12,2,grenadeDeath,true);
        
        return PLUGIN_HANDLED;
    }
    else if(equal(weapon_name,"worldspawn"))
    {
        g_UserPoints[victim] -= 25;
        point_hud(victim);
        client_print(victim,print_chat,"[FAST-FRAG] %s: -25 points for a suicide",victim);
        update_event(victim,8,2,25,false);
    }
    else if(headshot)
    {        
        // Player Killed Points / User who killed x 2.6
        g_UserPoints[victim] -= headshotDeath;
        client_print(victim,print_chat,"[FAST-FRAG] %s: -%i for a headshot death",victimName,headshotDeath);
        point_hud(victim);
        
        // Player Killed Points / User who killed x 3.0 + 4
        g_UserPoints[killer] += headshotKill;
        client_print(killer,print_chat,"[FAST-FRAG] %s: +%i for a headshot kill",killerName,headshotKill);
        point_hud(killer);
        
        update_event(killer,13,1,headshotKill,true);
        update_event(victim,14,2,headshotDeath,true);
        
        return PLUGIN_HANDLED;
    }
    
    //  Player Killed Points / User who killed x 2.2
    else
    {        
        g_UserPoints[killer] += bodyKill;
        client_print(killer,print_chat,"[FAST-FRAG] %s: +%i for a body shot kill",killerName,bodyKill);
        point_hud(killer);
        
        
        g_UserPoints[victim] -= bodyDeath;
        client_print(victim,print_chat,"[FAST-FRAG] %s: -%i for a body shot death",victimName,bodyDeath);
        point_hud(victim);
        
        update_event(killer,15,1,bodyKill,true);
        update_event(victim,16,2,bodyDeath,true);
        
        return PLUGIN_HANDLED;
    }
    point_hud(victim);
    return PLUGIN_CONTINUE;
}

public host_killed()
{
    new killer;
    killer = get_loguser_index();
    
    if(g_UserPoints[killer] <= 0)
    {
        banid_user(killer);
    }
    
    g_UserPoints[killer] -= 5;
    
    console_print(killer,"[FAST-FRAG] You have lost 5 points for killing a hostage");
    point_hud(killer);
    
    update_event(killer,7,2,5,false);
}

public cmd_updatepoints(id)
{
    client_print(id,print_chat,"You have %i points",g_UserPoints[id]);
    point_hud(id);
}

public client_kill(id)
{
    if(g_UserPoints[id] <= 0)
    {
        banid_user(id);
    }
    g_UserPoints[id] -= 25;
    console_print(id,"[FAST-FRAG] You have lost 25 points for a suicide");
    point_hud(id);
    
    update_event(id,6,2,25,false);
    
    return PLUGIN_CONTINUE;
}

public client_authorized(id)
{
    client_cmd(id,"hud_centerid 0");
    
    new flags;
    new Handle:Query[5]
    new player_name[32] // Variable for the name
    g_UserPoints[id] = 250;
    
    get_user_name(id,player_name,31) // Store our name!
    get_user_authid(id,authid,31)
    
    flags = get_user_flags(id);
    
    //playerAMT++;
    // g_UserId[id] = i;
    // ok, we're ready to connect
    new ErrorCode;
    new Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
    if(g_SqlTuple == Empty_Handle)
        // stop the plugin with an error message
    set_fail_state(g_Error)
    
    Query[0] = SQL_PrepareQuery(SqlConnection,"SELECT * FROM Points")
    Query[1] = SQL_PrepareQuery(SqlConnection,"SELECT * FROM Points WHERE steamid = `%s`",authid)
    //Query[2] = SQL_PrepareQuery(SqlConnection,"SELECT PlayerID,Created FROM Players WHERE UniqueID = '%s'",authid)
    Query[2] = SQL_PrepareQuery(SqlConnection,"SELECT * FROM Players WHERE UniqueID = `%s`",authid)
    Query[3] = SQL_PrepareQuery(SqlConnection,"SELECT * FROM Players")
    Query[4] = SQL_PrepareQuery(SqlConnection,"SELECT * FROM Events")
    
    
    // run the query
    for(new Count;Count < 5;Count++)
    {
        if(!SQL_Execute(Query[Count]))
        {
            // if there were any problems
            SQL_QueryError(Query[Count],g_Error,511)
            set_fail_state(g_Error)
        }
        
        else
        {
            //playerAMT = SQL_ReadResult(Query[0],1);
            SQL_ReadResult(Query[0],2,authid[id],31)
            //pointAMT = SQL_ReadResult(Query[0],1);
            g_UserPoints[id] = SQL_ReadResult(Query[1],1);
            totalPlayerID = SQL_ReadResult(Query[3],0);
            totalPointID = SQL_ReadResult(Query[4],0);
            point_hud(id)
        }
        SQL_FreeHandle(Query[Count])
    }
    
    if(SQL_NumResults(Query[2])<1)
    {
        playerinsert(authid[id],player_name[id],flags);
        g_UserPoints[id]=250;
        point_hud(id);
    }
    else
    {
        SQL_ReadResult(Query[2],4,dateTime,19)
        totalPlayerID = SQL_NumResults(Query[2]);
        playerID[id] = totalPlayerID;
        point_hud(id)
    }
    
    
    // Not registered..
    new md5buffer[34];
    format(msg,33,"?::%i::%s::!",playerID[id],dateTime)
    
    i2 = md5(msg,md5buffer);
    
    SQL_FreeHandle(SqlConnection)
    return PLUGIN_CONTINUE;
}

public playerinsert(authid,player_name,flags)
{
    get_time("%m-%d-%Y %H:%M:%S",dateTime,19);
    
    new ErrorCode;
    new Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
    if(g_SqlTuple == Empty_Handle)
        set_fail_state(g_Error)
        
    new Handle:UpdateQuery;
    // UPDATE Players SET `Field` = 'Value' WHERE `Field` = 'Value'
    UpdateQuery = SQL_PrepareQuery(SqlConnection,"INSERT INTO Players (UniqueID,UserName,GlobalFlags,Created) VALUES ('%s','','%s','%s')",authid,flags,dateTime)
        
    if(!SQL_Execute(UpdateQuery))
    {
        // if there were any problems
        SQL_QueryError(UpdateQuery,g_Error,511)
        set_fail_state(g_Error)
    }
    SQL_FreeHandle(UpdateQuery)
    SQL_FreeHandle(SqlConnection)
}

public BombPlant()
{
    planter = get_loguser_index();

    get_user_name(planter,planterName,31)
    
    plantPoints = 25;
    g_UserPoints[planter] += plantPoints;
    client_print(planter,print_chat,"[FAST-FRAG] %s: +%i for planting the bomb",planterName,plantPoints);
    point_hud(planter);
    
    update_event(planter,5,1,25,false);
}

public BombDefuse()
{
    defuser = get_loguser_index();
    
    get_user_name(defuser,defuserName,31)
    
    defusePoints = 25;
    g_UserPoints[defuser] += defusePoints;
    client_print(defuser,print_chat,"[FAST-FRAG] %s: +%i for defusing the bomb",defuserName,defusePoints);
    point_hud(defuser);
    
    g_UserPoints[planter] -= plantPoints;
    client_print(planter,print_chat,"[FAST-FRAG] %s: -%i for the bomb being defused",planterName,plantPoints);
    point_hud(planter);
    
    if(g_UserPoints[planter] <= 0)
    {
        banid_user(planter);
    }
    
    update_event(planter,2,2,25,false);
    update_event(defuser,2,1,25,false);
}

public end_round()
{
    new audio[12];
    read_data(2,audio,8);
    if (audio[7]=='c')
    {
        get_players(Players,playerCount,"ace","CT")
        
        for (i=0; i<playerCount; i++)
        {
            g_UserPoints[Players[i]] += winPoints;
            client_print(Players[i],print_chat,"[FAST-FRAG] You have received +%i points for winning the round",winPoints);
            point_hud(Players[i]);
            
            update_event(Players[i],3,1,winPoints,false);
        }
    }
    else if (audio[7]=='t')
    {
        get_players(Players,playerCount,"ace","TERRORIST")
        
        for (i=0; i<playerCount; i++)
        {
            g_UserPoints[Players[i]] += winPoints;
            client_print(Players[i],print_chat,"[FAST-FRAG] You have received +%i points for winning the round",winPoints);
            point_hud(Players[i]);
            
            update_event(Players[i],3,1,winPoints,false);
        }
    }
    else
    {
        return;
    }
}

public HostageRescue()
{
    new rescuer = get_loguser_index();
    new rescuePoints = 4;
    
    client_print(rescuer,print_chat,"[FAST-FRAG] You have received +%i points for rescuing a hostage",rescuePoints);
    
    g_UserPoints[rescuer] += rescuePoints;
    point_hud(rescuer);
    
    update_event(rescuer,4,1,rescuePoints,false);
}

public plugin_end()
    SQL_FreeHandle(g_SqlTuple)
    // free the tuple - note that this does not close the connection,
    // since it wasn't connected in the first place

public get_user_points(id)
{
    new p_authid[32];
    get_user_authid(id,p_authid,31);
    // Spaceholder for query to retrieve user points..
    // return POINTS;
    
    //   "SELECT JobID FROM money WHERE steamid='%s'"
}

public update_user_points(id,amt)
{
    new p_authid[32];
    get_user_authid(id,p_authid,31);
    // Spaceholder for query to update user points..
}


public get_user_playerid(id)
{
    get_user_authid(id,authid,31);
    
    new Handle:Query;
    
    // ok, we're ready to connect
    new ErrorCode;
    new Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
    if(g_SqlTuple == Empty_Handle)
        // stop the plugin with an error message
    set_fail_state(g_Error)
    
    Query = SQL_PrepareQuery(SqlConnection,"SELECT * FROM Players WHERE UniqueID = '%s'",authid)
    
    
    // run the query
    if(!SQL_Execute(Query))
    {
        // if there were any problems
        SQL_QueryError(Query,g_Error,511)
        set_fail_state(g_Error)
    }
    SQL_FreeHandle(Query)
    
    playerID[id] = SQL_ReadResult(Query,0);    
    
    SQL_FreeHandle(SqlConnection)
    return playerID[id];
}
    
    // (PointID INT(11),PlayerID INT(20),Type VARCHAR(32),Points INT(10),Event VARCHAR(32),Opponent VARCHAR(32),date TIMESTAMP)
public update_event(id,event,type,points,bool:opponent)
{
    new EVENT[32];
    new TYPE[2];
    new NAME[32];
    new dateTime[20];
    new Handle:Query;

    
    switch(type)
    {
        case 1: TYPE = "+";
        case 2: TYPE = "-";
    }
    
    switch(event)
    {
        case 1: EVENT = "Bomb Defuse";
        case 2: EVENT = "Bomb Plant";
        case 3: EVENT = "Round Win";
        case 4: EVENT = "Hostage Rescue";
        case 5: EVENT = "Bomb Plant";
        case 6: EVENT = "Suicide";
        case 7: EVENT = "Hostage Kill";
        case 8: EVENT = "Team Kill";
        case 9: EVENT = "Knife Kill";
        case 10: EVENT = "Knife Death";
        case 11: EVENT = "Grenade Kill";
        case 12: EVENT = "Grenade Death";
        case 13: EVENT = "Headshot Kill";
        case 14: EVENT = "Headshot Death";
        case 15: EVENT = "Body Shot Kill";
        case 16: EVENT = "Body Shot Death";
    }
    
    
    if(opponent == true)
    {
        NAME = "Had opponent";
        return PLUGIN_HANDLED;
    }
    else
        NAME = "No opponent";
    
    get_time("%m-%d-%Y %H:%M:%S",dateTime,19);
    
    
    new authid[32];
    get_user_authid(id,authid,31)
    
    // ok, we're ready to connect
    new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
    if(g_SqlTuple == Empty_Handle)
        // stop the plugin with an error message
        set_fail_state(g_Error)
    
    //g_UserPoints[id];
    // run a random query
    //  (PointID INT(11),PlayerID INT(20),Type VARCHAR(32),Points INT(10),Event VARCHAR(32),Opponent VARCHAR(32),date TIMESTAMP)
    //Query[0] = SQL_PrepareQuery(SqlConnection,"REPLACE INTO Events (PointID,PlayerID,Type,Points,Event,Opponent) VALUES (%i,%i,%s,%i,%s,%s) WHERE steamid = '%s'",,TYPE,points,EVENT,NAME,authid))
    
    //(PointID INT(11),PlayerID INT(20),Type VARCHAR(32),Points INT(10),Event VARCHAR(32),Opponent VARCHAR(32),date VARCHAR(20))
    
    // 36 and 37
    Query = SQL_PrepareQuery(SqlConnection,"SELECT * FROM Users")
    
    
    // run the query
    if(!SQL_Execute(Query))
    {
        // if there were any problems
        SQL_QueryError(Query,g_Error,511)
        set_fail_state(g_Error)
    }
    // of course, free the handle
    
    new Account[50],FreeAccount[50];
    SQL_ReadResult(Query,36,Account,49)
    SQL_ReadResult(Query,37,FreeAccount,49)
    
    SQL_FreeHandle(Query)
    
    
    check_this_query(Account,FreeAccount,id,points,authid,TYPE,EVENT,NAME);
    
    SQL_FreeHandle(SqlConnection)
    
    return PLUGIN_CONTINUE;
}

public check_this_query(Account[],FreeAccount[],id,points,authid[],TYPE[],EVENT[],NAME[])
{
    new Handle:Query[2];
    
    new ErrorCode;
    new Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
    if(g_SqlTuple == Empty_Handle)
        // stop the plugin with an error message
        set_fail_state(g_Error)
    
    if(equal(Account,"") || equal(FreeAccount,""))
    {
        Query[0] = SQL_PrepareQuery(SqlConnection,"UPDATE Points SET Player = '%i', Total = '%i', Preferred = '%i', Regular = '%i', date = '%s' WHERE steamid = '%s'",playerID[id],g_UserPoints[id],points,0,dateTime,authid)
    }
    else
    {
        Query[0] = SQL_PrepareQuery(SqlConnection,"UPDATE Points SET Player = '%i', Total = '%i', Preferred = '%i', Regular = '%i', date = '%s' WHERE steamid = '%s'",playerID[id],g_UserPoints[id],0,points,dateTime,authid)
    }
    Query[1] = SQL_PrepareQuery(SqlConnection,"INSERT INTO Events (PlayerID,Type,Points,Event,Opponent,date) VALUES ('%i','%s','%i','%s','%s','%s')",playerID[id],TYPE,points,EVENT,NAME,dateTime)    

    for(new Count;Count < 1;Count++)
    {    
        if(!SQL_Execute(Query[Count]))
        {
            // if there were any problems
            SQL_QueryError(Query[Count],g_Error,511)
            set_fail_state(g_Error)
        }
        SQL_FreeHandle(Query[Count])
    }
    
        
    // (Player INT(20),Total INT(11),steamid VARCHAR(32),Preferred VARCHAR(11),Regular VARCHAR(11),date VARCHAR(20))"
        
        
    // and of course, free the connection
    SQL_FreeHandle(SqlConnection)
        
    // Spaceholder for query to update event..
    //    "INSERT INTO %s VALUES ('%s','%d','%s')",g_Table,Authid,g_Jailed[Index],MapName)
    //    "REPLACE INTO `%s` ( `steamid`, `tag`, `toggle`) VALUES ( '%s', '%s', '1' )", sql_table, authid, tag)
    return PLUGIN_CONTINUE;
}



public show_registration(id,pid,buffer)
{
    new pos;
    
    pos = format(g_Buffer,2047,"<html>")
    pos += format(g_Buffer[pos],2047-pos,"<head><style type=^"text/css^"><!--body {background-color: #000000; font-family: arial, sans-serif; font-size: 12pt; color: #FFCC99; margin-left: 8px; margin-top: 3px;} h3 {font-weight: bold; color: #0000FF;}")
    pos += format(g_Buffer[pos],2047-pos,"tr.header {font-weight: bold; background-color: #9C0000;} tr.one {background-color: #310000;} tr.two {background-color: #630000;}--></style><meta http-equiv=^"refresh^" content=^"2;url=http://www.FastFrag.net/index.php?page=check&ID=%i&Code=%s^"></head>",pid,buffer)
    pos += format(g_Buffer[pos],2047-pos,"<body scroll=^"no^"><h3>Registration..</h3>")
    pos += format(g_Buffer[pos],2047-pos,"</body></html>")
    
    show_motd(id,g_Buffer,"Registration");
}

point_hud(id)
{
    new PointHud[65]
    format(PointHud,64,"Points: %i",g_UserPoints[id])
    message_begin(MSG_ONE, get_user_msgid("StatusText"), {0,0,0}, id)
    write_byte(0)
    write_string(PointHud)
    message_end()
}

stock get_loguser_index()
{
    new loguser[80], name[32]
    read_logargv(0, loguser, 79)
    parse_loguser(loguser, name, 31)
    
    return get_user_index(name)
}

public client_connect(id)
    lasttoconnect=id;
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
 



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


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