18.07.2009, 16:45
Hi there, I've recently downloaded an example script of MySQL.
Basically what this script does is save statistics to a player and stores them in an SQL' database.
Now, here's the main callback where I THINK the error occurs;
(Sorry about the slight indentation screw up but, oh well). I cannot add more than 7, I try to add one more, when I connect to the server it just doesn't let me connect.
I can't see the problem, I'm fairly new to MySQL and I thought an example script was the way to go..
Any ideas how I could add more?
= rejected connection for everyone who attempts to connect.
Plus I'm not too bothered about array sizes right now, I don't know what MySQL array sizes are supposed to be so, yeah.
Basically what this script does is save statistics to a player and stores them in an SQL' database.
Now, here's the main callback where I THINK the error occurs;
pawn Код:
stock LoginPlayer(playerid,pass[])
{
new query[256],
result[256],
loop[256],
poop = 1;
MySQLCheck();
samp_mysql_real_escape_string(GetPlayerNameEx(playerid),GetPlayerNameEx(playerid));
samp_mysql_real_escape_string(pass,pass);
format(query,sizeof(query),"SELECT * FROM `users` WHERE Username = '%s' AND Password = md5('%s')",GetPlayerNameEx(playerid),pass);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(result);
if(samp_mysql_num_rows() == 1)
{
samp_mysql_strtok(loop, "|", result);
while(samp_mysql_strtok(loop, "|", ""))
{
if(poop == 3) AccountInfo[playerid][Points] = strval(loop);
if(poop == 4) AccountInfo[playerid][Kills] = strval(loop);
if(poop == 5) AccountInfo[playerid][Deaths] = strval(loop);
if(poop == 6) AccountInfo[playerid][Admin] = strval(loop);
if(poop == 7) AccountInfo[playerid][TimesQuit] = strval(loop);
poop += 1;
}
samp_mysql_free_result();
GivePlayerMoney(playerid, 1337);
LoggedIn[playerid] = 1;
SpawnPlayer(playerid);
return 1;
}
else
{
SendClientMessage(playerid,COLOR_GREY," Invalid password.");
Wrongattempt[playerid] += 1;
}
return 1;
}
I can't see the problem, I'm fairly new to MySQL and I thought an example script was the way to go..
Any ideas how I could add more?
pawn Код:
if(poop == 8) AccountInfo[playerid][OneMoreRow] = strval(loop);
Plus I'm not too bothered about array sizes right now, I don't know what MySQL array sizes are supposed to be so, yeah.