MySQL instructions

Posted By: Razoron

MySQL instructions - 05/26/09 12:36

Hey guys,

does anybody know any mysql instructions to change some data for example in table accounts, column 5, row 19 too 29.
Is there any instruction?
And is it right that i can only use session_open and session_connect on Pro Edition for 850€ <.<?
I only buy commercial or extra edition for that.
Posted By: Dark_samurai

Re: MySQL instructions - 05/26/09 15:33

You can buy the extra edition or even use the free lite-c edition and buy my ANet Proffessional plugin. It offers you the possiblity to use http post. This way you can call a php script that does all the mysql stuff for you. This is more secure then the direct access to the database.

php is very easy and the syntax is almost the same. All you need to know is how you can connect with a mysql database and therefor you will only need 3-5 lines of code.

So if you use the lite-c free edition, the whole thing will cost you only 90€. And ANet additionally offers you much more multiplayer features like VoIP, FTP,... For more informations look into the link of my signature.
Posted By: Razoron

Re: MySQL instructions - 05/27/09 12:25

i know ftp and mmorpg dbs because i had already an mmorpg server^^
(Flyff p-server)
plugin sounds greate.
Do i only have to put anet.dll, anet and anet_h in the game directory and include them in my srcipt?
do i get with pro anet edition unlimited clients?
ich glaube wir können uns in deutsch unterhalten
i have only 30-day trial version from gs7.
does it only work on bought versions?
ftp is nice for patches, etc..
Posted By: Abstracto

Re: MySQL instructions - 05/28/09 09:57

You can use anet.dll or any other dll if you use lite-c, i think.
anyway you will need to use a SQL sentence.
About SQL, read the mySQL manual, on the reference you can find UPDATE keyword, used to modify a row on the database.
You can do something like:

UPDATE tablename
SET column5_name= new_value
WHERE row_id BETWEEN 19 AND 29 ;

you should change tablename, column5_name, new_value for your database.
row_id is your primary key on this table, but you can change te condition to anything,
i hope this helps.




Posted By: Dark_samurai

Re: MySQL instructions - 05/28/09 15:33

@Razor:
ANet Pro allows you to use unlimited clients.
Yes, all you have to do is putting the plugin in your plugin_dir (see manual) and include the anet.h file.
The manual explains all the functions that are available. For starting with ANet, best would be to download the simple 3d chat tutorial.

Yes it should also work with the 30 days trail edition (but only the ANet Free version). The free version and all the information are available on my homepage (see signature).
Posted By: Razoron

Re: MySQL instructions - 05/29/09 19:20

when u could give me an example for:
1.Is the STRING*s in column name?
2.If not, create a new row with the string in column name.
3.If the string already exists, call a function.
4.Delete a row.
I'll think of buying pro version.
Posted By: Dark_samurai

Re: MySQL instructions - 05/30/09 13:54

With ANet it would work this way:
Lite-C+ANet:
Code:
http_init();
//Call add.php and overgive a string s with the content "Blabla"
http_post(_str("http://www.host.com/add.php"),_str("s=Blabla"));


add.php:
Code:
<?php
//Get the content of 's':
string_s = _POST['s'];
?>


Now you only need to do the mysql instructions. But I'm not an expert of php. Best would be to ask this question in a php forum.

Btw. if you need the mysql thing for an internet server list, ANet Pro offers you a ready made template with all php scripts, lite-c scripts and a "How to set up everything".
Posted By: TSG_Torsten

Re: MySQL instructions - 05/30/09 14:29

Hi,

it's easily to do something like this in php. As Dark_samurai already mentioned, you have to do an http_post instruction to call a php script.
You may also could use the bigdll from Timo Stark to call HTTP-GET request, I don't know what kind of requests ANet does send, may HTTP-POST request, that would be much better.

The script may could look like this:

add.php:
Code:
<?
mysql_connect("server_adress","user,"pw") or die("error, could not connect to mysql-server");
$search=$_GET["s"]; // get the searched query (if not, try $_POST)
$row_name="row"; // insert the row name, where to search
$table_name="table"; // Insert the table name
$link=mysql_query("SELECT * FROM $table_name WHERE $row_name LIKE '$search'");
if($link && $a=mysql_fetch_object($link)) // found!
echo "1"; // Give out 1, means the string is found
else
{
mysql_query("INSERT INTO $table_name VALUES ...");
echo "0"; // Give out 0, means the string was not found but was insert now
}
?>


btw., deleting looks like this:
Code:
mysql_query("DELETE FROM $table_name WHERE $row_name LIKE '$search'");


Regards
TSGames


Posted By: Razoron

Re: MySQL instructions - 05/30/09 15:56

i have to learn php then.
but i think it's easy to learn.
I think i'll buy it soon.
thx guys
Posted By: Dark_samurai

Re: MySQL instructions - 05/31/09 08:00

Yes, ANet uses a HTTP-Post request.
Posted By: Razoron

Re: MySQL instructions - 06/02/09 12:09

and how to get for example pos_x in the table x, where acc="andavos"?
Posted By: TSG_Torsten

Re: MySQL instructions - 06/02/09 19:37

SELECT pos_x FROM table_x WHERE acc LIKE 'andavos'

May you should get some experience in the SQL-Synatx language.

Regards
TSGames
Posted By: Carlos3DGS

Re: MySQL instructions - 06/22/09 19:16

I have been playing around with lite-c for a few months and wanted to try out a mutiplayer rpg now that I feel at home with this language. I have finally bought A-Net today and will start with that manual tonight.

I would also need a database for my game and have a few questions. My database is not for serverlists, it is for items/players/mobs/skills stats and stuff like that. My game server will be on one computer on my lan and my mysql server will be on another computer also on my lan, the clients will conect from internet (I have set up port forwarding on my router to my game server computer).

I do not know anything about php, but what I do know is that I do not want clients to access my database, only the server will. The game server and the database server will both be on the same lan (not accessed through internet, because i need direct fast access through lan since there will be lots of traffic. For example: each time a player attacks I have to do several "selects", one on the player database for his attributes and equipped weapon, then on the weapons database for the damage, (do calculations with player str, dex and weapon damage), and then again another select on the player database for the defenders attributes and equipped armour, and again on the items database for the armor properties and do final calculations with defender's dex, constitution and armor).

I have lots of experience with SQL as it was one of my courses at my university, but unfortunately I have no experience with php yet.
I was wondering... since I do not need my clients to access my database from the internet... could I connect my gs/anet server to mysql server on the same lan and pass it the queries directly withought having to use php?

(mabe it sounds like a stupid question because I still have not learned anet and have no idea of php)
Posted By: Damocles_

Re: MySQL instructions - 06/23/09 00:23

There was a MySQL plugin floating around somewhere.
As far as I know, ANet is has no connection interface to MySQL.

Using the databas is nice but not nessesary at the beginning of the development, as you can handle the basic stuff (prototype)
with 3dgs, using directly implemented data /calculations.

Getting the client/server protocol to run smothely is
harder than getting data excchange for the server and a database.
Posted By: Dark_samurai

Re: MySQL instructions - 06/23/09 15:58

A direct connection to MySQL is not supported, but over php you can easily get access.

Here a german site explaining php-sql programming in detail: http://www.schattenbaum.net/php/

But for php you will also need a webserver? (sorry, but I have no clue of how the servers have to be set up).
Posted By: Carlos3DGS

Re: MySQL instructions - 06/25/09 10:32

I have a few of questions.

-Can anyone point me to a MySQL plugin like that? (Lite-C to MySQL)

-do you know of a php-sql web like that but in english?

-In the ANet manual it says "the latest VC 2008 Redistributable Package must be installed", will the pc running the final client also need to install this?

-My server and client will be two different gs applications because I dont want them to have my server code. In the manual I read this
Quote:
"It's better to use Lite-C instead of C-Script. Some functions like enet_send_var cause much less traffic in Lite-C. In Lite-C you can only use clients and servers that are started with exactly the same version of your game. In C-Script, you can use different Versions."
but I also read this other thing in the manual
Quote:
"Please notice: If enet_send_var, enet_send_array or enet_send_string are used in Lite-C, all clients and the server has to be started with the same application (= the same source code)!
Please notice also that all clients and the server have to use the same scripting language!"
. So I wanted to know... if I use Lite-C, will those three functions be the only ones i cannot use? If there are more, what other functions will not work?
Posted By: Dark_samurai

Re: MySQL instructions - 06/25/09 11:06

Quote:
-Can anyone point me to a MySQL plugin like that? (Lite-C to MySQL)

This is the one from Joozey:
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=220503&page=1

Quote:
-do you know of a php-sql web like that but in english?


Google result: http://www.freewebmasterhelp.com/tutorials/phpmysql/2

Quote:
-In the ANet manual it says "the latest VC 2008 Redistributable Package must be installed", will the pc running the final client also need to install this?


This should be automatically be installed on all new pc's. The old ones have to install that, yes! But that would also be the same when anet would be written with older vc++ versions.

Quote:
-My server and client will be two different gs applications because I dont want them to have my server code.


Lite-C uses the handle of vars, arrays and strings by default. This causes less traffic then using the name of those elements. C-Script has no handle function like that => names are used by default. You can switch the Lite-C mode to also use the names with the function anet_use_handles().
But I would dehort you to use the variable names, better find a methode to protect your code so that they can't get access to the server code.
Posted By: Carlos3DGS

Re: MySQL instructions - 06/26/09 13:21

I had also found that plugin by Joozey, but it only connects to his own database which is not viable for this project. and also he said:
Originally Posted By: Joozey
It's suspended for an undefined amount of time.

Do you now of any other MySQL plugin?

Originally Posted By: Dark_samurai
You can switch the Lite-C mode to also use the names with the function anet_use_handles().
But I would dehort you to use the variable names, better find a methode to protect your code so that they can't get access to the server code.

Im afraid having the server code on the clients is not a good option. The code is compiled in ann exe and that would be sufficient to protect from the average user, but I would prefer not to have any part of the server code there for more advanced users.
I will take a look at the function anet_use_handles().

Thanks for the info smile
Posted By: Joozey

Re: MySQL instructions - 06/26/09 19:09

There's some older plugin made by desktop.
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=41744&page=1

Here a newer one by D3D:
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=267506
Posted By: Carlos3DGS

Re: MySQL instructions - 06/27/09 22:44

thankyou very much smile
Posted By: Carlos3DGS

Re: MySQL instructions - 06/28/09 19:49

Is the one by desktop only for c-script?

And the other one (by D3D) is for Lite-C but has all the links broken.
If you could send me the one by D3d that would be great.
© 2024 lite-C Forums