Easy_Mysql problem (IP) - 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: Easy_Mysql problem (IP) (
/showthread.php?tid=598382)
Easy_Mysql problem (IP) -
kalanerik99 - 11.01.2016
Hello guys
I have 1 problem
I am editing an old script and I used easy mysql then..
Now I store IP and it stores corectly
But when I load it it loads wrong like [Database:127.0.0.1 InGame:53]
Код:
CreateDataBase()
{
new handle = SQL::Open(SQL::CREATE, "players");
SQL::AddTableEntry(handle, "IP", SQL_TYPE_VCHAR, 20);
SQL::Close(handle);
}
Код:
public OnPlayerConnect(playerid)
{
PlayerInfo[playerid][LoggedIn] = 0;
new handle = SQL::OpenEx(SQL::READ, "players", "Name", PlayerName(playerid));
SQL::ReadString(handle, "Password", PlayerInfo[playerid][Password], 64);
SQL::ReadInt(handle, "ID", PlayerInfo[playerid][ID]);
SQL::ReadInt(handle, "AutoLogin", PlayerInfo[playerid][AutoLogin]);
SQL::ReadString(handle, "IP", PlayerInfo[playerid][IP]);
SQL::Close(handle);
return 1;
}
Код:
if(!strcmp(ip,PlayerInfo[playerid][IP],true))
{
Here it should work ..I am on the same IP 100% sure but it doesnt! I dont get it ... why?
Re: Easy_Mysql problem (IP) -
kalanerik99 - 12.01.2016
anyone?
Re: Easy_Mysql problem (IP) -
kalanerik99 - 12.01.2016
bump
Re: Easy_Mysql problem (IP) -
SaltySandy - 12.01.2016
Try using a new SQL plugin. Also.. Perhaps use the function GetPlayerIp:
PHP код:
public OnPlayerConnect(playerid)
{
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
if(!strcmp(plrIP, "127.0.0.1"))
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to your server, master :)");
return 1;
}
Source: wiki.
Try that to get the IP, and after that store it into the database.
Re: Easy_Mysql problem (IP) -
kalanerik99 - 12.01.2016
Fixed !