18.06.2014, 19:57
I tried to make the users to use mysql, but when I do my new account, I always give the same thing as in the picture below:
Picture
Picture
format(query,sizeof(query),"SELECT * FROM `userdata` WHERE `player` = '%s'",PlayerName);
mysql_query(query);
if(mysql_num_rows(query))//registered
{
//code
}
else //not registered
{
//code
}
public MySQLCreateAccount(newplayersname[], newpassword[], playerid)
{
new query[300];
new sqlplyname[64];
//new sqlpassword[64];
new parolacript[129];
mysql_real_escape_string(newplayersname, sqlplyname);
//mysql_real_escape_string(newpassword, sqlpassword);
WP_Hash(parolacript, sizeof(parolacript), newpassword);
format(query, sizeof(query), "INSERT INTO players (Name, Password) VALUES ('%s', '%s')", sqlplyname, parolacript);
mysql_query(query);
Registerr[playerid] = 2;
new string[256];
format(string, sizeof(string), "%s s-a inregistrat pe server!",newplayersname);
ABroadCast(COLOR_LIGHTRED,string,1);
SBroadCast(COLOR_LIGHTRED, string);
print("[MySQL]: Un nou cont a fost creat in baza de date!(..)01");
mysql_free_result();
print("[MySQL]: Un nou cont a fost creat in baza de date!(..)02");
//mysql_free_result();
new newplayersid = MySQLCheckAccount(newplayersname);
if (newplayersid != 0)
{
return newplayersid;
}
return 0;
}