foreach and mysql
#1

pawn Код:
public OnGameModeExit()
{
    foreach(Factory, f) { SavePlayerFactory(f); printf("saving: %i",f); }
 ...............................................
pawn Код:
stock SavePlayerFactory(factoryid)
{
    new factoryid2 = FactoryInfo[factoryid][fSQLID];
    format(string, sizeof(string), "UPDATE `factory` SET `X` = '%f', `Y` = '%f', `Z` = '%f', `Owner` = '%i', `Type` = '%i', `Stock` = '%f', `Bank` = '%i', `Lock` = '%i', `ProduceRate` = '%f', `Sell` = '%i' WHERE `SQLID` = '%d'",
        FactoryInfo[factoryid][fPos][0],FactoryInfo[factoryid][fPos][1], FactoryInfo[factoryid][fPos][2],
        FactoryInfo[factoryid][fOwnerID], FactoryInfo[factoryid][fType], FactoryInfo[factoryid][fStock], FactoryInfo[factoryid][fBank], FactoryInfo[factoryid][fLock], FactoryInfo[factoryid][ProduceRate],FactoryInfo[factoryid][fSell]/*FactoryInfo[factoryid][fBank], BusinessInfo[businessid][bSell]*/, factoryid2);
    mysql_query(string);
    mysql_free_result();
}
It doesn't save, it even doesnt print "saving: x"
Reply
#2

Gamemode closes before you even process with a single query.
I don't know why are you freeing result since you aren't evne saving it.
I also don't know why do you use '' for floats.
And I really don't know why you save everything when gamemdoe closes. If GF is doing that, it doesn't mean you should do it like that. Save things when they change.
Reply
#3

Quote:
Originally Posted by Sergei
Посмотреть сообщение
Gamemode closes before you even process with a single query.
I don't know why are you freeing result since you aren't evne saving it.
I also don't know why do you use '' for floats.
And I really don't know why you save everything when gamemdoe closes. If GF is doing that, it doesn't mean you should do it like that. Save things when they change.
How could i know that it's not saving it, and you're totally wrong that i took the idea from GF....
And i am not here to discuss how i script, that's my business how i script

Quote:

And I really don't know why you save everything when gamemdoe closes.

lol you even don't get what i am trying to do here

Suggestion:You should think more before posting false statements..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)