Easy_Mysql problem (IP)
#1

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?
Reply
#2

anyone?
Reply
#3

bump
Reply
#4

Try using a new SQL plugin. Also.. Perhaps use the function GetPlayerIp:
PHP код:
public OnPlayerConnect(playerid)
{
    new 
plrIP[16];
    
GetPlayerIp(playeridplrIPsizeof(plrIP));
    if(!
strcmp(plrIP"127.0.0.1"))
    
SendClientMessage(playerid0xFFFFFFFF"Welcome to your server, master :)");
    return 
1;

Source: wiki.

Try that to get the IP, and after that store it into the database.
Reply
#5

Fixed !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)