23.01.2013, 22:57
Hi, i am trying to make auto-login in my registration script, but i am getting unexpected error:
So when i try to log in into my server using this:
I get don't send message which is caused by samp-server.exe.
Then i tried this option:
And script seems to work fine.
Also i tested this configuration:
and replaced this line:
with this one:
script works also fine.
Configuration of
and
also works fine.
So my question is why i am getting don't send error in my script when i use this lines:
I am using Windows Xp Sp3 operating system.
Also i add mysql configuration:
Код:
public OnPlayerConnect(playerid)
{
new playerName[MAX_PLAYER_NAME],EscPName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, sizeof(playerName));
mysql_real_escape_string(playerName,EscPName,connection);
ResetPVars(playerid);//connection
format(szQueryInput, sizeof(szQueryInput), "SELECT `Ip` FROM `Players` WHERE `PlayerName` = '%s' LIMIT 0,1",EscPName);
mysql_function_query(connection, szQueryInput, true, "CheckPlayerAccount", "i", playerid);
return 1;
}
public CheckPlayerAccount(playerid, account[])
{
new rows, fields;
new ConnectedIP[16];
GetPlayerIp(playerid, ConnectedIP, sizeof(ConnectedIP));
cache_get_data(rows, fields, connection);
if(rows)
{
cache_get_row(0, 3, PlayerVar[playerid][PIP], connection);
printf("Connected IP is %s | Saved IP is %s!",ConnectedIP, PlayerVar[playerid][PIP]);
if(strlen(PlayerVar[playerid][PIP]) != 0 && !strcmp(PlayerVar[playerid][PIP], ConnectedIP, true))
{
SendClientMessage(playerid,COLOR_RED,"IP match");
ShowLoginDialog
}
else
{
ShowLoginDialog// This is my defined Login dialog
SendClientMessage(playerid,COLOR_RED,"IP differs");
}
}
else
{
ShowRegisterDialog // This is my defined Register dialog
}
return 1;
}
Код:
format(szQueryInput, sizeof(szQueryInput), "SELECT `Ip` FROM `Players` WHERE `PlayerName` = '%s' LIMIT 0,1",EscPName);
Then i tried this option:
Код:
format(szQueryInput, sizeof(szQueryInput), "SELECT * FROM `Players` WHERE `PlayerName` = '%s' LIMIT 0,1",EscPName);
Also i tested this configuration:
Код:
format(szQueryInput, sizeof(szQueryInput), "SELECT * FROM `Players` WHERE `PlayerName` = '%s' LIMIT 0,1",EscPName);
Код:
cache_get_row(0, 3, PlayerVar[playerid][PIP], connection);
Код:
cache_get_field_content(0, "Ip",PlayerVar[playerid][PIP], connection);
Configuration of
Код:
format(szQueryInput, sizeof(szQueryInput), "SELECT `Ip` FROM `Players` WHERE `PlayerName` = '%s' LIMIT 0,1",EscPName);
Код:
cache_get_field_content(0, "Ip",PlayerVar[playerid][PIP], connection);
So my question is why i am getting don't send error in my script when i use this lines:
Код:
format(szQueryInput, sizeof(szQueryInput), "SELECT `Ip` FROM `Players` WHERE `PlayerName` = '%s' LIMIT 0,1",EscPName);
Код:
cache_get_row(0, 3, PlayerVar[playerid][PIP], connection);
Also i add mysql configuration:
Код:
mysql_function_query(connection, "CREATE TABLE IF NOT EXISTS `Players` ( \ `Id` int(11) NOT NULL AUTO_INCREMENT, \ `PlayerName` varchar(24) NOT NULL, \ `Password` varchar(64) NOT NULL, \ `Ip` varchar(30) NOT NULL, \ `Kills` int(5) NOT NULL, \ `Deaths` int(5) NOT NULL, \ `Money` int(5) NOT NULL, \ `Level` int(5) NOT NULL, \ `Minutes` int(5) NOT NULL, \ `Hours` int(5) NOT NULL, \ `Visits` int(8) NOT NULL, \ PRIMARY KEY (`id`) \ )", false, "", "");

