Mysql ip login
#1

Example to made auto ip login on mysql ?
Reply
#2

You could try this

pawn Код:
new _ip[MAX_PLAYERS], ip[39];
GetPlayerIp(playerid, ip, sizeof(ip));
mysql_query("SELECT ip FROM `tablename` WHERE name = `%s`", name);
mysql_fetch_field_row(_ip[playerid], "ip");
if(_ip[playerid] == ip)
{
    // things here
}
Reply
#3

i put in "// things here"
Reply
#4

No, you have to remove that line and do the thing you want to do when the player is automatic logged in
Reply
#5

pinguinn's code is a bit incorrect
pawn Код:
new _ip[25], ip[25];
GetPlayerIp(playerid, ip, sizeof(ip));
mysql_query("SELECT ip FROM `tablename` WHERE `name` = '%s'", name);
mysql_fetch_field_row(_ip, "ip");
if(!strcmp(_ip, ip, true)
Reply
#6

OK, ... and for create a timer for save a stats ip.. when the player change ip..
Reply
#7

just update the IP in the mysql db when a player logs in (not on auto-login ofc)...

So the next time he enters with the same IP as he had on his last login, he gets logged in automatically << the actual idea of auto-login..

So just add a
pawn Код:
new ip[25], string[200], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerIp(playerid, ip, sizeof(ip));
format(string, sizeof(string), "UPDATE `tablename` SET `ip`='%s' WHERE `name`='%s'", ip, name);
mysql_query(string);
Reply
#8

OK, ....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)