Mysql problem ? -
anou1 - 07.01.2014
I followed this tutorial :
https://sampforum.blast.hk/showthread.php?tid=485633
My pastbin is :
http://pastebin.com/cz6BA7v0
When I connect into the game, it always show me that my account is not registred, so I think that when I disconnect, it doesnt save. Is there a problem in the code ?
How Can I save player's data ?
PS: How can I spawn a player with his last position ?
I think that I have to place my code into OnPlayerSpawn but how should I proced ?
Maybe with this:
Код:
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);
Thank you ! =)
Re: Mysql problem ? -
Loot - 07.01.2014
Have you tried debugging the SELECT query? (check log to see what name passed through the query itself)
Quote:
Originally Posted by anou1
PS: How can I spawn a player with his last position ?
|
Simply save the last known x/y/z of his current position and load upon logging in, then teleport him to his coordinates.
pawn Код:
SetPlayerPos(playerid, pInfo[playerid][posX], pInfo[playerid][posY], pInfo[playerid][posZ]);
Re: Mysql problem ? -
Wizzy951 - 07.01.2014
There is a position saver in my signature, check the code I hope it will help you.
Re: Mysql problem ? -
anou1 - 07.01.2014
Thank you, but I want to learn a little too, so I want to correct my code, not only Copy/Paste your FS ^^
Is anyone have an idea to fix my problem ?
And if you can, explain me my errors please.
Thank you !
Re: Mysql problem ? -
Konstantinos - 07.01.2014
In OnDialogResponse, change the query's size from 300 to 316. It's not enough to store the whole query, thus it fails and you need to re-register.
I'd also recommend you to check the file
login_system-cache from:
https://sa-mp-mysql-plugin.******cod...le_scripts.rar
Re: Mysql problem ? -
anou1 - 07.01.2014
Thank you guy !!
I will check the file login_system_cache thank you
PS: If you have the time, could you please explain me, how did u calculate the query size ?
Thank you !
Re: Mysql problem ? -
Konstantinos - 07.01.2014
pawn Код:
INSERT INTO `joueurs` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Argent`, `posX` ,`posY`, `posZ`) VALUES ('', '', '', 0, 0, 0, 0.0, 0.0, 0.0)
146 (the above, without placeholders) + 1 (NULL termination character) + 24 (player's name) + 129 (player's hashed password) + 16 (player's IP) = 316 characters.
Re: Mysql problem ? -
anou1 - 07.01.2014
Thank you,
So everytime I will add a data that I want to save, I will have to increase the query size ?
Re: Mysql problem ? -
anou1 - 08.01.2014
UP
How can I spawn a player to his old position when he spawn ?
Thank you
Re: Mysql problem ? -
HardRock - 08.01.2014
Under onplayespawn
PHP код:
SetPlayerPos(playerid, pInfo[playerid][posX], pInfo[playerid][posY], pInfo[playerid][posZ]);