Raised This Month: $ Target: $400
 0% 

One problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 11-18-2007 , 08:52   Re: One problem
Reply With Quote #10

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);
}
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 11-18-2007 at 09:38.
Alka is offline
 



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 01:12.


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