Help PLEASE!
#1

i am retrieving the data from SQLLite and storing them into enum

like
pawn Код:
enum pINF
{
    prSTEP,
    pSQ,
    pSA,
    pIP,
    pRDATE,
    pADMINLVL,
    pVIPLVL,
    pPLAYERRANK,
    pWANTEDLVL,
    pSCORE,
    pMONEY,
    pKILLS,
    pDEATHS,
    pX,
    pY,
    pZ,
    pINTERIOR,
    pWORLD,
    pHEALTH,
    pARMOR,
    pSKIN,
    pWEAP1,
    pWEAP1A,
    pWEAP2,
    pWEAP2A,
    pWEAP3,
    pWEAP3A,
    pWEAP4,
    pWEAP4A,
    pWEAP5,
    pWEAP5A,
    pWEAP6,
    pWEAP6A,
    pVEHI1,
    pVEHI2,
    pVEHI3,
    pVEHI4,
    pVEHI5,
    pJAILED,
    pJAILTIME,
    pWARNINGS,
    pMUTED,
    pCOLOR
};

new pInfo[MAX_PLAYERS][pINF];
Then i want to save the data back from those enums to the database so i tried something like this but it totally saves wrong values with wrong characters

SAMPLE from my save command
pawn Код:
format(Query, sizeof(Query), "UPDATE `Misc` SET JAILED = '%s', JAILEDTIME = '%s', WARNINGS = '%s', MUTED = '%s', COLOR = '%s' WHERE `NAME` = '%s'", DB_Escape(pInfo[playerid][pVEHI1]), DB_Escape(pInfo[playerid][pJAILED]), DB_Escape(pInfo[playerid][pJAILTIME]), DB_Escape(pInfo[playerid][pWARNINGS]), DB_Escape(pInfo[playerid][pMUTED]), DB_Escape(pInfo[playerid][pCOLOR]), DB_Escape(pName));
    db_query(DATABASE, Query);
Reply
#2

Any help please i want to save the data from the enum to the database again how could i do that idk wth is wrong mwith my code it must save the data in the DB but it does not and when i try to print the

pawn Код:
pInfo[playerid][pMONEY] //which is supposed to be 500
ir prints

pawn Код:
и
Reply
#3

%s is used for strings, not integers. For integers, you must use %d.
Reply
#4

my god thank you ++REP

but another small suggestion please what is the best time to save whole char data is saving onplayerdisconnect a good choice ?
Reply
#5

Use %d or %i for integers, not %s, %s is for strings.
Hope this helps
Reply
#6

my god thank you ++REP

but another small suggestion please what is the best time to save whole char data is saving onplayerdisconnect a good choice ?
Reply
#7

Yes, OnPlayerDisconnect is the best function possible to save a player's variables, you can't find any better.

Код:
This forum requires that you wait 120 seconds between posts. Please try again in 62 seconds.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)