SA-MP Forums Archive
Pieces of strings disapearing - 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)
+--- Thread: Pieces of strings disapearing (/showthread.php?tid=353709)



Pieces of strings disapearing - Jstylezzz - 24.06.2012

Hi everyone,

I am not sure what this has to do with, but maybe someone else knows...
So, let me try to explain the problem.
Example:

The player has to enter a description about himself while registering.
This is saved in the MYSQL database.
In the MYSQL database you now see: Description: I am testing

So now, the player disconnects, and everything is saved fine.
Now the player logs back in, and the string gets loaded into: PIno[playerid][PDesc]
This is also going fine.
Now, the player disconnects again, but now this is saved in the database: am testing.
It seems that the first letter has dissapeared.
Everytime the player joins and leaves, the string loses one letter.

Anyone ever seen this problem?
((String sizes shouldn't be the matter, since i increased them to a very high ammount))


Re: Pieces of strings disapearing - phillip875 - 24.06.2012

I've seen this problem before, though I can't remember how to fix it :S


Re: Pieces of strings disapearing - Finn - 24.06.2012

Show some code.


Re: Pieces of strings disapearing - Jstylezzz - 24.06.2012

Quote:
Originally Posted by Finn
Посмотреть сообщение
Show some code.
I can show you the saving function, not sure if that is what you need...
pawn Код:
forward SaveStats(playerid);
public SaveStats(playerid)
{
    if(GetPVarInt(playerid,"Logged") == 1)
    {
   
    new query[1024];
    format(query, sizeof(query), "UPDATE Users SET \
    Money = '%d', \
    Level = '%d', \
    Admin = '%d', \
    Helper = '%d', \
    VipLevel = '%d', \
    Skin = '%d', \
    Kills = '%d', \
    Deaths = '%d', \
    Muted = '%d', \
    Cell = '%d', \
    Cigs = '%d', \
    Watch = '%d', \
    Mask = '%d', \
    GasCan = '%d', \
    Sprunk = '%d', \
    Stereo = '%d', \
    GoldCoins = '%d', \
    PaymentMethod = '%d', \
    DriversLic = '%d', \
    WeaponLic = '%d', \
    HeavyVLic = '%d', \
    PilotLic = '%d', \
    BlockedPM = '%d',\
    Proposing = '%d',\
    Warnings = '%d',\
    MarriedTo = '%s'\
    WHERE Username = '%s'"
,
    GetPlayerMoney(playerid),
    GetPVarInt(playerid,"Score"),
    GetPVarInt(playerid,"Level"),
    GetPVarInt(playerid,"Helper"),
    GetPVarInt(playerid,"Vip Level"),
    GetPVarInt(playerid,"Skin"),
    GetPVarInt(playerid,"Kills"),
    GetPVarInt(playerid,"Deaths"),
    GetPVarInt(playerid,"Muted"),
    GetPVarInt(playerid,"HasCellphone"),
    GetPVarInt(playerid,"HasCigs"),
    GetPVarInt(playerid,"HasWatch"),
    GetPVarInt(playerid,"HasMask"),
    GetPVarInt(playerid,"GasCan"),
    GetPVarInt(playerid,"HasSprunk"),
    GetPVarInt(playerid,"HasStereo"),
    GetPVarInt(playerid,"GoldCoins"),
    GetPVarInt(playerid,"PMethod"),
    GetPVarInt(playerid,"DriversLic"),
    GetPVarInt(playerid,"WeaponLic"),
    GetPVarInt(playerid,"HeavyVLic"),
    GetPVarInt(playerid,"PilotLic"),
    PInfo[playerid][BlockedPM],
    PInfo[playerid][Proposing],
    PInfo[playerid][Warnings],
    PInfo[playerid][MarriedTo],
    GetPlayerNameEx(playerid));
    mysql_query(query);
    SendClientMessage(playerid,COLOR_RED,"Saving 1 debugged");
    print(query);
   
    format(query, sizeof(query), "UPDATE Users SET \
    Age = '%d',\
    PNumber = '%d',\
    PDesc = '%s',\
    PMail = '%s',\
    PCountry = '%s',\
    PSex = '%d',\
    PMailConfirmed = '%d'\
    WHERE Username = '%s'"
,
    PInfo[playerid][Age],
    PInfo[playerid][PNumber],
    PInfo[playerid][PDesc],
    PInfo[playerid][PMail],
    PInfo[playerid][PCountry],
    PInfo[playerid][PSex],
    PInfo[playerid][PMailConfirmed],
    GetPlayerNameEx(playerid));
    mysql_query(query);
    print(query);
    SendClientMessage(playerid,COLOR_RED,"Saving 2 debugged");
    }
}
If you need something else, please tell me and i will post it


Re: Pieces of strings disapearing - Finn - 24.06.2012

When player connects to the server, the description is loaded correctly? So it doesn't lose that letter when loading data?

You should debug the script and see where the bug occurs.


Re: Pieces of strings disapearing - Jstylezzz - 24.06.2012

Hmm.. I also noticed that Integers change.
When I input 25 or something, in the MYSQL database it appears as 73!?
@finn It goes wrong while loading, it loads the strings wrong.


Re: Pieces of strings disapearing - Finn - 24.06.2012

If the problem is in loading, why did you show us the saving function?