SA-MP Forums Archive
SC-RP cmd:buy server crash help - 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: SC-RP cmd:buy server crash help (/showthread.php?tid=618204)



SC-RP cmd:buy server crash help - alexkeward - 02.10.2016

When i buy something in the store on the SC script, it crashes the server.

Here is the cmd:buy code.
Код:
CMD:buy(playerid, params[])
{
	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), id, FormatNumber(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), id, FormatNumber(BusinessData[id][bizPrice]));
	}
	else if ((id = Business_Inside(playerid)) != -1)
	{
		if (BusinessData[id][bizLocked] != 0 || !BusinessData[id][bizOwner])
		    return SendErrorMessage(playerid, "This business is closed!");

		if (BusinessData[id][bizType] == 5) {
		    Business_CarMenu(playerid, id);
		} else {
			Business_PurchaseMenu(playerid, id);
		}
	}
	return 1;
}



Re: SC-RP cmd:buy server crash help - SyS - 02.10.2016

use crash detect and whats is showing on your server log.
Most likely its an invalid file handling.


Re: SC-RP cmd:buy server crash help - alexkeward - 02.10.2016

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
use crash detect and whats is showing on your server log.
Most likely its an invalid file handling.
Im using Crashdetect, and it shows nothing in the logs but this, and this is what it says when the server is starting.
Код:
[17:27:22]    Error: Function not registered: 'SSCANF_Init'
[17:27:22]    Error: Function not registered: 'SSCANF_IsConnected'
[17:27:22]    Error: Function not registered: 'SSCANF_Join'
[17:27:22]    Error: Function not registered: 'SSCANF_Leave'
[17:27:22]    Error: Function not registered: 'Streamer_CallbackHook'
[17:27:22]    Error: Function not registered: 'WP_Hash'
[17:27:22]    Error: Function not registered: 'IsValidDynamicObject'
[17:27:22]    Error: Function not registered: 'DestroyDynamicObject'
[17:27:22]    Error: Function not registered: 'CreateDynamicObject'
[17:27:22]    Error: Function not registered: 'GetDynamicObjectPos'
[17:27:22]    Error: Function not registered: 'IsValidDynamicMapIcon'
[17:27:22]    Error: Function not registered: 'DestroyDynamicMapIcon'
[17:27:22]    Error: Function not registered: 'CreateDynamicMapIcon'
[17:27:22]    Error: Function not registered: 'SetDynamicObjectMaterial'
[17:27:22]    Error: Function not registered: 'SetDynamicObjectMaterialText'
[17:27:22]    Error: Function not registered: 'IsValidDynamic3DTextLabel'
[17:27:22]    Error: Function not registered: 'DestroyDynamic3DTextLabel'
[17:27:22]    Error: Function not registered: 'CreateDynamic3DTextLabel'
[17:27:22]    Error: Function not registered: 'IsValidDynamicPickup'
[17:27:22]    Error: Function not registered: 'DestroyDynamicPickup'
[17:27:22]    Error: Function not registered: 'CreateDynamicPickup'
[17:27:22]    Error: Function not registered: 'MoveDynamicObject'
[17:27:22]    Error: Function not registered: 'sscanf'
[17:27:22]    Error: Function not registered: 'UpdateDynamic3DTextLabelText'
[17:27:22]    Error: Function not registered: 'EditDynamicObject'
[17:27:22]    Error: Function not registered: 'CreateDynamicPickupEx'
[17:27:22]    Error: Function not registered: 'CreateDynamicObjectEx'
[17:27:22]    Error: Function not registered: 'SetDynamicObjectPos'
[17:27:22]    Error: Function not registered: 'Streamer_ToggleIdleUpdate'
[17:27:22]    Error: Function not registered: 'SetDynamicObjectRot'
[17:27:22]    Error: Function not registered: 'AttachDynamicObjectToVehicle'



Re: SC-RP cmd:buy server crash help - Rdx - 02.10.2016

Invalid streamer version.


Re: SC-RP cmd:buy server crash help - alexkeward - 02.10.2016

Quote:
Originally Posted by Rdx
Посмотреть сообщение
Invalid streamer version.
So i update and recompile?


Re: SC-RP cmd:buy server crash help - Quinncell - 02.10.2016

Do you have the latest plugins and includes?This problem usually occurs if your streamer plugin is outdated, so try to update it.


Re: SC-RP cmd:buy server crash help - alexkeward - 02.10.2016

Its okay, Im changing scripts over, Thanks for your help though.