Duh...this is my first time when i use "
dbi" lol , but with wiki i've maded this...
Code:
#include <amxmodx>
#include <dbi>
#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"
new Sql:Dbc;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say /money", "ShowMoney");
}
public plugin_cfg()
{
Dbc = dbi_connect("localhost", "login", "password", "db");
if(Dbc == SQL_FAILED)
{
dbi_close(Dbc);
return;
}
}
public plugin_end()
dbi_close(Dbc);
public ShowMoney(id)
{
new szName[32];
get_user_name(id, szName, sizeof szName - 1);
new Result:HandleR, iResult;
HandleR = dbi_query(Dbc, "SELECT `money` FROM table where name='%s' ", szName);
while(dbi_nextrow(HandleR) > 0)
{
iResult = dbi_result(HandleR, "money");
}
if(iResult > 0)
client_print(id, print_chat, "%d", iResult);
}
__________________