Question
#1

I've had this happen before but I forgot how I fixed it.

I set the player's IP, and it saves as pIP.

However, it doesn't save in the MySQL DB as the IP.

And when I type a command to retrieve the IP from the database, it returns the IP as like, 52. When the IP is like, 108.05, ect.
Reply
#2

Can you show the cmd line ?
Reply
#3

It's alot of lines, but heres the IP stuff:

Saving:
pawn Код:
new IP[16];
        GetPlayerIp(playerid, IP, sizeof(IP));
        strmid(PlayerInfo[playerid][pIP], IP, 0, strlen(IP), 255);
           
        format(String, sizeof(String), "Update `Accounts` SET `IP` = '%d' WHERE `UserID` = '%d'",
        PlayerInfo[playerid][pIP], PlayerInfo[playerid][pDatabaseID]);
        mysql_query(String);
pawn Код:
format(string, sizeof(string), "SELECT * FROM `Accounts` WHERE `UserID` = '%d'", PlayerInfo[playerid][pDatabaseID]); // Fetching IP, banning.
                mysql_query(string);
                mysql_store_result();
                mysql_fetch_field( "IP", DataString);
                format(string,sizeof(string),"banip %s",DataString);
                SendRconCommand(string);
                format(string, sizeof(string), "Admin: %s's IP: %d has been banned.", tmp,DataString);
                AdministratorMessage(COLOR_LIGHTRED, string,1);
DataString returns 52 for some reason instead of the IP.
Reply
#4

format(String, sizeof(String), "Update `Accounts` SET `IP` = '%d' WHERE `UserID` = '%d'",

don't use %d, an ip isn't just a number

replace it with %s everywhere where it's needed and it'll be fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)