new pName[MAX_PLAYER_NAME], query[256];
GetPlayerName(playerid, pName, sizeof(pName));
mysql_format(MHandle, query, sizeof(query), "SELECT * FROM `character` WHERE `Username` = '%e' LIMIT 1", pName);
mysql_query(MHandle, query);
new rows;
cache_get_row_count(rows);
if(!rows){
System_Scm(playerid, COLOR_YELLOW, "REGISTER", "You can register.");
//SetupCharacter(playerid);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", "Fill your password into the box below", "Okay", "Cancel");
}
case DIALOG_REGISTER:{
if(response){
if(!response) return Kick(playerid);
if(!strlen(inputtext) || strlen(inputtext) > 100){
System_Scm(playerid, COLOR_RED, "ERROR", "Password must be at least 5 words and lower than 100 words.");
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", "Fill your password into the box below to register your account", "Ok", "Cancel");
}
else if(strlen(inputtext) > 0 && strlen(inputtext) < 100)
{
new pName[MAX_PLAYER_NAME], query[256];
new Cache:GetCache;
GetPlayerIp(playerid, Character[playerid][IP], 16);
mysql_format(MHandle, query, sizeof(query), "INSERT INTO `character` (`Username`, `Password`, `Level`, `Money`, `IP`, `posX`, `posY`, `posZ`, `posA`, `Health`, `Armour`) VALUES ('%s', 'SHA1(%s)', (1), (10000), '%s', (1958.3783), (1343.1572), (15.3746), (90.0), (100.0), (0.0))", pName, inputtext, Character[playerid][IP]);
GetCache = mysql_query(MHandle, query);
cache_delete(GetCache);
System_Scm(playerid, COLOR_YELLOW, "REGISTERED", "You have registered succesfully!");
SpawnPlayer(playerid);
}
}
}
mysql_log(LOG_ALL);
Below ongamemodeinit write:
Code:
mysql_log(LOG_ALL); |
error 017: undefined symbol "LOG_ALL" |
[21:39:40] [ERROR] mysql_format: destination size '256' is too small [21:39:40] [ERROR] error #1065 while executing query "": Query was empty |
mysql_format(MHandle, query, sizeof(query), "INSERT INTO `character` (`Username`, `Password`, `Level`, `Money`, `IP`, `posX`, `posY`, `posZ`, `posA`, `Health`, `Armour`)\
VALUES ('%s', 'SHA1(%s)', 1, 10000, '%s', 1958.3783, 1343.1572, 15.3746, 90.0, 100.0, 0.0)", pName, inputtext, Character[playerid][IP]);
mysql_format(MHandle, query, sizeof(query), "INSERT INTO `character` (`Username`, `Password`, `Level`, `Money`, `IP`, `posX`, `posY`, `posZ`, `posA`, `Health`, `Armour`) VALUES ('%s', SHA1('%s'), 1, 10000, '%s', 1958.3783, 1343.1572, 15.3746, 90.0, 100.0, 0.0)", pName, inputtext, Character[playerid][IP]); |