PDA

View Full Version : This wont compile?


devicenull
03-29-2004, 19:47
#include <amxmodx>
#include <amxmisc>
#include <mysql>
new mysql //MySQL Connection
new sqlhost[64], sqluser[32], sqlpass[32], sqldb[32],sqlerror[256], sqlquery[256] //MySQL Connection Stuff
public plugin_init() {
server_cmd("exec addons/amxx/configs/mysql.cfg")
register_plugin("MySQL Bans","0.1","devicenull")
register_concmd("mysql_ban","permban",ADMIN_BAN," Permanant ban someone")
set_task(float(10),"initmysql")
}

public initmysql() {
get_cvar_string("amx_mysql_host",sqlhost,64)
get_cvar_string("amx_mysql_user",sqluser,32)
get_cvar_string("amx_mysql_pass",sqlpass,32)
get_cvar_string("amx_mysql_db",sqldb,32)
mysql = mysql_connect(sqlhost,sqluser,sqlpass,sqldb,s qlerror,256) //Connect to sql database
if (sqlerror[0]) {
server_print("[NSX] Mysql error: %s",sqlerror)
}
}

public permban(id) {
if (!(get_user_flags(id)&ADMIN_BAN)) {
console_print(id,"[NSX] Access Denied")
return PLUGIN_HANDLED
}
if (get_argc() <= 1) {
console_print(id,"[NSX] amx_pban <player>")
return PLUGIN_HANDLED
}
new pid = cmd_target(id,target,9)
if (!pid) {
// Possibly ban anyway with seperate flag?
console_print(id,"[NSX] Player Not Found")
return PLUGIN_HANDLED
}
new authid[32], name[32], uname[32], uauth[32] query[128], result[128], echo[128], args[256]
new reason[256]
read_args(args,256)
for (new i = 0; i<=256;i++) {
if (isspace(args[i]) {
new c = i
i = 256
}
}
i = 1
new a = 1
while (args[i]) {
reason[a] = args[i]
}
get_user_authid(pid,authid,32)
get_user_authid(id,uauth,32)
get_user_name(pid,name,32)
get_user_name(id,uname,32)
format(query,128,"INSERT INTO `bans`( `id` , `name` , `reason` ) VALUES(`%s`,`%s`,`%s`),authid,name,reason)
result = mysql_query(mysql,query)
if (result != 0) {
console_print(id,"[NSX] %s (%s) was sucessfully banned.",name,authid)
switch(get_cvar_num("amx_show_activity"))
{
case 1: client_print(0,print_chat,"[NSX] Admin banned %s",name)
case 2: client_print(0,print_chat,"[NSX] %s banned %s",uname,name)
}
server_cmd("banid ^"0^" ^"%s^"; wait; writeid")
format(echo,128,"echo [NSX] You have been permanantly banned by %s because %s",uname,reason)
client_cmd(pid,echo)
client_cmd(pid,"disconnect")
}
else {
server_print("[NSX] Error adding ban")
return PLUGIN_HANDLED
}
log_amx("PermaBan: %s (%s) banned %s (%s) reason: %s -> Ban added to mysql database",uname,uauth,name,authid,reason)
}
return PLUGIN_HANDLED
}

Why wont that compile

BigBaller
03-29-2004, 19:50
#inclde <amxmodmisc>

hehe use #include <amxmisc>

devicenull
03-29-2004, 19:53
Still compiles to an empty file: Compiler gives me this error
Assertion failed: !_pushed, file sc2.c, line 1214
ABNORMAL TERMINATION

BigBaller
03-29-2004, 19:56
return PLUGIN_HANDLED
}
log_amx("PermaBan: %s (%s) banned %s (%s) reason: %s -> Ban added to mysql database",uname,uauth,name,authid,reason)
}
}

That is what you have at the bottom of the plugin

Try

return PLUGIN_HANDLED
}
log_amx("PermaBan: %s (%s) banned %s (%s) reason: %s -> Ban added to mysql database",uname,uauth,name,authid,reason)
}
return PLUGIN_CONTINUE
}

or use PLUGIN_HANDLED

w/e is your desire effect.

EDIT

When either using return PLUGIN_HANDLED or CONTINUE it will compile and return the .amx file as 0 bytes.

devicenull
03-29-2004, 19:58
Did and still nothing
Still is an empty plugin

CheesyPeteza
03-29-2004, 20:48
format(query,128,"INSERT INTO `bans`( `id` , `name` , `reason` ) VALUES(`%s`,`%s`,`%s`),authid,name,reason)
result = mysql_query(mysql,query)


You forgot the last double quote.