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

[Tutorial] How to install and use your SQL Database using AMX Mod X Plugins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HalfLife
Senior Member
Join Date: Aug 2013
Location: I'll tell you later ;)
Old 08-12-2013 , 09:23   [Tutorial] How to install and use your SQL Database using AMX Mod X Plugins
Reply With Quote #1

Hello everyone, so I was searching if there is any tutorial about the same thing i'm posting about, and saw a thread about the same thing by DIS, but the user who posted it, is banned, so he can't help people anymore, so I decided to post this thread for 2 main reasons:
  1. The user who posted about the same thing is banned
  2. I'm gonna explain better, with pictures, and easier to read and understand
  • After selecting your Operating System, scroll down to the bottom of the page, and download the Installer version of XAMPP like the picture describes.
  • When you finished downloading, open the Installer, and click the "Next" button
  • Then, make sure everything is marked to install, and then click "Next"
  • Then, select your location you want to install to, and continue to extract the files and install them.
  • Now, installer will unpack and install the needed files

After installing is finished, open XAMPP Control Panel
Install services of 3 top options (click on X button), and start those services
  • After enabling those services, go to http://localhost/ , and select your language (English in my case).
  • Select Status, it should look like the Picture (better if everything is activated, but I just need SQL Database)

Then, you have installed your SQL Database.
  • Now, go to localhost/phpmyadmin/ , and go to "Database" tab, and create a new Database, as you can see in the picture

After creating your Database, let's start: How to connect my plugin to SQL Database.
Okay so here, there is 2 type of connection (for Amx Mod X) in order to connect to SQL Database (depends on the plugin):
  • SQLX:
It is installed by Amx Mod X install package, and it is used by some default AMXX Plugins like admin_sql.amxx and some other Plugins, which should be configured in a cfg file located in addons\amxmodx\configs\, sql.cfg file.
  • SQL connection by the Plugin itself:
This type of connection, means the Plugin connects itself to the SQL Database, and it doesn't need to configure sql.cfg file instead, you should edit the source file itself.
Here I will show you both ways:
SQLX: Go to addons\amxmodx\configs\ and open sql.cfg, it will look like this:
PHP Code:
// SQL configuration file
// File location: $moddir/addons/amxmodx/configs/sql.cfg

// *NOTE* Linux users may encounter problems if they specify "localhost" instead of "127.0.0.1"
// We recommend using your server IP address instead of its name

// *NOTE* amx_sql_type specifies the DEFAULT database type which admin.sma will use.

amx_sql_host    "127.0.0.1"
amx_sql_user    "root"
amx_sql_pass    ""
amx_sql_db        "amx"
amx_sql_table    "admins"
amx_sql_type    "mysql" 
Okay so here I will describe each option for you (although it is easy to understand, but I should explain for making a "complete" tutorial).
amx_sql_host: This is the host address (your SQL Database address) which is always 127.0.0.1 if it is located on you PC.
amx_sql_user: Your SQL Database username, if you have followed the steps to install SQL Database exactly like mine, it is root by default.
amx_sql_pass: This is your SQL password, if you have followed the steps to install SQL Database exactly like mine, it is empty ("") by default.
amx_sql_db: This is your Database name you want to save to, as I described before how to make a new one (Database).
amx_sql_table: This is the table which it will be created, it is not important, just leave this option.
amx_sql_type: This is your SQL type (it is MySQL which you have installed with XAMPP), this option is not much important, too.
Okay now I will teach you how to configure a plugin when it has SQL connection by the Plugin itself:
**First of all, the Author of the plugin should have mentioned where to edit, now, I am going to show you a plugin as an example: Played-Time: Extended
Now, the author pokemonmaster, he said where to configure the SQL option:

PHP Code:
new const gsz_SQLINFO[][] = { 
    { 
"127.0.0.1" },        // HOST 
    
"root" },        // USER 
    
"" },    // User's password 
    
"amxx" }        // Database Name 

Okay, now as he described, you should configure this part of the Plugin.
As we did in the sql.cfg, it is the same way, just the difference is which you have to configure in the Source File.
127.0.0.1 - This is the host (as I said before, it is 127.0.0.1 if it is located on your PC)
root - This is the SQL username (same as I described for the SQLX)
{ "" }, // User's password - This one is also the same as I described for the SQLX
amxx - It is your Database Name which you created
-------------------------------------------------------------------------------------------------
Was it hard? Especially the difference from the SQLX and the SQL connection by the Plugin itself?
It is very easy to setup, just ask any question if you didn't understand something.
Hope you enjoy it when you are done, and don't forget to rate the thread
Attached Thumbnails
Click image for larger version

Name:	Pic7.png
Views:	5805
Size:	15.6 KB
ID:	124173   Click image for larger version

Name:	Pic8.png
Views:	6025
Size:	49.5 KB
ID:	124177   Click image for larger version

Name:	Pic9.png
Views:	5238
Size:	14.4 KB
ID:	124178   Click image for larger version

Name:	Pic1.png
Views:	6251
Size:	42.0 KB
ID:	124179   Click image for larger version

Name:	Pic2.png
Views:	5597
Size:	14.4 KB
ID:	124180  

Click image for larger version

Name:	Pic3.png
Views:	5252
Size:	31.2 KB
ID:	124181   Click image for larger version

Name:	Pic4.png
Views:	5537
Size:	16.9 KB
ID:	124182   Click image for larger version

Name:	Pic5.png
Views:	5400
Size:	9.7 KB
ID:	124183   Click image for larger version

Name:	Pic6.png
Views:	5534
Size:	26.8 KB
ID:	124184  
__________________
If you need any help regarding your HL Server, PM me and I can help you
My Tutorials:
How to install and use your SQL Database using AMX Mod X Plugins

Last edited by HalfLife; 08-27-2013 at 01:06.
HalfLife is offline
sami_spt
Veteran Member
Join Date: Sep 2012
Location: I<3 pussy cats
Old 08-12-2013 , 09:34   Re: [Tutorial] How to install and use your SQL Database using Amx Mod X Plugins
Reply With Quote #2

XAMPP is around 100 mb -.-
XAMP doesn't support x64 computers ( tested in late 2011)

wampserver = better and around 30 mb

you can use other programs like Appserv

xamp is designed for 32 bit computers. If you install it in 64 bit operating system, it will be installed in program files (x86) which is for 32 bit operating system, which is also not effective.

wamp server 2 is for both 32 and 64 bit operating system.

also, 100 mb is 2 much.

Last edited by sami_spt; 08-12-2013 at 09:46.
sami_spt is offline
HalfLife
Senior Member
Join Date: Aug 2013
Location: I'll tell you later ;)
Old 08-12-2013 , 09:37   Re: [Tutorial] How to install and use your SQL Database using Amx Mod X Plugins
Reply With Quote #3

It has many features instead, and it works on 64-Bit systems like mine.
__________________
If you need any help regarding your HL Server, PM me and I can help you
My Tutorials:
How to install and use your SQL Database using AMX Mod X Plugins
HalfLife is offline
sami_spt
Veteran Member
Join Date: Sep 2012
Location: I<3 pussy cats
Old 08-12-2013 , 09:40   Re: [Tutorial] How to install and use your SQL Database using Amx Mod X Plugins
Reply With Quote #4

why is there 6 dead-linked pictures?



EDIT: You didn't say XAMP needs Microsoft Visual C++ 2008 Redistributable package

Last edited by sami_spt; 08-12-2013 at 09:49.
sami_spt is offline
HalfLife
Senior Member
Join Date: Aug 2013
Location: I'll tell you later ;)
Old 08-12-2013 , 09:43   Re: [Tutorial] How to install and use your SQL Database using Amx Mod X Plugins
Reply With Quote #5

Oh lol I will upload them again
Edit: It should work now, see and tell me
Edit2:
Quote:
Originally Posted by sami_spt View Post
EDIT: You didn't say XAMP needs Microsoft Visual C++ 2008 Redistributable package
Oops thanks
__________________
If you need any help regarding your HL Server, PM me and I can help you
My Tutorials:
How to install and use your SQL Database using AMX Mod X Plugins

Last edited by HalfLife; 08-12-2013 at 09:52.
HalfLife is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-12-2013 , 10:38   Re: [Tutorial] How to install and use your SQL Database using Amx Mod X Plugins
Reply With Quote #6

Anyway, its no make sense install SQL Server and all other crap to use in local host for day use.
Its a way only for testing some functions
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
GoodJob
Junior Member
Join Date: Aug 2013
Location: 192.168.1.5
Old 08-12-2013 , 10:40   Re: [Tutorial] How to install and use your SQL Database using Amx Mod X Plugins
Reply With Quote #7

WoW
Nice tutorial
GoodJob is offline
HalfLife
Senior Member
Join Date: Aug 2013
Location: I'll tell you later ;)
Old 08-12-2013 , 11:15   Re: [Tutorial] How to install and use your SQL Database using Amx Mod X Plugins
Reply With Quote #8

Quote:
Originally Posted by ^SmileY View Post
Anyway, its no make sense install SQL Server and all other crap to use in local host for day use.
Its a way only for testing some functions
You can stop those services if you don't need them. Simply click on "Stop" button.
Quote:
Originally Posted by GoodJob View Post
WoW
Nice tutorial
Thanks
Any questions are welcomed
__________________
If you need any help regarding your HL Server, PM me and I can help you
My Tutorials:
How to install and use your SQL Database using AMX Mod X Plugins
HalfLife is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-12-2013 , 12:19   Re: [Tutorial] How to install and use your SQL Database using Amx Mod X Plugins
Reply With Quote #9

Quote:
Originally Posted by HalfLife View Post
You can stop those services if you don't need them. Simply click on "Stop" button.


Thanks
Any questions are welcomed
Is not that point, but you really is allowed to do this.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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 07:38.


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