Problem with cycles in OnGameModeInit()
#7

Please don't use a loop with mysql_query, fetch all the data at once with one query and then you won't need a loop. The function you have at the moment won't work anyway because you do not increase idx.

pawn Код:
stock LoadProperty()
{
    print("LoadProp funct started[DEBUG]");
    new idx, ss, res[256];
    mysql_query("SELECT * FROM DOM_server");
    mysql_store_result();
    while(mysql_retrieve_row())
    {
                sscanf(res,"p<|>dffffffs[24]dddddddddddffffdd",
                ss,
                HouseInfo[idx][hEntrancex],
                HouseInfo[idx][hEntrancey],
                HouseInfo[idx][hEntrancez],
                HouseInfo[idx][hExitx],
                HouseInfo[idx][hExity],
                HouseInfo[idx][hExitz],
                HouseInfo[idx][hOwner],
                HouseInfo[idx][hValue],
                HouseInfo[idx][hHel],
                HouseInfo[idx][hInt],
                HouseInfo[idx][hLock] ,
                HouseInfo[idx][hOwned] ,
                HouseInfo[idx][hTakings] ,
                HouseInfo[idx][hVec],
                HouseInfo[idx][hVcol1],
                HouseInfo[idx][hVcol2] ,
                HouseInfo[idx][hKlass],
                HouseInfo[idx][hVehSost] ,
                HouseInfo[idx][hCarx],
                HouseInfo[idx][hCary],
                HouseInfo[idx][hCarz],
                HouseInfo[idx][hCarc],
                HouseInfo[idx][hNarko],
                HouseInfo[idx][hMoney]);
                idx++;
                HouseInfo[idx][hPickup] = CreateDynamicPickup(1273,23,HouseInfo[idx][hEntrancex],HouseInfo[idx][hEntrancey],HouseInfo[idx][hEntrancez]);
                HouseInfo[idx][hMIcon] = CreateDynamicMapIcon(HouseInfo[idx][hEntrancex],HouseInfo[idx][hEntrancey],HouseInfo[idx][hEntrancez],31,COLOR_WHITE);
             
    }
    mysql_free_result();
    print("Property LOAD");
    return 1;
}
That should work now.
Reply


Messages In This Thread
Problem with cycles in OnGameModeInit() - by kamilot73 - 12.09.2012, 06:59
Re: Problem with cycles in OnGameModeInit() - by [HiC]TheKiller - 12.09.2012, 07:03
Re: Problem with cycles in OnGameModeInit() - by kamilot73 - 12.09.2012, 07:07
Re: Problem with cycles in OnGameModeInit() - by kamilot73 - 12.09.2012, 07:09
Re : Problem with cycles in OnGameModeInit() - by ricardo178 - 12.09.2012, 07:12
Re: Re : Problem with cycles in OnGameModeInit() - by kamilot73 - 12.09.2012, 07:18
Re: Problem with cycles in OnGameModeInit() - by [HiC]TheKiller - 12.09.2012, 07:21
Re: Problem with cycles in OnGameModeInit() - by kamilot73 - 12.09.2012, 07:23

Forum Jump:


Users browsing this thread: 1 Guest(s)