Raised This Month: $ Target: $400
 0% 

amxmodx 1.01 plugin using dbi


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
onosrider
Member
Join Date: Jul 2005
Old 09-16-2005 , 02:00  
Reply With Quote #7

after reading devicenul's sql tut and testing and whining and ... im happy to have a working sql plugin for amxx 1.01

thanks

Code:
#include <amxmodx> #include <dbi> new Sql:dbc new Result:result public plugin_init() {     register_plugin("my stupid sql qurry","0.0.0","myhand")     register_clcmd("say /rank","CheckMySats")     register_cvar("mysql_host","127.0.0.1")     register_cvar("mysql_user","user")     register_cvar("mysql_pass","password")     register_cvar("mysql_db","psychostats")     set_task(Float:10.0,"sql_init") } public sql_init() {     new host[64], username[32], password[32], dbname[32], error[32]     get_cvar_string("mysql_host",host,64)     get_cvar_string("mysql_user",username,32)     get_cvar_string("mysql_pass",password,32)     get_cvar_string("mysql_db",dbname,32)     dbc = dbi_connect(host,username,password,dbname,error,32)     if (dbc == SQL_FAILED)         log_amx("[AMXX] RANK SQL Connection Failed") } public CheckMySats(id) {     if (dbc == SQL_FAILED)     return PLUGIN_HANDLED         new authid[32]         new username[64]         get_user_authid(id, authid, 32)         get_user_name(id, username, 64)                 result = dbi_query(dbc,"SELECT rank FROM pstats_plr WHERE worldid='%s'",authid)         for (new i=1;i<=dbi_num_rows(result);i++) {         new rank[32]         dbi_nextrow(result)         dbi_result(result,"rank",rank,32)         client_print(id,print_chat,"[RANK] %s is RANK %s",username,rank)         }     dbi_free_result(result)     return PLUGIN_HANDLED }
onosrider 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 14:21.


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