Mysql creating accounts problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql creating accounts problem (
/showthread.php?tid=609811)
Mysql creating accounts problem -
Problems - 16.06.2016
I used this tutorial(
https://sampforum.blast.hk/showthread.php?tid=574714) so to convert my script to mysql however,I got a problem that i can register only one account with the ID 0 and when I try to register with another accounts it lets me register and login but the account is created in the database.
This on responding to register dialog
Code:
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerIp(playerid, playerip, sizeof(playerip));
WP_Hash(Player[playerid][Password], 129, inputtext);
mysql_format(koneksi, query, sizeof(query), "INSERT INTO `users` (`Name`, `Password`, `IP`, `Bankcash`, `Money`) VALUES ('%e', '%e', '%e' ,50000, 30000)", playername, Player[playerid][Password], playerip);
mysql_tquery(koneksi, query, "OnAccountRegister", "i", playerid);
and this is my OnAccountRegister
Code:
forward OnAccountRegister(playerid);
public OnAccountRegister(playerid)
{
Player[playerid][pIDs] = cache_insert_id();
printf("[Registration] New account registered. Database ID: [%d]", Player[playerid][pIDs]);
return true;
}
Re: Mysql creating accounts problem -
Ax3l123 - 16.06.2016
http://i19.servimg.com/u/f19/19/20/5...h/xampp-21.png
Notice the index set to 'PRIMARY' and the A_I option checked.
Basically we will use the ID column to identify the player in the database and for every new record, the ID goes up by one. For example: I made the first account on your server, my database ID is now 1. You make your account after I do, you ID will be 2.
did you do this step ?