Raised This Month: $51 Target: $400
 12% 

[Req] Please Port & Upgrade StarScream's sqlcommands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pendragon
Senior Member
Join Date: Mar 2004
Location: In a bubble
Old 09-29-2005 , 19:29   [Req] Please Port & Upgrade StarScream's sqlcommands
Reply With Quote #1

As the subject says, I'd like for someone to please port over (again) Starscream's old sqlcommands plugin and if possible, look it over and make any corrections that need to be made.
The reason I ask the latter part is because I remember the first time I ported it over for myself (ages ago) it worked fine but didnt report every plugin's required flags. Some plugins had empty fields where their flags should have been entered in the db. I dont know why, so that made it kind of pointless since the point of the plugin is to read throough the commands list, search for the required flag to access that command, and put it all into a db.

Thank you ahead of time, attached is the original version (figure it'd be easier to start from scratch than to try and get my old crappy port to work - esp since its burried somewhere in my archive folder).

Thanks guys
Attached Files
File Type: sma Get Plugin or Get Source (sqlcommands.sma - 175 views - 3.7 KB)
__________________
pendragon is offline
Send a message via ICQ to pendragon
scriptyboy
BANNED
Join Date: Sep 2005
Old 09-29-2005 , 19:45  
Reply With Quote #2

you know i tried...with this code:

Code:
<?AMXMOD /*********************************************************************** * sqlcommands        version 1.0        November 3/2003 * By Tom L'Ecluse    alias: RpR / Starscream    <a href="mailto:[email protected]">[email protected]</a> * * This is just a plugin which will write all the commands in an sql database. * And with the php file you can open all the specified commands for that player. * I've created this plugin by using most of the code from * <a href="http://amxmod.net/forums/viewtopic.php?t=18902&highlight=list" target="_blank" rel="nofollow noopener">http://amxmod.net/forums/viewtopic.p...highlight=list</a> * I just created the SQL version and the php file. * And I need to say a big thx to kaksie because of his detailed comments * I finally got a grip of the amx programming :) * Ingame use say /commands to open a motd with the commands in it *************************************************************************/ #include <amxmodx> #include <amxmisc> #include <mysql> new mhost[64] new muser[32] new mpass[32] new mdb[32] new mysql = 0 public sql_init(){     //Get server and database info...     get_cvar_string("amx_sqlban_host",mhost,63)     get_cvar_string("amx_sqlban_user",muser,31)     get_cvar_string("amx_sqlban_pass",mpass,31)     get_cvar_string("amx_sqlban_db",mdb,31)     new merror[64]     mysql = mysql_connect(mhost,muser,mpass,mdb,merror,63)     if(mysql < 1)         server_print("[AMX][SQLCOMMANDS] MySQL error: could not connect : '%s'",merror)     else         server_print("[AMX][SQLCOMMANDS] Successfully connected to the database.")     return PLUGIN_CONTINUE } public writeinfo(){     sql_init()     new query[256]     format(query,255,"DELETE FROM `amx_commands`")     //Execute the querry     mysql_query(mysql,query)     new merror[64]     mysql_error(mysql,merror,63)                                 //If an error occures     if (merror[0]){         server_print("[AMX][SQLBAN] MYSQL error: %s",merror)         return PLUGIN_HANDLED     }           new oldcmd[32],sflags[32],info[128],cmd[32]     new flags,eflags     flags = read_flags("abcdefghijklmnopqrstuvwxyz")     new id = -1           new clcmdsnum = get_concmdsnum(flags,id)     get_flags(flags,sflags,31)     for (new i = 0; i < clcmdsnum; i++){         get_concmd(i,cmd,31,eflags,info,127,flags,id)         server_print("[AMX] Writing commands to sql. Progress: %d / %d",i+1,clcmdsnum)         get_flags(eflags,sflags,31)         if(!equal(oldcmd,cmd))         {             format(query,255,"INSERT into amx_commands (commands,description,flags) values ('%s','%s','%s')",cmd,info,sflags)                                   //Execute the querry             mysql_query(mysql,query)             mysql_error(mysql,merror,63)                                         //If an error uccures             if (merror[0]){                 server_print("[AMX][SQLBAN] MYSQL error: %s",merror)                 return PLUGIN_HANDLED             }                    }         copy(oldcmd,31,cmd)     }          return PLUGIN_CONTINUE } public show_commands(id){     new url[128]     new myflags,stringofflags[32]     myflags=get_user_flags(id)     get_flags(myflags,stringofflags,31)     format(url, 127, "http://www.fragfun.be/publicserver/commands.php?flags=%s",stringofflags)     show_motd(id,url,"Commands")     return PLUGIN_CONTINUE } public plugin_init() {    register_plugin("SQL commands","0.2","boadmin")    register_cvar("amx_sqlban_host","")    register_cvar("amx_sqlban_user","")    register_cvar("amx_sqlban_pass","")    register_cvar("amx_sqlban_db","")    register_clcmd("say /commands", "show_commands",0,"- displays the commands")    set_task(5.0,"writeinfo",0)    return PLUGIN_CONTINUE }

and got this error only:
Code:
//// sqlcommands.sma
// C:\WINDOWS\DESKTOP\SCRIPTING\sqlcommands.sma(18) : fatal error 100: cannot re
ad from file: "mysql"
scriptyboy is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-29-2005 , 19:52  
Reply With Quote #3

No offense but dont try this.
1) You need to include <dbi> not <mysql>
2) All the sql commands need to be changed to work with AMXX.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-29-2005 , 20:06  
Reply With Quote #4

This should work. I just ported it didnt test.

Last edited by Xanimos; 09-29-2006 at 07:57.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
pendragon
Senior Member
Join Date: Mar 2004
Location: In a bubble
Old 09-29-2005 , 20:07  
Reply With Quote #5

Quote:
Originally Posted by Suicid3
No offense but dont try this.
1) You need to include <dbi> not <mysql>
2) All the sql commands need to be changed to work with AMXX.
yeah i did. that's what made me come here because I realized that the after changing the obvious in the includes, I kept getting error messages for all the mysql commands. So I figured the sql commands where not the same anymore as when i first had it working.

Since im not an experienced coder, I decided to ask to see if someone would be up to the task.
pendragon is offline
Send a message via ICQ to pendragon
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-29-2005 , 20:13  
Reply With Quote #6

That was intended for boadmin, he just started looking at code last week i believe.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 09-29-2005 , 20:15  
Reply With Quote #7

Quote:
Originally Posted by Suicid3
That was intended for boadmin, he just started looking at code last week i believe.
This has inspired me to change the last sentence in my sig.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
pendragon
Senior Member
Join Date: Mar 2004
Location: In a bubble
Old 09-29-2005 , 20:16  
Reply With Quote #8

Quote:
Originally Posted by Suicid3
That was intended for boadmin, he just started looking at code last week i believe.
got it - im slow and tired

Quote:
Originally Posted by Suicid3
This should work. I just ported it didnt test.
Code:
[AMX][SQLCOMMANDS] Successfully connected to the database.
L 09/29/2005 - 17:18:47: [MYSQL] Invalid database handle 0
L 09/29/2005 - 17:18:47: [AMXX] Displaying debug trace (plugin "sqlcommands_DBD.amxx")
L 09/29/2005 - 17:18:47: [AMXX] Run time error 10: native error (native "dbi_query")
L 09/29/2005 - 17:18:47: [AMXX]    [0] sqlcommands_dbd.sma::writeinfo (line 49)
pendragon is offline
Send a message via ICQ to pendragon
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-29-2005 , 20:18  
Reply With Quote #9

he has in his code "DELETE FROM `amx_commands`"
try changing it to "DELETE * FROM `amx_commands`"
I neglected to look at his SQL code.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
pendragon
Senior Member
Join Date: Mar 2004
Location: In a bubble
Old 09-29-2005 , 20:21  
Reply With Quote #10

same error

Code:
[AMX][SQLCOMMANDS] Successfully connected to the database.
L 09/29/2005 - 17:24:34: [MYSQL] Invalid database handle 0
L 09/29/2005 - 17:24:34: [AMXX] Displaying debug trace (plugin "sqlcommands_DBD.amxx")
L 09/29/2005 - 17:24:34: [AMXX] Run time error 10: native error (native "dbi_query")
L 09/29/2005 - 17:24:34: [AMXX]    [0] sqlcommands_dbd.sma::writeinfo (line 49)
---------

+ Karma for trying, my friend.
pendragon is offline
Send a message via ICQ to pendragon
Reply



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 11:32.


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