28.06.2012, 07:55
So, I'm just touching up my account save system, and adding the IP seemed easy, just using dini_Set. Weelll, when I got done, I looked at my .ini file, and oddly enough, it showed me that my IP variable = the last command I eneted..? Anyways, that doesn't seem logical. I've tried any kind of command, defined or not, it all shows up afterwards.
Here's the parts of the code where it saves the IP:
And here's my PlayerNameFile stock.
And that's all. Does anyone see any reason to why it sets my IP account variable to the last command I entered? Thanks in advance.
Here's the parts of the code where it saves the IP:
pawn Код:
enum PlayerStats
{
IP,
pawn Код:
public LoadStats(playerid)
{
new ip[16], ipstring[16];
LoggedIN[playerid] = 1;
format(ipstring, sizeof(ipstring), "%s", GetPlayerIp(playerid,ip,sizeof(ip)));
Stats[playerid][IP] = dini_Set(playernamefile(playerid),"IP", ipstring);
pawn Код:
public SaveStats(playerid)
{
if(IsPlayerConnected(playerid) && LoggedIN[playerid] == 1)
{
new ip[16], ipstring[16];
format(ipstring, sizeof(ipstring), "%s", GetPlayerIp(playerid,ip,sizeof(ip)));
dini_Set(playernamefile(playerid),"IP",ipstring);
pawn Код:
//OnPlayerDisconnect
new ip[16], ipstring[16];
format(ipstring, sizeof(ipstring),"%s",GetPlayerIp(playerid, ip, sizeof(ip)));
dini_Set(playernamefile(playerid),"IP", ipstring);
pawn Код:
//On the register dialog
new ip[16], ipstring[16];
format(ipstring, sizeof(ipstring),"%s",GetPlayerIp(playerid,ip,sizeof(ip)));
dini_Set(playernamefile(playerid),"IP",ipstring);
pawn Код:
//On the login dialog
new ip[16], ipstring[16];
format(ipstring, sizeof(ipstring), "%s", GetPlayerIp(playerid,ip,sizeof(ip)));
Stats[playerid][IP] = dini_Set(playernamefile(playerid),"IP",ipstring);
pawn Код:
stock playernamefile(playerid) // Used to return the players file name, eg. Dexter_Morgan.ini
{
new pName[MAX_PLAYER_NAME],FileName[31]; // Creating the Variables
GetPlayerName(playerid, pName,MAX_PLAYER_NAME); // Gets the players name, and stores it to the variable pName
format(FileName,34,"/Users2/%s.ini", pName); //Formats the FileName string, so that it contains the full file name %s = insert string
return FileName; // Sends the string, "FileName" back to the function who called it.
}