SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/12/2018, 03:31 PM   #1
Chyakka
Big Clucker
 
Join Date: Jul 2015
Location: England
Posts: 61
Reputation: 10
Default IP Saving

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?
Chyakka is offline   Reply With Quote
Old 19/12/2018, 05:00 PM   #2
admantis
High-roller
 
Join Date: Sep 2009
Posts: 2,524
Reputation: 449
Default Re: IP Saving

The way you set the IP is a bit redundant, use this
Code:
format(userInfo[playerid][pIP], 16, "%s", GetPlayerIpEx(playerid));
https://wiki.sa-mp.com/wiki/Format
admantis is offline   Reply With Quote
Old 19/12/2018, 05:38 PM   #3
Chyakka
Big Clucker
 
Join Date: Jul 2015
Location: England
Posts: 61
Reputation: 10
Default Re: IP Saving

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://wiki.sa-mp.com/wiki/Format
Seems to be saving fine now, I'll be sure to mention if any more inconsistencies occur.
Chyakka is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Simple Toy System + Saving with DINI. (saving only 1 slot) PaulDinam Filterscripts 24 20/11/2018 01:36 PM
Saving gangs to different files, code only saving one MrTinder Scripting Help 4 07/11/2015 01:34 PM
problem saving variable saving is wrong unamed Scripting Help 1 31/03/2015 09:26 AM
New saving system and still not saving score/money Karl[NDZ] Scripting Help 16 12/09/2013 06:55 AM
Good Dini/Dudb tutorial for file saving and info saving for example score ect JoeDaDude Help Archive 2 07/02/2010 09:04 PM


All times are GMT. The time now is 06:49 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.