Problem with saving/loading
#1

Aigh so I have a problem with saving and loading a business system idk why it compiles correctly and I get 0 errors but it's not working.

here's the code
loading

Код:
stock LoadBusiness()
{
	new DB_Query[228];
	new string[500];
	for(new i; i <= MAX_BUSINESS; i++)
	{
	    mysql_format(Database, DB_Query, sizeof(DB_Query), "SELECT * FROM `BUSINESS` WHERE `ID` = '%d' LIMIT 1", i);
	    if(cache_num_rows() > 0)
		{
		    cache_get_value(i, "NAME", Business[i][Name], 128);
		    cache_get_value_int(i, "TYPE", Business[i][Type]);
		    cache_get_value_int(i, "PRODUCT", Business[i][Product]);
		    cache_get_value_int(i, "FEE", Business[i][Fee]);
		    cache_get_value_int(i, "SAFE", Business[i][Safe]);
		    cache_get_value_int(i, "OWNER", Business[i][Owner]);
		    cache_get_value_int(i, "VW", Business[i][Vw]);
		    cache_get_value_int(i, "INT", Business[i][Int]);
		    cache_get_value_int(i, "OWNER", Business[i][Owner]);
		    cache_get_value_int(i, "PRICE", Business[i][Price]);
		    cache_get_value_name_float(i, "PosX", Business[i][PosX]);
		    cache_get_value_name_float(i, "PosY", Business[i][PosY]);
		    cache_get_value_name_float(i, "PosZ", Business[i][PosZ]);
        	Business[i][Used] = true;
        	if(Business[i][Owner] != -1)
        	{
	        	format(string, sizeof(string),"\t ID : %d\nName : %s\nType : %s\nOwner : %s\nEntrance Fee : $ %d",i,Business[i][Name],GetBusinessType(Business[i][Type]),GetNameFromUniqueID(Business[i][Owner]),Business[i][Fee]);
	        	Business[i][BizText] = Create3DTextLabel(string, COLOR_ADMIN, Business[i][PosX], Business[i][PosX], Business[i][PosX], 10.0, Business[i][Vw], Business[i][Int]);
	        }
	        else
	        {
	            format(string, sizeof(string),"\t ID : %d\nName : NEW BUSINESS\nType : %s\nPrice : %d",i,GetBusinessType(Business[i][Type]),Business[i][Price]);
	            Business[i][BizText] = Create3DTextLabel(string, COLOR_ADMIN, Business[i][PosX], Business[i][PosX], Business[i][PosX], 10.0, Business[i][Vw], Business[i][Int]);
	        }
	        
        }
        else
        {
            Business[i][Used] = false;
        }
    }
    return 1;
}
and saving

Код:
stock SaveBusiness(bizid)
{
	if(Business[bizid][Used])
	{
	    new query[512];
	    format(query, sizeof(query),"UPDATE `BUSINESS` SET `NAME` = %s, `TYPE` = %d, `PRODUCT` = %d, `FEE` = %d, `OWNER` = %d, `SAFE` = %d, `VW` = %d, `INT` = %d, `PRICE` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f WHERE `ID` = %d LIMIT 1",
	    Business[bizid][Name],Business[bizid][Type],Business[bizid][Product],Business[bizid][Fee],Business[bizid][Owner], Business[bizid][Safe],Business[bizid][Vw], Business[bizid][Int], Business[bizid][Price],Business[bizid][PosX],Business[bizid][PosY],Business[bizid][PosZ],bizid);
	    mysql_query(Database, query);
	}
	return 1;
}
Help please.
Reply


Messages In This Thread
Problem with saving/loading - by Nru - 19.03.2018, 21:28
Re: Problem with saving/loading - by Chyakka - 19.03.2018, 23:24
Re: Problem with saving/loading - by Nru - 20.03.2018, 09:45
Re: Problem with saving/loading - by jasperschellekens - 20.03.2018, 10:03
Re: Problem with saving/loading - by Nru - 20.03.2018, 10:46
Re: Problem with saving/loading - by iKarim - 20.03.2018, 10:50
Re: Problem with saving/loading - by Nru - 20.03.2018, 10:56
Re: Problem with saving/loading - by kovac - 20.03.2018, 12:54
Re: Problem with saving/loading - by Nru - 20.03.2018, 13:23
Re: Problem with saving/loading - by Nru - 20.03.2018, 16:03

Forum Jump:


Users browsing this thread: 1 Guest(s)