IP Saving
#1

As part of my database I keep the last logged in IP stored, I used the following function to obtain the ip:

Code:
new ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));
    return ip;
When the player loads in I run:
Code:
    userInfo[playerid][pIP][0] = EOS;
    strcat(userInfo[playerid][pIP], GetPlayerIpEx(playerid), 16);
and I use the following query to save it:
Code:
mysql_format(SQLHandle, queryHandler, sizeof(queryHandler), 
			"UPDATE `users` SET \
			`IP` = '%s'" WHERE `ID` = %d",
			userInfo[playerid][pIP], userInfo[playerid][pID]);
                        mysql_tquery(SQLHandle, queryHandler, "OnSavePlayer", "");
Now I can't quite identify what causes the inconsistency but the saving will either;
a: save the IP just fine or
b: save the account username with the exception of the first letter? (see image)



Does anyone know what could cause such an issue and how I would resolve it?
Reply
#2

The way you set the IP is a bit redundant, use this
Code:
format(userInfo[playerid][pIP], 16, "%s", GetPlayerIpEx(playerid));
https://sampwiki.blast.hk/wiki/Format
Reply
#3

Quote:
Originally Posted by admantis
View Post
The way you set the IP is a bit redundant, use this
Code:
format(userInfo[playerid][pIP], 16, "%s", GetPlayerIpEx(playerid));
https://sampwiki.blast.hk/wiki/Format
Seems to be saving fine now, I'll be sure to mention if any more inconsistencies occur.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)