• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Server] Buying from biz crash server.
#1
PHP Code:
CMD:buy(playeridparams[]) 



? ?static 

? ? ? ?
id = -1



? ?if ((
id House_Nearest(playerid)) != -1

? ?{ 

? ? ? ?if (
House_GetCount(playerid) >= MAX_OWNABLE_HOUSES

? ? ? ? ? ?return 
SendErrorMessage(playerid"You can only own %d houses at a time."MAX_OWNABLE_HOUSES); 



? ? ? ?if (
HouseData[id][houseOwner] != 0

? ? ? ? ? ?return 
SendErrorMessage(playerid"This house is already owned at the moment."); 



? ? ? ?if (
HouseData[id][housePrice] > GetMoney(playerid)) 

? ? ? ? ? ?return 
SendErrorMessage(playerid"You have insufficient funds for the purchase."); 



? ? ? ?
HouseData[id][houseOwner] = GetPlayerSQLID(playerid); 



? ? ? ?
House_Refresh(id); 

? ? ? ?
House_Save(id); 



? ? ? ?
GiveMoney(playerid, -HouseData[id][housePrice]); 

? ? ? ?
SendServerMessage(playerid"You have purchased \"%s\" for %s!"HouseData[id][houseAddress], FormatNumber(HouseData[id][housePrice])); 



? ? ? ?
ShowPlayerFooter(playerid"You have ~g~purchased~w~ a house!"); 

? ? ? ?
Log_Write("logs/house_log.txt""[%s] %s has purchased house ID: %d for %s."ReturnDate(), ReturnName(playerid), idFormatNumber(HouseData[id][housePrice])); 

? ?} 

? ?else if ((
id Business_Nearest(playerid)) != -1

? ?{ 

? ? ? ?if (
Business_GetCount(playerid) >= MAX_OWNABLE_BUSINESSES

? ? ? ? ? ?return 
SendErrorMessage(playerid"You can only own %d businesses at a time."MAX_OWNABLE_BUSINESSES); 



? ? ? ?if (
BusinessData[id][bizOwner] != 0

? ? ? ? ? ?return 
SendErrorMessage(playerid"This business is already owned at the moment."); 



? ? ? ?if (
BusinessData[id][bizPrice] > GetMoney(playerid)) 

? ? ? ? ? ?return 
SendErrorMessage(playerid"You have insufficient funds for the purchase."); 



? ? ? ?
BusinessData[id][bizOwner] = GetPlayerSQLID(playerid); 



? ? ? ?
Business_Refresh(id); 

? ? ? ?
Business_Save(id); 



? ? ? ?
GiveMoney(playerid, -BusinessData[id][bizPrice]); 

? ? ? ?
SendServerMessage(playerid"You have purchased \"%s\" for %s!"BusinessData[id][bizName], FormatNumber(BusinessData[id][bizPrice])); 



? ? ? ?
ShowPlayerFooter(playerid"You have ~g~purchased~w~ a business!"); 

? ? ? ?
Log_Write("logs/biz_log.txt""[%s] %s has purchased business ID: %d for %s."ReturnDate(), ReturnName(playerid), idFormatNumber(BusinessData[id][bizPrice])); 

? ?} 

? ?else if ((
id Business_Inside(playerid)) != -1

? ?{ 

? ? ? ?if (
BusinessData[id][bizLocked] != || !BusinessData[id][bizOwner]) 

? ? ? ? ? ?return 
SendErrorMessage(playerid"This business is closed!"); 



? ? ? ?if (
BusinessData[id][bizType] == 5) { 

? ? ? ? ? ?
Business_CarMenu(playeridid); 

? ? ? ?} else { 

? ? ? ? ? ?
Business_PurchaseMenu(playeridid); 

? ? ? ?} 

? ?} 

? ?return 
1





PHP Code:
Business_ProductMenu(playeridbizid



? ?if (
bizid == -|| !BusinessData[bizid][bizExists]) 

? ? ? ?return 
0



? ?static 

? ? ? ?
string[512]; 



? ?switch (
BusinessData[bizid][bizType]) 

? ?{ 

? ? ? ?case 
16

? ? ? ?{ 

? ? ? ? ? ?
format(stringsizeof(string), "Mobile Phone - %s\nGPS System - %s\nSpray Paint - %s\nBackpack - %s\nWater Bottle - %s\nSoda Bottle - %s\nLottery Ticket - %s\nPortable Radio - %s\nCan of Fuel - %s\nCrowbar - %s\nBoombox - %s\nMask - %s\nFirst Aid Kit - %s\nRepair Kit - %s\nNOS Canister - %s\nBaseball Bat - %s\nFrozen Pizza - %s\nFrozen Burger - %s"

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][0]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][1]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][2]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][3]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][4]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][5]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][6]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][7]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][8]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][9]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][10]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][11]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][12]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][13]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][14]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][15]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][16]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][17]) 

? ? ? ? ? ?); 

? ? ? ? ? ?
Dialog_Show(playeridEditProductDIALOG_STYLE_LIST"Business: Modify Item"string"Modify""Cancel"); 

? ? ? ?} 

? ? ? ?case 
2

? ? ? ?{ 

? ? ? ? ? ?
format(stringsizeof(string), "Magazine - %s\nAmmo Cartridge - %s\nArmored Vest - %s\nDesert Eagle - %s\nRemington 870 - %s\nM14 Rifle - %s"

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][0]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][1]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][2]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][3]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][4]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][5]) 

? ? ? ? ? ?); 

? ? ? ? ? ?
Dialog_Show(playeridEditProductDIALOG_STYLE_LIST"Business: Modify Item"string"Modify""Cancel"); 

? ? ? ?} 

? ? ? ?case 
3

? ? ? ?{ 

? ? ? ? ? ?
format(stringsizeof(string), "Clothes - %s\nGlasses - %s\nHats - %s\nBandana - %s"

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][0]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][1]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][2]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][3]) 

? ? ? ? ? ?); 

? ? ? ? ? ?
Dialog_Show(playeridEditProductDIALOG_STYLE_LIST"Business: Modify Item"string"Modify""Cancel"); 

? ? ? ?} 

? ? ? ?case 
4

? ? ? ?{ 

? ? ? ? ? ?
format(stringsizeof(string), "Water - %s\nSoda - %s\nFrench Fries - %s\nCheeseburger - %s\nChicken Burger - %s\nChicken Nuggets - %s\nSalad - %s"

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][0]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][1]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][2]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][3]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][4]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][5]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][6]) 

? ? ? ? ? ?); 

? ? ? ? ? ?
Dialog_Show(playeridEditProductDIALOG_STYLE_LIST"Business: Modify Item"string"Modify""Cancel"); 

? ? ? ?} 

? ? ? ?case 
7

? ? ? ?{ 

? ? ? ? ? ?
string[0] = 0



? ? ? ? ? ?for (new 
0sizeof(g_aFurnitureTypes); ) { 

? ? ? ? ? ? ? ?
format(stringsizeof(string), "%s%s - %s\n"stringg_aFurnitureTypes[i], FormatNumber(BusinessData[bizid][bizPrices][i])); 

? ? ? ? ? ?} 

? ? ? ? ? ?
Dialog_Show(playeridEditProductDIALOG_STYLE_LIST"Business: Modify Item"string"Modify""Cancel"); 

? ? ? ?} 

? ?} 

? ?return 
1





Business_PurchaseMenu(playeridbizid



? ?if (
bizid == -|| !BusinessData[bizid][bizExists]) 

? ? ? ?return 
0



? ?static 

? ? ? ?
string[512]; 



? ?switch (
BusinessData[bizid][bizType]) 

? ?{ 

? ? ? ?case 
16

? ? ? ?{ 

? ? ? ? ? ?
format(stringsizeof(string), "Mobile Phone - %s\nGPS System - %s\nSpray Paint - %s\nBackpack - %s\nWater Bottle - %s\nSoda Bottle - %s\nLottery Ticket - %s\nPortable Radio - %s\nCan of Fuel - %s\nCrowbar - %s\nBoombox - %s\nMask - %s\nFirst Aid Kit - %s\nRepair Kit - %s\nNOS Canister - %s\nBaseball Bat - %s\nFrozen Pizza - %s\nFrozen Burger - %s"

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][0]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][1]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][2]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][3]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][4]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][5]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][6]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][7]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][8]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][9]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][10]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][11]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][12]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][13]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][14]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][15]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][16]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][17]) 

? ? ? ? ? ?); 

? ? ? ? ? ?
Dialog_Show(playeridBusinessBuyDIALOG_STYLE_LISTBusinessData[bizid][bizName], string"Purchase""Cancel"); 

? ? ? ?} 

? ? ? ?case 
2

? ? ? ?{ 

? ? ? ? ? ?
format(stringsizeof(string), "Magazine - %s\nAmmo Cartridge - %s\nArmored Vest - %s\nDesert Eagle - %s\nRemington 870 - %s\nM14 Rifle - %s"

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][0]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][1]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][2]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][3]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][4]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][5]) 

? ? ? ? ? ?); 

? ? ? ? ? ?
Dialog_Show(playeridBusinessBuyDIALOG_STYLE_LISTBusinessData[bizid][bizName], string"Purchase""Cancel"); 

? ? ? ?} 

? ? ? ?case 
3

? ? ? ?{ 

? ? ? ? ? ?
format(stringsizeof(string), "Clothes - %s\nGlasses - %s\nHats - %s\nBandana - %s"

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][0]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][1]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][2]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][3]) 

? ? ? ? ? ?); 

? ? ? ? ? ?
Dialog_Show(playeridBusinessBuyDIALOG_STYLE_LISTBusinessData[bizid][bizName], string"Purchase""Cancel"); 

? ? ? ?} 

? ? ? ?case 
4

? ? ? ?{ 

? ? ? ? ? ?
format(stringsizeof(string), "Water - %s\nSoda - %s\nFrench Fries - %s\nCheeseburger - %s\nChicken Burger - %s\nChicken Nuggets - %s\nSalad - %s"

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][0]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][1]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][2]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][3]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][4]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][5]), 

? ? ? ? ? ? ? ?
FormatNumber(BusinessData[bizid][bizPrices][6]) 

? ? ? ? ? ?); 

? ? ? ? ? ?
Dialog_Show(playeridBusinessBuyDIALOG_STYLE_LISTBusinessData[bizid][bizName], string"Purchase""Cancel"); 

? ? ? ?} 

? ? ? ?case 
7

? ? ? ?{ 

? ? ? ? ? ?
string[0] = 0



? ? ? ? ? ?for (new 
0sizeof(g_aFurnitureTypes); ) { 

? ? ? ? ? ? ? ?
format(stringsizeof(string), "%s%s - %s\n"stringg_aFurnitureTypes[i], FormatNumber(BusinessData[bizid][bizPrices][i])); 

? ? ? ? ? ?} 

? ? ? ? ? ?
Dialog_Show(playeridBusinessBuyDIALOG_STYLE_LISTBusinessData[bizid][bizName], string"Purchase""Cancel"); 

? ? ? ?} 

? ?} 

? ?return 
1

} ? 
  Reply
#2
What is the issue?
  Reply
#3
It's hard to tell where it crashes from the code alone. Do any of the client messages get sent out to the player before the crash happens? You need to be more specific if you can.
Stoned Ape

  Reply


Forum Jump: