19.07.2014, 15:47
hello
Since r39 released , i'm using it while still no tutorial explains it >_>
I converted my register system and login by practice from old tutorials,
Problem is , no errors when compiling,
It dosen't save player in db
and
Tsaer is user name i used to test my system and yea so...
It told me that something wrong with line and on account register
here's code:
please help..
Since r39 released , i'm using it while still no tutorial explains it >_>
I converted my register system and login by practice from old tutorials,
Problem is , no errors when compiling,
It dosen't save player in db
and
Код:
[18:13:27] [ERROR] CMySQLQuery::Execute[OnAccountRegister] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALUES( 'Tsaer', '0C528763C61AA99EDBC175084DD942F4ADE26CED32CEC7BBDD2AB4164FF832' at line 1
It told me that something wrong with line and on account register
here's code:
pawn Код:
CMD:register(playerid, params[])
{
new query[300], str[128], password[50];
GetPlayerName(playerid, Name[playerid], MAX_PLAYER_NAME);
GetPlayerIp(playerid, IP[playerid], 16);
if(IsPlayerLoggedIn[playerid] == 1) return SCM(playerid, red, "[ERROR] You are already registered!");
if(sscanf(params, "s[75]", password)) return SendClientMessage(playerid, red, "[ERROR] USAGE:/register [password]");
if(strlen(params) < 6) return SendClientMessage(playerid, red, "[ERROR] Password is too short! Min Length: 6 , MAX : 12");
WP_Hash(pInfo[playerid][Password], 129, params);
mysql_format(mysql, query, sizeof(query), "INSERT INTO `users` (`Username` , `Password`, `IP`, VALUES( '%s', '%s', '%s')", Name[playerid], pInfo[playerid][Password], IP[playerid]);
mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
SendClientMessage(playerid, lgreen, "[ACCOUNT] You have successfully created an account!");
GameTextForPlayer(playerid, "~g~REGISTERED~g~", 2, 5000);
IsPlayerLoggedIn[playerid] = 1;
IsPlayerRegistered[playerid] = 1;
return 1;
}
forward OnAccountRegister(playerid);
public OnAccountRegister(playerid)
{
new id = pInfo[playerid][UID];
id = cache_insert_id();
return 1;
}