23.01.2019, 19:59
So my businesses aren't saving into my database but I copy and pasted the code to save buildings and edited the values to be set to the business ones yet not saving when buildings do? And my dialog for setting the business price doesn't work, Keeps opening it up again no matter what I set price too.
Code:
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; 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', '%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 WHERE `ID` = %d" , BusinessInfo[id][Name], BusinessInfo[id][Type], 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, 25.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]); 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); }
Code:
case CreateBusinessPrice: { if(!response) { ShowPlayerDialog(playerid, CreateBusinessPrice, DIALOG_STYLE_INPUT, "Business Price", "Please type a price for the business below example: 125000.", "Accept", "Close"); } else { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, CreateBusinessPrice, DIALOG_STYLE_INPUT, "Business Price", "Please type a price for the business below example: 125000.", "Accept", "Close"); if(strlen(inputtext) >= 3) return ShowPlayerDialog(playerid, CreateBusinessPrice, DIALOG_STYLE_INPUT, "Business Price", "Please type a price for the business below example: 125000.", "Accept", "Close"); new amount = strval(inputtext); if(amount >= 99999999) return ShowPlayerDialog(playerid, CreateBusinessPrice, DIALOG_STYLE_INPUT, "Business Price", "Please type a price for the business below example: 125000.", "Accept", "Close"); new price = strval(inputtext); if(price > 0) { CreatePrice[playerid] = amount; SendClientMessage(playerid, COLOR_ORANGE, "Server: Business price has been set."); } else ShowPlayerDialog(playerid, CreateBusinessPrice, DIALOG_STYLE_INPUT, "Business Price", "Please type a price for the business below example: 125000.", "Accept", "Close"); } }