| Magnetronkip |
01-19-2009 10:00 |
[HELP] With SQL plugin
Hi
i am making a plugin that should check the steamid of a user in a database. when the steamid is in the database the plugin will do nothing. when the steamid isn't in the database it wil give a kick. but i can't get it working the plugin is compiling and loaded at the server but it doesn't work...
Can somebody help me please ?
PHP Code:
public check_delayed(parm[])
{
//Load database connection function
sql_init()
//Get connecting clients steamid and ipadress
new client_steamid[40]
get_user_authid(parm[0],client_steamid,50)
new client_ip[16]
get_user_ip(parm[0],client_ip,15,1)
new client_name[40]
get_user_name(parm[0],client_name,40)
//Send a message to the server that a check is starting
server_cmd("amx_say [SceneShockers Skillat Servert] Checking if %s is in the database.",client_name)
//Format the database querry
new query[256]
format(query,255,"SELECT steamid,nickname FROM players WHERE steamid='%s'",client_steamid)
//Execute querry
dbi_query(mysql,query);
new merror[64]
dbi_error(mysql,merror,63)
//If an error occured
if (merror[0])
{
server_print("amx_say [SceneShockers Skillat Servert] MYSQL error: %s",merror)
return PLUGIN_CONTINUE
}
if (res <= RESULT_NONE) {
server_cmd("amx_say [SceneShockers Skillat Servert] Checking if %s is in the database.",client_name)
server_cmd("amx_say [SceneShockers Skillat Servert] %s is in the database.",client_name)
}else {
server_cmd("amx_say [SceneShockers Skillat Servert] %s wasn't in the database. Get out...",client_name)
client_cmd(parm[0],"echo ^"[SceneShockers Skillat Servert] Your SteamID has no access to this servert!.^"")
client_cmd(parm[0],"echo ^"[SceneShockers Skillat Servert] This is an skillat people only servert!^"")
client_cmd(parm[0],"disconnect")
dbi_free_result(res)
}
if (mysql == SQL_OK)
{
dbi_close(mysql)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
*EDIT*
Oke i changed the code, but it still isn't working. i still can connect to the server and it will say that my steamid is in the database but it isnt... please help me :(!
|