Business not saving price or type of creation. -
I know it's stupid to use an update after inserting but got errors when adding it all in one line even when splitting it up. It just saves 0 into the database.
PHP код:
case 5:
{
new id = GetBusinesses();
SetPlayerPos(playerid, CreateEnterPos[playerid][0], CreateEnterPos[playerid][1], CreateEnterPos[playerid][2]);
BusinessInfo[id][EnterX] = CreateEnterPos[playerid][0];
BusinessInfo[id][EnterY] = CreateEnterPos[playerid][1];
BusinessInfo[id][EnterZ] = CreateEnterPos[playerid][2];
BusinessInfo[id][ExitX] = CreateExitPos[playerid][0];
BusinessInfo[id][ExitY] = CreateExitPos[playerid][1];
BusinessInfo[id][ExitZ] = CreateExitPos[playerid][2];
BusinessInfo[id][Int] = CreateInt[playerid];
BusinessInfo[id][Price] = CreatePrice[playerid];
BusinessInfo[id][Type] = CreateBType[playerid];
BusinessInfo[id][VW] = id;
BusinessInfo[id][Owned] = 0;
BusinessInfo[id][Locked] = 1;
BusinessInfo[id][Balance] = 0;
BusinessInfo[id][ID] = id;
format(BusinessInfo[id][Name], 256, PCreateName[playerid]);
new querylist[556];
mysql_format(mysql, querylist, sizeof(querylist), "INSERT INTO `businesses` (`ID`, `Name`, `EnterX`, `EnterY`, `EnterZ`, `ExitX`, `ExitY`, `ExitZ`, `Interior`, `VirtualWorld`)\
VALUES ('%d', '%e', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')", id, PCreateName[playerid], BusinessInfo[id][EnterX], BusinessInfo[id][EnterY], BusinessInfo[id][EnterZ], BusinessInfo[id][ExitX], BusinessInfo[id][ExitY], BusinessInfo[id][ExitZ], BusinessInfo[id][Int], id);
mysql_query(mysql, querylist);
mysql_format(mysql, querylist, sizeof(querylist), "UPDATE `businesses` SET `Price` = %d, `Type` = %d `Owned` = %d, `Locked` = %d, `Balance` = %d WHERE `ID` = %d" , BusinessInfo[id][Price], BusinessInfo[id][Type], BusinessInfo[id][Owned], BusinessInfo[id][Locked], BusinessInfo[id][Balance], id);
mysql_query(mysql, querylist);
new string[256];
format(string, sizeof(string), "%s forsale $%d\nPress H to buy\nAlso /buy", PCreateName[playerid], BusinessInfo[id][Price]);
Business3D[id] = CreateDynamic3DTextLabel(string,0xFFFFFFFF,BusinessInfo[id][EnterX],BusinessInfo[id][EnterY],BusinessInfo[id][EnterZ]+0.75, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1, 100.0);
BusinessPickup[id] = CreateDynamicPickup(1272, 1, BusinessInfo[id][EnterX], BusinessInfo[id][EnterY], BusinessInfo[id][EnterZ], 0, 0, -1, 5.00, -1, 0);
SetPVarInt(playerid, "CreateType", 0);
format(string, sizeof(string), "Server: business %s has been created and saved. (ID:%d)", PCreateName[playerid], id);
SendClientMessage(playerid, COLOR_ORANGE, string);
SendClientMessage(playerid, COLOR_ORANGE, "Server: To edit the business type /edit then down to businesses");
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
}