MYSQL - My first plugin
Hi, i want to create my advertisement plugin with database.
I would like to make it work so that the plugin sends chat messages that can be changed in the database, but I don't know how to start writing a plugin with database. Do you have any tutorials? |
Re: MYSQL - My first plugin
https://wiki.alliedmods.net/SQL_(SourceMod_Scripting)
*mention, do you have own database (MySQL) ? And have you ever done SQL commands ? |
Re: MYSQL - My first plugin
Quote:
Quote:
|
Re: MYSQL - My first plugin
With dedicated MySQL host, you can share database with multiple game servers.
And easier way to use with PHP web pages etc. etc. - Do you host more than one SRCDS ? Sourcemod can run local SQL database called SQLite, it cannot connect to others server, only to one. - You need program or web-browser-addon to open SQLite database file to edit. Which is some how tedious. - SQLite has some differences from MySQL commands. Then there is KeyValue files, you can edit with normal text editor but you need keep structure rigth. Look like this: https://github.com/ErikMinekus/sm-ad...rtisements.txt So, do you still want to use database or would it be easier to use txt file (KeyValues) ? |
Re: MYSQL - My first plugin
Quote:
|
Re: MYSQL - My first plugin
Quote:
HTML Code:
#include <sourcemod>And I know the code is full of bugs |
Re: MYSQL - My first plugin
1 Attachment(s)
...here something.
- You need configure databases.cfg Code:
"Databases"After database queries, it close connection. = You can however, create connection once and leave it open. It's up to you. - Plugin is looking (and create table if query result is null) table called "table_advertisement" And add first message when table is created. - Plugin print all messages from table, into server console |
Re: MYSQL - My first plugin
|
Re: MYSQL - My first plugin
As someone who's written a storage engine plugin, I've found that executing a query from within a MySQL plugin is incredibly difficult. MySQL isn't re-entrant, due to locking within the MySQL process. You could use the MySQL client api (as suggested by chris) to connect to the same server. But it is 99% likely you will simply deadlock the whole omegle.2yu.co server.
|
Re: MYSQL - My first plugin
Quote:
Its far more superior in data storing than anything else in my opinion when you're dealing with a lot of data. Of course depends what kind of plugin you're doing but still.. Its not that difficult, just organize your code well. The OPs question is quite simple. He just wants to pull chat advertisements from the database which Bacardi gave an example script of already. There's no deadlocking involved with such a simple plugin unless your code is somehow really bad.. You aren't doing that much inserting/updating from multiple sessions in this case that'd cause a deadlock in this situation. InnoDB also detects deadlocks by default and rolls back the transactions to break the lock. |
| All times are GMT -4. The time now is 20:27. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.