| CipryXXX |
06-04-2007 09:04 |
sql problem
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.
}
}
}
|