Save then load [MYSQL]
#1

Hi all,


Do you know if it's possible to save something in sql then load it immediatly ?


Cause I'm trying to do this:

Код:
new rows, fields; 
cache_get_data(rows, fields, mysql);
pInfo[playerid][posX] = cache_get_row_float(0, 7);
pInfo[playerid][posY] = cache_get_row_float(0, 8);
pInfo[playerid][posZ] = cache_get_row_float(0, 9);
printf("%f %f %f",pInfo[playerid][posX], pInfo[playerid][posY], pInfo[playerid][posZ]);
But I always have 0.00000 0.0000 0.00000.



I tried this too:

Код:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `joueurs` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Argent`, `posX` ,`posY`, `posZ`, `Interieur`, `World`, `Skin`, `Niveau`) VALUES ('%e', '%s', '%s', 0, 0, 1000, 1527.5634, -1738.9218, 13.5469, 0, 0, 26, 1)", Name[playerid], pInfo[playerid][Password], IP[playerid]);
mysql_tquery(mysql, query, "", "");

mysql_format(mysql, query, sizeof(query), "SELECT posX FROM joueurs WHERE `Username` = '%s' ", Name[playerid]);
mysql_tquery(mysql, query, "", "");
printf("%f",pInfo[playerid][posX]);
I still have 0.000000

But I don't know how can I recover posX when it have been selected from the database.


Thank you ! (:
Reply
#2

You don't need to save and then load something from MySQL immediately. MySQL is typically initiated when loading certain things (I.E accounts, businesses, etcetera). Use the variables that you use to save into the MySQL.
Reply
#3

Sorry i'm new in pawn
But in my "GM" when you register on the server the first time, it saves your account informations like spawn position, money etc then it load positions to spawn you,skin, and money.

My save system works, but I can't load the informations that I previously saved.


Is there a way to do it ?

Thank you
Reply
#4

There are ways to do it, I strongly urge you to search up some tutorials for MySQL, I am not the greatest teacher in the world.
Reply
#5

SOLVED

Thank you !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)