[HELP] Account Mysql - 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: [HELP] Account Mysql (
/showthread.php?tid=520407)
[HELP] Account Mysql -
monster010 - 18.06.2014
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
Re: [HELP] Account Mysql -
DobbysGamertag - 18.06.2014
Care to provide some insight into your code?
What version of MySQL are you using?
Re: [HELP] Account Mysql -
monster010 - 18.06.2014
MySQL plugin R6.
Re: [HELP] Account Mysql -
DobbysGamertag - 18.06.2014
y u no update to R39?
show us the code you're using.
R6 version (i havent used it in a long time) example:
pawn Код:
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
}
Checks if they're in the database.
Re: [HELP] Account Mysql -
monster010 - 18.06.2014
pawn Код:
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;
}
How can create the data base .sql?
Re: [HELP] Account Mysql -
DobbysGamertag - 18.06.2014
Are you checking if the account exists when they connect?