Help PLEASE! -
Healian - 17.08.2012
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);
Re: Help PLEASE! -
Healian - 17.08.2012
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
Re: Help PLEASE! -
SuperViper - 17.08.2012
%s is used for strings, not integers. For integers, you must use %d.
Re: Help PLEASE! -
Healian - 17.08.2012
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 ?
Re: Help PLEASE! -
Sandiel - 17.08.2012
Use %d or %i for integers, not %s, %s is for strings.
Hope this helps
Re: Help PLEASE! -
Healian - 17.08.2012
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 ?
Re: Help PLEASE! -
Sandiel - 17.08.2012
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.