Data doesn't change ip
#1

PHP код:
public OnPlayerConnectSafe(playerid)
{
    new 
query[128];
    
GetPlayerIp(playeridIP[playerid], 16);
    
mysql_format(mysqlquerysizeof(query),"SELECT `IP`, `Password`, `ID` FROM `players` WHERE `Username` = '%e' LIMIT 1"pName(playerid));
    
mysql_tquery(mysqlquery"OnAccountCheck""i"playerid);
    return 
1;

If the player is not banned the OnPlayerConnectSafe is requested it works
2) when the data is loaded i requested the script to saveplayerdata which means to update the player ip and variables
PHP код:
    if(IsLoggedIn[playerid] == 1)
    {
    
SavePlayerData(playerid);
    
IRC_GroupSay(groupIDIRC_aCHANNEL"data saved and updated ip");
    } 
3) i checked the saveplayerdata its fine but it doesn't update the ip
PHP код:
stock SavePlayerData(playerid)
{
    if(
IsLoggedIn[playerid] == 1)
    {
    new 
query[300];
    
mysql_format(mysqlquerysizeof(query), "UPDATE `players` SET `IP` = '%e', `Admin` = %d, `Tokens` = %d, `Kills` = %d,`Deaths` = %d, `Score` = %d, `Money` = %d, `Hours` = %d,\
    `Minutes` = %d, `RaceWon` = %d WHERE `ID` = %d"
,
    
IP[playerid], pData[playerid][Admin], pData[playerid][Tokens], pData[playerid][Kills],pData[playerid][Deaths], GetPlayerScore(playerid),\
    
pData[playerid][Money], pData[playerid][pHours], pData[playerid][pMinutes],pData[playerid][RaceWon], pData[playerid][ID]);
    
mysql_tquery(mysqlquery);
    }
    return 
1;

Reply
#2

Are you joining with a different IP? When you say it doesn't update... you mean the value doesn't change or it doesn't have a value?
Reply
#3

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Are you joining with a different IP? When you say it doesn't update... you mean the value doesn't change or it doesn't have a value?
My ip changes, yeah the value doesn't change
Reply
#4

Have you tried debugging to see what the value of 'IP[playerid]' is?
Reply
#5

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Have you tried debugging to see what the value of 'IP[playerid]' is?
Nope, the IP[playerid] to store the player ip in the new one
Reply
#6

I didn't totally understand what you're trying to say, Can you explain more with details?
Reply
#7

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
I didn't totally understand what you're trying to say, Can you explain more with details?
When the player connect the database doesn't save the new ip and remove the old one
Reply
#8

IP[playerid] is a variable, which means that you must set for it a value each time used.

That's why it is not updated when the player reconnects, You must make a function to get the player's IP using this function first.

PHP код:
GetPlayerIp(playeridIP[playerid], 16); 
Do that before the "UPDATE" of mysql query.

Then go ahead
Reply
#9

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
IP[playerid] is a variable, which means that you must set for it a value each time used.

That's why it is not updated when the player reconnects, You must make a function to get the player's IP using this function first.

PHP код:
GetPlayerIp(playeridIP[playerid], 16); 
Do that before the "UPDATE" of mysql query.

Then go ahead
Now facing other problem when player leaves it changes his ip to: 255.255.255.255
Reply
#10

Does it change it over the database? or when you check in game? btw this means invalid player IP.

EDIT:

Quote:

PAWN is case-sensitive. GetPlayerIP will not work.
This function does not work when used in OnPlayerDisconnect because the player is already disconnected. It will return an invalid IP (255.255.255.255). Save players' IPs under OnPlayerConnect if they need to be used under OnPlayerDisconnect.

That's what I've found over SA:MP Wiki, I believe it helps much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)