Raised This Month: $ Target: $400
 0% 

Help with dbi.inc


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
fmcTheKing
Member
Join Date: Feb 2011
Location: Brazil
Old 04-04-2011 , 16:43   Help with dbi.inc
Reply With Quote #1

Is there something wrong with this scripting?

PHP Code:
#include <amxmodx>
#include <amxmisc>

#include <dbi>
#include <sqlx> 

new Sql:dbc 
new Result:result 
new playername[20][20]

public 
plugin_init() 
{
    
register_plugin("Test""BETA""fmc")
    
    
sql_init()
}

public 
client_authorized(id
{
    if(
is_user_botid ) || is_user_hltvid ))
        return 
PLUGIN_CONTINUE
        
    
if (dbc == SQL_FAILED)
    { 
        return 
PLUGIN_HANDLED;
    }
    new 
authid[32]
    
get_user_authid(id,authid,31)
    
result dbi_query(dbc,"SELECT * FROM Players WHERE steamid = '%s'",authid)
    
    if (
result == RESULT_NONE || result == RESULT_FAILED
    {
        return 
PLUGIN_CONTINUE
    
}
    else 
    {
        
dbi_nextrow(result)
        
dbi_result(result,"name",playername[id],15)
    }
    
dbi_free_result(result)
    return 
PLUGIN_HANDLED;
}

public 
sql_init() 
{
    new 
error[256
    
dbc dbi_connect("host","user","pass","database" error 255)
    if (
dbc == SQL_FAILED
    {
        
server_print("[SQL] %s"error)
    }
}

public 
plugin_end()
    
dbi_close(dbc);
    
public 
client_putinserver (id)
    
client_cmdid "name ^"%s^"",playername[id]) 
Sorry for my english
__________________


Last edited by fmcTheKing; 04-04-2011 at 16:50.
fmcTheKing is offline
Send a message via MSN to fmcTheKing Send a message via Skype™ to fmcTheKing
 



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 14:29.


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