Setting IDs
#1

I have this:
Код:
db_get_field_assoc(Result, "ID", string, 3); PlayerInfo[pid][pID] = strval(string);
But it sets PlayerInfo[pid][pID] to a random number, like, its fine in the database, though when I do a command to check this ID it said 0, even though the ID was 2. When I logged out, it saved it as ID 6, what's going on here?
Reply
#2

Show the query that's being executed.
Reply
#3

pawn Код:
stock SavePlayer(playerid)
{
    new Query[1000], logstring[100];
    PlayerInfo[pid][pSkin] = GetPlayerSkin(pid);
    PlayerInfo[pid][pCash] = GetPlayerMoney(pid);
    PlayerInfo[pid][pLevel] = GetPlayerScore(pid);
    PlayerInfo[pid][pName] = GetName(pid);
    format(Query, sizeof(Query), "UPDATE ACCOUNTS SET PASSWORD = '%s', CASH = %d, NAME = '%s', ADMIN = %d, DEV = %d, HELPER = %d, VIP = %d, LEVEL = %d, XPOS = %4f, YPOS = %4f, ZPOS = %4f, NUMBER = %d, PTIME = %d, BANNED = %d, SEX = %d, TUT = %d, FACTION = %d, FACLEVEL = %d, FACRANK = '%s', PAYCHECK = %d, PAYDAY = %d, HOURS = %d, JAILED = %d, MASK = %d, JOB = %d, LICENSE = %d, CARKEY = %d, CARKEY2 = %d, CARKEY3 = %d, GUNLICENSE = %d, ARRESTED = %d, WALKIE = %d, BANREASON = '%s', GASCAN = %d, BANADMIN = '%s', BANDATE = '%s', SKIN = %d WHERE ID = %d",
    PlayerInfo[pid][pPassword], PlayerInfo[pid][pCash], PlayerInfo[pid][pName], PlayerInfo[pid][pAdmin], PlayerInfo[pid][pDev], PlayerInfo[pid][pHelper], PlayerInfo[pid][pVIP], PlayerInfo[pid][pLevel], PlayerInfo[pid][pPos_x], PlayerInfo[pid][pPos_y], PlayerInfo[pid][pPos_z], PlayerInfo[pid][pPnumber], PlayerInfo[pid][pCelltime], PlayerInfo[pid][pBanned], PlayerInfo[pid][pSex],
    PlayerInfo[pid][pTut], PlayerInfo[pid][pFaction], PlayerInfo[pid][pFLevel], PlayerInfo[pid][pFRank], PlayerInfo[pid][pPaycheck], PlayerInfo[pid][pPayday],
    PlayerInfo[pid][pHours], PlayerInfo[pid][pJailed], PlayerInfo[pid][pMask], PlayerInfo[pid][pJob], PlayerInfo[pid][pDrivLic], PlayerInfo[pid][pID],
    PlayerInfo[pid][pCarkey], PlayerInfo[pid][pCarkey2], PlayerInfo[pid][pCarkey3], PlayerInfo[pid][pGunLic], PlayerInfo[pid][pArrested], PlayerInfo[pid][pWalkie], PlayerInfo[pid][pBanReason], PlayerInfo[pid][pGasCan], PlayerInfo[pid][pBanAdmin], PlayerInfo[pid][pBanDate], PlayerInfo[pid][pSkin], PlayerInfo[pid][pID]);
    db_query(gamemode, Query);
    format(logstring, sizeof(logstring), "%s's info saved.", GetName(pid));
    print(logstring);
    print(Query);
    return 1;
}
Reply
#4

If that means account ID, why don't you set it as A_I (Auto increment) in the table ? So you won't need any stock or so.
Reply
#5

It is set to A_I, the stock is saving the player, it writes it to the wrong id and i dunno why
Reply
#6

bump-ady bump bump
Reply
#7

this is like super important, so if anyone can help me, please lemme know :P
Reply
#8

Anyone? D:
Reply
#9

Wow, I also am stuck with the same problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)