Raised This Month: $ Target: $400
 0% 

read from mysql


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 08-29-2008 , 17:59   read from mysql
Reply With Quote #1

ok well this is what im trying to do, i want the thing to read from a certain table in the mysql and if the person isnt in the tables then it will the the (!in_file) function if they are it will the the else if statements... this is what i have

Code:
public MYSQL_AllowedLevel(id)
{
    if ( !MYSQLX_Connection_Available() )
        return;
    new bool:in_file = false;
    new iUniqueID = DB_GetUniqueID( id ); // gets there id in database
    new szKey[66], szKeyName[32];
    DB_GetKey( id, szKey, 65 );
    DB_GetKeyName( szKeyName, 31 );
    new szQuery[512];
    format(szQuery, 255, "SELECT `allowed_level` FROM `wc3_allowed` WHERE ( `player_id` = '%d' );", iUniqueID );
    new Handle:query = SQL_PrepareQuery( g_DBConn, szQuery );
    if ( !SQL_Execute( query ) )
    {
        MYSQLX_Error( query, szQuery, 2 );
        return;
    }
 
    if(user is in the table)
    {
        in_file = true;
        MAX_LEVEL = read data from the table under allowed_level ( should be allowed level);
        if(MAX_LEVEL == 14)
        {
            client_print(id,print_chat, "[sFx] You have reached your max level. Join our forums to unlock the rest of the levels. ")
            p_data[id][P_XP] = 240000
            p_data_b[id][PB_RESETSKILLS] = true;
        }
        else if(MAX_LEVEL == 15 && p_data[id][P_XP] > 300000)
        {
            client_print(id,print_chat, "[sFx] You have reached your max level. Join our forums to unlock the rest of the levels. ")
            p_data[id][P_XP] = 290000
            p_data_b[id][PB_RESETSKILLS] = true;
        }
        else if(MAX_LEVEL == 16 && p_data[id][P_XP] > 350000)
        {
             client_print(id,print_chat, "[sFx] You have reached your max level. Join our forums to unlock the rest of the levels. ")
             p_data[id][P_XP] = 340000
             p_data_b[id][PB_RESETSKILLS] = true;
        }
        else if(MAX_LEVEL == 17 && p_data[id][P_XP] > 400000)
        {
             client_print(id,print_chat, "[sFx] CONGRATS FROM THE [sFx] COMMUNITY ON YOUR LEVEL 17. ") 
        }
    } 
    if( !in_file )
    {
        if(p_data[id][P_XP] > 200000)
        {
            client_print(id,print_chat, "[sFx] You have reached your max level. Join our forums to unlock the rest of the levels. ")
            p_data[id][P_XP] = 190000
            p_data_b[id][PB_RESETSKILLS] = true;
       }
    }
    // Free the handle
    SQL_FreeHandle( query );
 }
i just dont know how to make it read the info and see if the user is in the database and i dont know how to make it read the allowed_level
whosyourdaddy is offline
Old 08-30-2008, 16:35
whosyourdaddy
This message has been deleted by whosyourdaddy.
Reply


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 03:06.


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