MySQL not saving please help
#1

When a player disconnects it dosent save his stuff why??

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new query[1004];
    format(query, sizeof(query), "UPDATE users SET \
    new otherp[128];
    GetPlayerIp(playerid, otherp, sizeof(otherp));
    Money = '%d', \
    Bankcash = '%d',\
    Cash = '%d',\
    Score = '%d',\
    Adminlevel = '%d',\
    Army = '%d',\
    CIA = '%d',\
    RegularPlayer = '%d',\
    DrugHouseOwner = '%d',\
    OttoOwner = '%d',\
    TSkill = '%d',\
    RobSkill = '%d' ,\
    HasPackC4 = '%d',\
    HasPackRope = '%d',\
    HasPackMoney = '%d', \
    SavedWantedLevel = '%d' ,\
    SavedJailTime = '%d',\
    Coprank = '%d',\
    HoursPlayed = '%d',\
    MinutesPlayed = '%d',\
    SecondsPlayed = '%d',\
    IpAdress = '%s'\
    WHERE Username = '%s'"
,
    GetPlayerMoney(playerid),
    BankCash[playerid],
    GetPlayerMoney(playerid),
    GetPlayerScore(playerid),
    AdminLevel[playerid],
    CanUseArmy[playerid],
    CanUseCIA[playerid],
    IsRegularPlayer[playerid],
    DrugHouseOwner[playerid],
    OttoOwner[playerid],
    TerroristSkill[playerid],
    RobSkill[playerid],
    HasPackC4[playerid],
    HasPackRope[playerid],
    HasPackMoney[playerid],
    SavedWantedLevel[playerid],
    SavedJailTime[playerid],
    PlayerName(playerid));
    mysql_query(query);
    return 1;
}
Reply
#2

Try this.
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new query[1004];
    new otherp[128];
    GetPlayerIp(playerid, otherp, sizeof(otherp));
    format(query, sizeof(query), "UPDATE users SET \
    Money = '%d', \
    Bankcash = '%d',\
    Cash = '%d',\
    Score = '%d',\
    Adminlevel = '%d',\
    Army = '%d',\
    CIA = '%d',\
    RegularPlayer = '%d',\
    DrugHouseOwner = '%d',\
    OttoOwner = '%d',\
    TSkill = '%d',\
    RobSkill = '%d' ,\
    HasPackC4 = '%d',\
    HasPackRope = '%d',\
    HasPackMoney = '%d', \
    SavedWantedLevel = '%d' ,\
    SavedJailTime = '%d',\
    Coprank = '%d',\
    HoursPlayed = '%d',\
    MinutesPlayed = '%d',\
    SecondsPlayed = '%d',\
    IpAdress = '%s'\
    WHERE Username = '%s'",
    GetPlayerMoney(playerid),
    BankCash[playerid],
    GetPlayerMoney(playerid),
    GetPlayerScore(playerid),
    AdminLevel[playerid],
    CanUseArmy[playerid],
    CanUseCIA[playerid],
    IsRegularPlayer[playerid],
    DrugHouseOwner[playerid],
    OttoOwner[playerid],
    TerroristSkill[playerid],
    RobSkill[playerid],
    HasPackC4[playerid],
    HasPackRope[playerid],
    HasPackMoney[playerid],
    SavedWantedLevel[playerid],
    SavedJailTime[playerid],
    PlayerName(playerid));
    mysql_query(query);
    return 1;
}
Reply
#3

Post your OnPlayerConnect, Maybe its not loading it properly
Reply
#4

Quote:
Originally Posted by Ranshand
Посмотреть сообщение
Try this.
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new query[1004];
    new otherp[128];
    GetPlayerIp(playerid, otherp, sizeof(otherp));
    format(query, sizeof(query), "UPDATE users SET \
    Money = '%d', \
    Bankcash = '%d',\
    Cash = '%d',\
    Score = '%d',\
    Adminlevel = '%d',\
    Army = '%d',\
    CIA = '%d',\
    RegularPlayer = '%d',\
    DrugHouseOwner = '%d',\
    OttoOwner = '%d',\
    TSkill = '%d',\
    RobSkill = '%d' ,\
    HasPackC4 = '%d',\
    HasPackRope = '%d',\
    HasPackMoney = '%d', \
    SavedWantedLevel = '%d' ,\
    SavedJailTime = '%d',\
    Coprank = '%d',\
    HoursPlayed = '%d',\
    MinutesPlayed = '%d',\
    SecondsPlayed = '%d',\
    IpAdress = '%s'\
    WHERE Username = '%s'",
    GetPlayerMoney(playerid),
    BankCash[playerid],
    GetPlayerMoney(playerid),
    GetPlayerScore(playerid),
    AdminLevel[playerid],
    CanUseArmy[playerid],
    CanUseCIA[playerid],
    IsRegularPlayer[playerid],
    DrugHouseOwner[playerid],
    OttoOwner[playerid],
    TerroristSkill[playerid],
    RobSkill[playerid],
    HasPackC4[playerid],
    HasPackRope[playerid],
    HasPackMoney[playerid],
    SavedWantedLevel[playerid],
    SavedJailTime[playerid],
    PlayerName(playerid));
    mysql_query(query);
    return 1;
}
You didnt change a shit and no it didnt work.
Reply
#5

* Wizz123 cries.
Its %d not '%d' and would you mind telling me why you set a / after each parameter?
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new query[1004];
    new otherp[128];
    GetPlayerIp(playerid, otherp, sizeof(otherp));
    format(query, sizeof(query), "UPDATE `users` SET `Money` = %d, `Bankcash` = %d, `Cash` = %d, `Score` = %d, `Adminlevel` = %d, `Army` = %d, `CIA` = %d, `RegularPlayer` = %d, `DrugHouseOwner` = %d, `OttoOwner` = %d, `TSkill` = %d, `RobSkill` = %d , `HasPackC4` = %d, `HasPackRope` = %d, `HasPackMoney` = %d,  `SavedWantedLevel` = %d , `SavedJailTime` = %d, `Coprank` = %d, `HoursPlayed` = %d, `MinutesPlayed` = %d, `SecondsPlayed` = %d, `IpAdress` = '%s' WHERE `Username` = '%s'",
    GetPlayerMoney(playerid),
    BankCash[playerid],
    GetPlayerMoney(playerid),
    GetPlayerScore(playerid),
    AdminLevel[playerid],
    CanUseArmy[playerid],
    CanUseCIA[playerid],
    IsRegularPlayer[playerid],
    DrugHouseOwner[playerid],
    OttoOwner[playerid],
    otherp,
    TerroristSkill[playerid],
    RobSkill[playerid],
    HasPackC4[playerid],
    HasPackRope[playerid],
    HasPackMoney[playerid],
    SavedWantedLevel[playerid],
    SavedJailTime[playerid],
    Coprank[playerid],
    TotalPlayedTime[playerid][0],
    TotalPlayedTime[playerid][1],
    TotalPlayedTime[playerid][2],
    PlayerName(playerid));
    mysql_query(query);
    return 1;
}
Reply
#6

Firstly, it is not really important to add ' or `. Just remove them or properly fix them.

pawn Код:
UPDATE `users` SET `Money` = '%d', `Bankcash` = '%d', // .... continue
Simple:
pawn Код:
UPDATE users SET Money=%d, Bankcash=%d, // .... continue
Reply
#7

Quote:
Originally Posted by Wizz123
Посмотреть сообщение
* yuvraj201 cries.
Its %d not '%d' and would you mind telling me why you set a / after each parameter?
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new query[1004];
    new otherp[128];
    GetPlayerIp(playerid, otherp, sizeof(otherp));
    format(query, sizeof(query), "UPDATE `users` SET `Money` = %d, `Bankcash` = %d, `Cash` = %d, `Score` = %d, `Adminlevel` = %d, `Army` = %d, `CIA` = %d, `RegularPlayer` = %d, `DrugHouseOwner` = %d, `OttoOwner` = %d, `TSkill` = %d, `RobSkill` = %d , `HasPackC4` = %d, `HasPackRope` = %d, `HasPackMoney` = %d,  `SavedWantedLevel` = %d , `SavedJailTime` = %d, `Coprank` = %d, `HoursPlayed` = %d, `MinutesPlayed` = %d, `SecondsPlayed` = %d, `IpAdress` = '%s' WHERE `Username` = '%s'",
    GetPlayerMoney(playerid),
    BankCash[playerid],
    GetPlayerMoney(playerid),
    GetPlayerScore(playerid),
    AdminLevel[playerid],
    CanUseArmy[playerid],
    CanUseCIA[playerid],
    IsRegularPlayer[playerid],
    DrugHouseOwner[playerid],
    OttoOwner[playerid],
    otherp,
    TerroristSkill[playerid],
    RobSkill[playerid],
    HasPackC4[playerid],
    HasPackRope[playerid],
    HasPackMoney[playerid],
    SavedWantedLevel[playerid],
    SavedJailTime[playerid],
    Coprank[playerid],
    TotalPlayedTime[playerid][0],
    TotalPlayedTime[playerid][1],
    TotalPlayedTime[playerid][2],
    PlayerName(playerid));
    mysql_query(query);
    return 1;
}
THANKS!! WORKED +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)