cache_get_field_content
#1

Hello guys, i' m trying to make a business system, so i created a table in mysql, when i create a business by default the owner is "State" and the description is "None". I want to get the "state" and "none" from my mysql table. By default the row Owner is set to "State" and Description is "None". When im formatting the business description, the 3d text label is saying that : Owner: and Description: (owner and description is empty, but it should be state and none by default from mysql table)

Script:

Код:
CMD:createbiz(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid, COLOR_GREY, "Nu ai acces la aceasta comanda. ");
	new float:bEntryx, float:bEntryy, float:bEntryz, float:bExitx,float:bExity,float:bExitz, type, fee, description[64], owner[24];

	if(sscanf(params, "ii", type, fee)) return SCM(playerid, COLOR_GREY, "Usage: {FFFFFF}/createbiz <type>  <fee> (Type /bizztypes for info)");
	GetPlayerPos(playerid, Float:bEntryx, Float:bEntryy, Float:bEntryz);

	gQuery[0] = EOS;
	mysql_format(SQL, gQuery, sizeof(gQuery), "INSERT INTO `bizz` (`ID`, `Type`, `bEntryx`,	`bEntryy`, `bEntryz`, `bExitx`,  `bExity`, `bExitz`, `Fee`) VALUES (0, '%d', '%f', '%f', '%f', 0, 0, 0, '%d')", type, bEntryx, bEntryy, bEntryz, fee);
	mysql_tquery(SQL, gQuery, "", "");
	CreatePickup(1239, 1, Float:bEntryx, Float:bEntryy, Float:bEntryz, 0);
	new string[256];
	if(type == 1 )
	{
		cache_get_field_content(2, "Description", description);
		cache_get_field_content(2, "Owner", owner);
		format(string, 256, "{F2EA74}Business type: {74CFF2}24/7\n{F2EA74}Owner: {74CFF2}%s\n{F2EA74}Description: {74CFF2}%s\n{F2EA74}Entry Fee: {74CFF2}$%s",owner, description, FormatNumber(fee));
		Create3DTextLabel(string, -1, Float:bEntryx, Float:bEntryy, Float:bEntryz-0.150, 30, 0);
	}
	return 1;
}
And the mysql table:
Reply
#2

You cannot call cache functions to retrieve data without an active cache. You create the biz at that moment so you know it is not owned by any player but the State, just add the default values in format.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)