GetPlayerIP help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: GetPlayerIP help (
/showthread.php?tid=312680)
GetPlayerIP help -
LiamM - 22.01.2012
Hey guys well I use MySQL and i've just finished making my ban cmd for saving the players IP, User and reason to a table called Banned, but for some reason. It saved the IP as 55. Any idea why that is? Heres the code
pawn Код:
new ip[16];
GetPlayerIp(id, ip, sizeof(ip));
format(query, sizeof(query), "INSERT INTO `Banned` (`User`, `Reason`, `IP`) VALUES ('%s', '%s', '%d')", pname, reason, ip);
mysql_query(query);
Re: GetPlayerIP help -
Konstantinos - 22.01.2012
Ip is characters, not integer
pawn Код:
new ip[16];
GetPlayerIp(id, ip, sizeof(ip));
format(query, sizeof(query), "INSERT INTO `Banned` (`User`, `Reason`, `IP`) VALUES ('%s', '%s', '%s')", pname, reason, ip);
mysql_query(query);
Re: GetPlayerIP help -
Johnson_boy - 22.01.2012
IP is a string, not an integer.
Replace %d with %s
Edit: I was too late
Re: GetPlayerIP help -
LiamM - 22.01.2012
So should I make the field a text / varchar too?
Re: GetPlayerIP help -
Johnson_boy - 22.01.2012
Yes the field should be a varchar having length of 16
Re: GetPlayerIP help -
LiamM - 22.01.2012
Ok thanks for both your helped, although you were late in replying i'll rep you any way for giving me a hand.
Edit:
It won't let me rep you Dwane, sorry.
Re: GetPlayerIP help -
Konstantinos - 22.01.2012
lol LiamM. I don't care about Reputation.
Your Welcome!
Re: GetPlayerIP help -
LiamM - 22.01.2012
Quote:
Originally Posted by Dwane
lol LiamM. I don't care about Reputation.
Your Welcome!
|
Yeah thats sweet, a lot of people do and a lot of people treat it like money lol.. Free way to gain knowledge about something you know?