SA-MP Forums Archive
Saving problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Saving problem (/showthread.php?tid=269447)



Saving problem - juraska - 16.07.2011

Hi all, I have a problem with data updating.

Saving data function looks like this

pawn Код:
new PlayerIP[24];
GetPlayerIp(playerid, PlayerIP, sizeof (PlayerIP)); //Players IP
format(Query, sizeof(Query), "UPDATE `Accounts` SET  `IP Address` = '%s' WHERE `Username` = '%s'",PlayerIP,GetEscName(playerid));

Server log: [16:02:30] CMySQLHandler::Query(UPDATE `Accounts` SET `IP Address` = '255.255.255.255' WHERE `Username` = 'Player') - Successfully executed.

My ip address is not like this '255.255.255.255'

thanks for help


Re: Saving problem - juraska - 16.07.2011

Help D:


Re: Saving problem - park4bmx - 16.07.2011

i dont see anything wrong with the code
Did you look up ur IP first ?
But your right your IP cant be 255.255.255.255

try this out
EDIT
pawn Код:
new rip[MAX_PLAYERS][16]; GetPlayerIp(playerid,rip[playerid],16);
format(Query, sizeof(Query), "UPDATE `Accounts` SET  `IP Address` = '%s' WHERE `Username` = '%s'",rip[playerid],GetEscName(playerid));



Re: Saving problem - juraska - 16.07.2011

Still don't work but, when i put this line in register line it's works fain
BTW not your line, when put this my line
pawn Код:
new PlayerIP[24];
GetPlayerIp(playerid, PlayerIP, sizeof (PlayerIP)); //Players IP
format(Query, sizeof(Query), "UPDATE `Accounts` SET  `IP Address` = '%s' WHERE `Username` = '%s'",PlayerIP,GetEscName(playerid));



Re: Saving problem - park4bmx - 16.07.2011

try using a different name for the format instead of Query
Do like Query2 or something else it might be used before :X


Re: Saving problem - juraska - 16.07.2011

I do like you say, but same


Re: Saving problem - park4bmx - 16.07.2011

so your saying if you put this function somewhere else it works fine ?
but not where it is now ?

if that is so can u shows more of the code to see what could be the cause
And btw 255.255.255.0 is a IPv4 Subnet Mask: IP how does it get that i dont know xd


Re: Saving problem - juraska - 16.07.2011

In register process example:

pawn Код:
if(!response)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "This question is mandatory, come back and fill it in!");
                Kick(playerid);
            }
            else if(strlen(inputtext) < 4 || strlen(inputtext) > 48)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "We can't accept your question. It must be longer then 4 characters, but no more then 48.");
                ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "Security Question - Step 1", "What would you like your security question to be?", "Submit", "Leave");
            }
            else
            {
                new string[128], esc_inputtext[48];
                format(string, sizeof(string), "You have entered; \"%s\" as your security question. Is this correct?", inputtext);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

                mysql_real_escape_string(inputtext, esc_inputtext);
                format(Query, sizeof(Query), "UPDATE `Accounts` SET `Security Question` = '%s' WHERE `Username` = '%s'", esc_inputtext, GetName(playerid));
                mysql_query(Query);
// here i put and works
pawn Код:
GetPlayerIp(playerid, pStats[playerid][pIPAddress], 17);
        format(Query, sizeof(Query), "UPDATE `Accounts` SET `IP Address` = '%s' WHERE `Username` = '%s'",  pStats[playerid][pIPAddress], GetName(playerid));
        mysql_query(Query); //Queries
pawn Код:
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "Security Question - Step 1 (confirmation)", "Yes, continue.\nNo, try again.", "Submit", "Leave");
            }
        }


when i put here, result
pawn Код:
[19:50:10] CMySQLHandler::Query(UPDATE `Accounts` SET `IP Address` = '127.0.0.1' WHERE `Username` = 'Player') - Successfully executed.
Works Good



Re: Saving problem - juraska - 16.07.2011

please help


Re: Saving problem - juraska - 17.07.2011

Bomm