SA-MP Forums Archive
Business not saving price or type of creation. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Business not saving price or type of creation. (/showthread.php?tid=663459)



Business not saving price or type of creation. - TheLeech - 01.02.2019

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(playeridCreateEnterPos[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], 256PCreateName[playerid]);
                    new 
querylist[556];
                    
mysql_format(mysqlquerylistsizeof(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')"
idPCreateName[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(mysqlquerylist);
                    
mysql_format(mysqlquerylistsizeof(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(mysqlquerylist);
                    new 
string[256];
                      
format(stringsizeof(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.755.0INVALID_PLAYER_IDINVALID_VEHICLE_ID100, -1100.0);
                       
BusinessPickup[id] = CreateDynamicPickup(12721BusinessInfo[id][EnterX], BusinessInfo[id][EnterY], BusinessInfo[id][EnterZ], 00, -15.00, -10);
                       
SetPVarInt(playerid"CreateType"0);
                       
format(stringsizeof(string), "Server: business %s has been created and saved. (ID:%d)"PCreateName[playerid], id);
                    
SendClientMessage(playeridCOLOR_ORANGEstring);
                    
SendClientMessage(playeridCOLOR_ORANGE"Server: To edit the business type /edit then down to businesses");
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }