Shops not spawning
#1

So basically, I made a code to create dynamic credit shop places, the code works fine but the problem is, when I save the stuff to my mysql DB, (The coords and all the info correctly appears in the mysql) but when I start my script, it says it has loaded all of the rows reguardless of if there is data in it, and even the rows that have coords listed, when I login and /gotoco, the point will not be there... Code below

Under on gamemodeinit

LoadCreditShops();

pawn Код:
stock LoadCreditShops()
{
    printf("[LoadCreditShops] Loading data from database...");
    mysql_function_query(MainPipeline, "SELECT * FROM `creditshops`", true, "OnLoadCreditShops", "");
}

forward OnLoadCreditShops();
public OnLoadCreditShops()
{
    new string[512], iIndex = 0;
    new rows, fields;
    cache_get_data(rows, fields, MainPipeline);

    while(iIndex<rows)
    {
        for(new field;field<fields;field++)
        {
            cache_get_row(iIndex, field, string, MainPipeline);
            switch(field)
            {
                case 0: CreditInfo[iIndex][csSQLId] = strval(string);
                case 1: format(CreditInfo[iIndex][csDescription], 128, "%s", string);
                case 2: CreditInfo[iIndex][csType] = strval(string);
                case 3: CreditInfo[iIndex][csExteriorVW] = strval(string);
                case 4: CreditInfo[iIndex][csExteriorInt] = strval(string);
                case 5: CreditInfo[iIndex][csExteriorX] = floatstr(string);
                case 6: CreditInfo[iIndex][csExteriorY] = floatstr(string);
                case 7: CreditInfo[iIndex][csExteriorZ] = floatstr(string);
                case 8: CreditInfo[iIndex][csColor] = strval(string);
                case 9: CreditInfo[iIndex][csModel] = strval(string);
            }
        }
        CreateCreditShop(iIndex);
        iIndex++;
    }
    if(iIndex > 0) printf("[LoadCreditShops] %d Credit Shops rehashed/loaded.", iIndex);
    else printf("[LoadDynamicTexts] Failed to load any Text Lables.");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)