Mysql problem ?
#1

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 ! =)
Reply
#2

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]);
Reply
#3

There is a position saver in my signature, check the code I hope it will help you.
Reply
#4

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 !
Reply
#5

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
Reply
#6

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 !
Reply
#7

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.
Reply
#8

Thank you,

So everytime I will add a data that I want to save, I will have to increase the query size ?
Reply
#9

UP

How can I spawn a player to his old position when he spawn ?

Thank you
Reply
#10

Under onplayespawn

PHP код:
SetPlayerPos(playeridpInfo[playerid][posX], pInfo[playerid][posY], pInfo[playerid][posZ]); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)