Raised This Month: $ Target: $400
 0% 

sql problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
CipryXXX
Junior Member
Join Date: Apr 2007
Location: Romania
Old 06-04-2007 , 09:04   sql problem
Reply With Quote #1

i tryd to make for me a punish sistem like v3x`s but i wanted mine with sql but i cant compile the plugin
pls help me with this problem i dont know why i get this errors
:
Code:
/home/groups/amxmodx/tmp3/phpDQnORL.sma(16) : warning 213: tag mismatch
/home/groups/amxmodx/tmp3/phpDQnORL.sma(24) : error 017: undefined symbol "connect"
/home/groups/amxmodx/tmp3/phpDQnORL.sma(30) : error 035: argument type mismatch (argument 1)
/home/groups/amxmodx/tmp3/phpDQnORL.sma(42) : warning 204: symbol is assigned a value that is never used: "charname"
/home/groups/amxmodx/tmp3/phpDQnORL.sma(42) : warning 209: function "insert" should return a value
/home/groups/amxmodx/tmp3/phpDQnORL.sma(54) : error 017: undefined symbol "connect"
/home/groups/amxmodx/tmp3/phpDQnORL.sma(63) : error 035: argument type mismatch (argument 1)
/home/groups/amxmodx/tmp3/phpDQnORL.sma(72) : warning 204: symbol is assigned a value that is never used: "charname"
/home/groups/amxmodx/tmp3/phpDQnORL.sma(73) : warning 209: function "punish" should return a value
source :
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <dbi>

#define PLUGIN "Plugin"
#define VERSION "1.0"
#define AUTHOR "CipryXXX"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    set_task(0.1,"conexiune")
    set_task(1,"punish")
    register_concmd("amx_insert_nick","insert",ADMIN_LEVEL_C,"Inserts a players nickname in the punish user database")
}
public insert(id)
{
    new name[100]
    new charname
    charname = get_user_name(id,name,99)
    if (connect == SQL_FAILED)
    {
        return PLUGIN_HANDLED;
    }
    else
    {
        new Result:result = dbi_query("INSERT INTO user (nume) VALUES ('%s')",charname)
        if(result == RESULT_FAILED)
        {
            log_amx("[MySQL] Coud not insert username in data base!!")
        }
        else
        {
            return PLUGIN_HANDLED;
        }
    }
            
    
}
public conexiune()
{
    new error[255]
    new Sql:connect = dbi_connect("localhost","root","","ban",error,254)
    if(connect==SQL_FAILED)
    {
        log_amx("[MySQL] SQL Connection Failed = %s", error)
    }
}
public punish(id)
{
    if (connect == SQL_FAILED)
    {
        return PLUGIN_HANDLED;
    }
    else
    {
        new name[100]
        new charname
        charname = get_user_name(id,name,99)
        new Result:result = dbi_query("SELECT nume FROM user WHERE nume = '%s'",charname)
        if(result == RESULT_FAILED)
        {
            log_amx("[MySQL] Select username failed!!")
        }
        else
        {
            set_user_health(id,1) //not finished.
        }
    }
}
CipryXXX is offline
Send a message via Yahoo to CipryXXX
 



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


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