enum PlayerStats
{
IP,
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);
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);
//OnPlayerDisconnect
new ip[16], ipstring[16];
format(ipstring, sizeof(ipstring),"%s",GetPlayerIp(playerid, ip, sizeof(ip)));
dini_Set(playernamefile(playerid),"IP", ipstring);
//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);
//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);
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.
}
new ip[16];
GetPlayerIp(playerid, ip, sizeof(ip));
dini_Set(playernamefile(playerid),"IP", ip);

|
The issue is that you're not using the function GetPlayerIp correctly, it doesn't return the IP address as a string. It stores it in the second parameter, for example:
pawn Код:
![]() In future, check out the documentation for the functions you are using! |
enum PlayerStats
{
IP[16],
}
newStats[MAX_PLAYERS][PlayerStats];
public OnPlayerConnect(playerid)
{
GetPlayerIp(playerid,Stats[playerid][IP],16);//stores player ip in enum
return 1;
}
|
You sir, are a life saver. I completely didn't realize it until you pointed it out to me. Again, thanks. Any whereabouts on why it sets my ip to 255.255.255.255? I wasn't LAN testing either, uploaded straight to my server.
|
|
You sir, are a life saver. I completely didn't realize it until you pointed it out to me. Again, thanks. Any whereabouts on why it sets my ip to 255.255.255.255? I wasn't LAN testing either, uploaded straight to my server.
|