.... -
Ryan_Bowe - 25.12.2013
....
Re: MySQL IP not saving correctly -
Aprezt - 25.12.2013
ip = '%d'
Re: MySQL IP not saving correctly -
Ryan_Bowe - 25.12.2013
....
Re : MySQL IP not saving correctly -
[HRD]Mar1 - 25.12.2013
Use GetPlayerIp(playerid, ip, 50); Directly
Re: MySQL IP not saving correctly -
Ryan_Bowe - 25.12.2013
....
Re : Re: MySQL IP not saving correctly -
[HRD]Mar1 - 25.12.2013
Quote:
Originally Posted by Ryan_Bowe
Did not work, saved as the number 50.
|
Yes it will not work because it isn't numbers only and IP is a string ( char + numbers)
Re: Re : MySQL IP not saving correctly -
Ryan_Bowe - 25.12.2013
....
Re : Re: Re : MySQL IP not saving correctly -
[HRD]Mar1 - 25.12.2013
Quote:
Originally Posted by Ryan_Bowe
Still the same 255.255.255.255.
|
pawn Code:
stock MySQL_Save(playerid) {
GetPlayerIp(playerid, PlayerData[playerid][pIP], 50);
new query[3000];
format(query, sizeof(query), "UPDATE `playerdata` SET ip = '%s', adminlevel = '%d' WHERE username = '%s'",
GetPlayerIp(playerid,pIP,32),
PlayerData[playerid][pAdminLevel],
GetPlayerNameEx(playerid));
mysql_query(query);
return 1;
}
Re: MySQL IP not saving correctly -
SilentSoul - 25.12.2013
How did you insert the ip in your database ? if you insert it as '
int' change to `ip`
varchar(16) NOT NULL
@ Originally Posted by [HRD]Mar1 View Post
Use GetPlayerIp(playerid, ip, 50); Directly
No that's wrong the ip can't exceed 16 letters.
https://sampwiki.blast.hk/wiki/GetPlayerIp
EDIT:
pawn Code:
stock MySQL_Save(playerid) {
new query[200],pIP[16];//query size too much and you check for small variables.
format(query, sizeof(query), "UPDATE `playerdata` SET ip = '%s', adminlevel = '%d' WHERE username = '%s'",
GetPlayerIp(playerid,pIP,16),
PlayerData[playerid][pAdminLevel],
GetPlayerNameEx(playerid));
mysql_query(query);
return 1;
}
Re: MySQL IP not saving correctly -
HardRock - 25.12.2013
Do not save IP, when he is disconnecting. If the player connect, save the IP.
Re: MySQL IP not saving correctly -
Keyhead - 25.12.2013
pawn Code:
public OnPlayerConnect(playerid)
{
GetPlayerIp(playerid, pInfo[playerid][pIP], 16);
}
Then save it.
pawn Code:
stock MySQL_Save(playerid)
{
new query[3000]; format(query, sizeof(query), "UPDATE `playerdata` SET ip = '%s', adminlevel = '%d' WHERE username = '%s'",
pInfo[playerid][pIP],
PlayerData[playerid][pAdminLevel],
GetPlayerNameEx(playerid));
mysql_query(query);
return 1;
}
Make sure you define the IP Variable.
EDIT:
Why is your query 3000?
Re : Re: MySQL IP not saving correctly -
[HRD]Mar1 - 25.12.2013
Quote:
Originally Posted by SilentSoul
|
Not wrong (Recommended 16)...
Re: MySQL IP not saving correctly -
SilentSoul - 25.12.2013
But why you used to check for 50 , i think no ip can exceed the '16'. no ip like this 23.23.123.124.124.213.21.323.1.321.3.123.12312.32 only in range of 16.