[FIXED]Wont Save
#1

hey,

I have a problem with a dynamic faction system. Basically it save a faction ID in the players table in the database. The thing is it wont save when they log-out. I'll show you what i have so far. I don't see why this wont work:

it's on the playerfile stuff that dosent save the rest does

pawn Код:
enum pInfo
{
    bool:SpawnDance,
    Float:SpawnAngle,
    SpawnTimer,
    pSQLId,
    pPassword[128],
    pRank,
    pReborn,
    pExp,
    pVan,
    pKills,
    pTKills,
    pGrenadekill,
    pMp5kill,
    pKnucklekill,
    pDeaths,
    pAdmin,
    pGM,
    pPremium,
    pCash,
    pWarns,
    pMenugoal,
    pHeligoal,
    pArmourgoal,
    pMapgoal,
    pMuted,
    pJail,
    Factionid
};
pawn Код:
dcmd_acceptinvite(playerid, params[])
{
    #pragma unused params
    if(Finvite[playerid] >= 1)
    {
      new BlurBlur[256];
        format(BlurBlur, sizeof(BlurBlur), "%d", Finvite[playerid]);
      new string[256];
      new sendername[MAX_PLAYER_NAME];
      GetPlayerName(playerid, sendername, sizeof(sendername));
      new membercount = djInt(BlurBlur,"Members");
      djSetInt(BlurBlur,"Members", (membercount+1));
      PlayerInfo[playerid][Factionid] = Finvite[playerid];
      format(string, sizeof(string), "%s has joined the faction", sendername);
      SendClientMessageToFaction(GREY, string, Finvite[playerid]);
      Finvite[playerid] = 0;
      SavePlayer(playerid);
      LSPDTeam[playerid] = 0;
        MafiaTeam[playerid] = 0;
      return 1;
    }
    else return SendClientMessage(playerid, RED, "You dont have a faction invitentation");
}
pawn Код:
public SavePlayer(playerid)
{
    CheckSQL();
    new query[512];
    format(query,sizeof(query),"UPDATE `players` SET rank=%d,reborn=%d,exp=%d,van=%d,kills=%d,tkills=%d,gkill=%d,mp5kill=%d,kkill=%d,mgoal=%d,hgoal=%d,agoal=%d,mapgoal=%d,deaths=%d,admin=%d,gm=%d,premium=%d,money=%d Factionid =%d WHERE playerid=%d",
      PlayerInfo[playerid][pRank],PlayerInfo[playerid][pReborn],PlayerInfo[playerid][pExp],PlayerInfo[playerid][pVan],PlayerInfo[playerid][pKills],PlayerInfo[playerid][pTKills],PlayerInfo[playerid][pGrenadekill],PlayerInfo[playerid][pMp5kill],
      PlayerInfo[playerid][pKnucklekill],PlayerInfo[playerid][pMenugoal],PlayerInfo[playerid][pHeligoal],PlayerInfo[playerid][pArmourgoal],PlayerInfo[playerid][pMapgoal],PlayerInfo[playerid][pDeaths],PlayerInfo[playerid][pAdmin],
      PlayerInfo[playerid][pGM],PlayerInfo[playerid][pPremium],PlayerInfo[playerid][pCash],PlayerInfo[playerid][Factionid], PlayerInfo[playerid][pSQLId]);
    mysql_query(query);
    return 1;
}
And ofcourse I have the feild in the database.
Heres a SS of the database : http://nl.tinypic.com/r/1e9k77/6

If someone could help me track down why it wont save it would be a large help.

Reply
#2

Dont work that much with MySQL but in php the value should be in '' dunno about samp though.
Код:
SET rank='%d'
Reply
#3

Everything else saves fine execept Factionid.


EDIT: In the mysql_log theres:

Код:
02:53:00] mysql_query("SELECT * FROM `players` WHERE playerid=7 AND pass=MD5('*****') LIMIT 1"); Return: 1
[02:53:00] mysql_store_result();
[02:53:00] mysql_fetch_row_format(Delimiter: |); Return: "7|Jonas|adff855173c9b92b5478129af7d39e03|1|0|1250|15|47|0|0|2|0|0|0|0|0|32|0|0|0|90603|NULL"
[02:53:00] mysql_fetch_field_row(Field: "rank"); Return: "1"
[02:53:00] mysql_fetch_field_row(Field: "reborn"); Return: "0"
[02:53:00] mysql_fetch_field_row(Field: "exp"); Return: "1250"
[02:53:00] mysql_fetch_field_row(Field: "van"); Return: "15"
[02:53:00] mysql_fetch_field_row(Field: "kills"); Return: "47"
[02:53:00] mysql_fetch_field_row(Field: "tkills"); Return: "0"
[02:53:00] mysql_fetch_field_row(Field: "gkill"); Return: "0"
[02:53:00] mysql_fetch_field_row(Field: "mp5kill"); Return: "2"
[02:53:00] mysql_fetch_field_row(Field: "kkill"); Return: "0"
[02:53:00] mysql_fetch_field_row(Field: "mgoal"); Return: "0"
[02:53:00] mysql_fetch_field_row(Field: "hgoal"); Return: "0"
[02:53:00] mysql_fetch_field_row(Field: "agoal"); Return: "0"
[02:53:00] mysql_fetch_field_row(Field: "mapgoal"); Return: "0"
[02:53:00] mysql_fetch_field_row(Field: "deaths"); Return: "32"
[02:53:00] mysql_fetch_field_row(Field: "admin"); Return: "0"
[02:53:00] mysql_fetch_field_row(Field: "gm"); Return: "0"
[02:53:00] mysql_fetch_field_row(Field: "premium"); Return: "0"
[02:53:00] mysql_fetch_field_row(Field: "money"); Return: "90603"
[02:53:00] mysql_fetch_field_row(Field: "Factionid"); Return: "NULL"
[02:53:00] mysql_free_result();
[02:55:35] mysql_ping(); Return: 1
[02:55:35] mysql_query("UPDATE `players` SET rank=1,reborn=0,exp=1250,van=15,kills=47,tkills=0,gkill=0,mp5kill=2,kkill=0,mgoal=0,hgoal=0,agoal=0,mapgoal=0,deaths=32,admin=0,gm=0,premium=0,money=90603 Factionid =0 WHERE playerid=7");
[02:55:35] MySQL Query Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Factionid =0 WHERE playerid=7' at line 1 (Error ID 1064) -> Query returned false (0)
[02:55:35] mysql_ping(); Return: 1
[02:55:35] mysql_query("UPDATE `players` SET rank=1,reborn=0,exp=1250,van=15,kills=47,tkills=0,gkill=0,mp5kill=2,kkill=0,mgoal=0,hgoal=0,agoal=0,mapgoal=0,deaths=32,admin=0,gm=0,premium=0,money=90603 Factionid =0 WHERE playerid=7");
[02:55:35] MySQL Query Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Factionid =0 WHERE playerid=7' at line 1 (Error ID 1064) -> Query returned false (0)
[02:57:37] mysql_ping(); Return: 1
[02:57:37] mysql_query("UPDATE `players` SET rank=100,reborn=0,exp=120000,van=1,kills=7,tkills=0,gkill=0,mp5kill=1,kkill=0,mgoal=0,hgoal=0,agoal=0,mapgoal=0,deaths=11,admin=4,gm=0,premium=0,money=9972991 Factionid =7 WHERE playerid=1");
[02:57:37] MySQL Query Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Factionid =7 WHERE playerid=1' at line 1 (Error ID 1064) -> Query returned false (0)
[02:57:37] mysql_ping(); Return: 1
[02:57:37] mysql_query("UPDATE `players` SET rank=100,reborn=0,exp=120000,van=1,kills=7,tkills=0,gkill=0,mp5kill=1,kkill=0,mgoal=0,hgoal=0,agoal=0,mapgoal=0,deaths=11,admin=4,gm=0,premium=0,money=9972991 Factionid =7 WHERE playerid=1");
[02:57:37] MySQL Query Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Factionid =7 WHERE playerid=1' at line 1 (Error ID 1064) -> Query returned false (0)
[02:57:37] MySQL Query Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Factionid =7 WHERE playerid=1' at line 1 (Error ID 1064) -> Query returned false (0)
Reply
#4

where is Finvite[playerid] defined and value attached?
Reply
#5

ontop of the script with
new Finvite[MAX_PLAYERS];
Reply
#6

Fixed this, I messed up the query
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)