CreateDealership (Server Lagging) issue
#1

Hi,
When i tried to create a NEW dealership at my server. it makes my server lag even in creating/deleting car in the dealership like /createcdveh I think you guys experinced this issue too?. But others can fix it.

Is there any way to fix it ?

Here is my /createdealership code
Код:
CMD:createdealership(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] < 1337)
	{
		SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");
		return 1;
	}

	new string[128], price, radius, message[64];
	if(sscanf(params, "dds[64]", price, radius, message)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /createdealership [price] [radius] [message]");

	new Float:X,Float:Y,Float:Z;
	GetPlayerPos(playerid,X,Y,Z);
	new dealershipid = CreateCarDealership(X, Y, Z, radius, price, message);
	if(dealershipid == -1)
	{
		SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Car Dealerships limit reached.");
	}
	else
	{
		format(string, sizeof(string), " Car Dealership created with ID %d.", dealershipid);
		SendClientMessageEx(playerid, COLOR_GRAD1, string);
	}
	return 1;
}
Код:
CMD:destroydealership(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] < 1337)
	{
		SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");
		return 1;
	}

	new string[128], dealershipid;
	if(sscanf(params, "d", dealershipid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /destroydealership [dealershipid]");

	for(new d = 0 ; d < MAX_CARDEALERSHIPS; d++)
	{
		if(IsPlayerInRangeOfPoint(playerid, 3.0, CarDealershipInfo[d][cdEntranceX], CarDealershipInfo[d][cdEntranceY], CarDealershipInfo[d][cdEntranceZ]))
		{
			DestroyCarDealership(d);
			format(string, sizeof(string), " Car Dealership destroyed with ID %d.", d);
			SendClientMessageEx(playerid, COLOR_GRAD1, string);
			return 1;
		}
	}
	if(dealershipid > MAX_CARDEALERSHIPS) return 1;
	if(dealershipid < 0) return 1;
	DestroyCarDealership(dealershipid);
	format(string, sizeof(string), " Car Dealership destroyed with ID %d.", dealershipid);
	SendClientMessageEx(playerid, COLOR_GRAD1, string);
	return 1;
}
Код:
CMD:createcdveh(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] < 1337)
	{
		SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");
		return 1;
	}

	new string[128], price, dealershipid, modelid;
	if(sscanf(params, "ddd", price, dealershipid, modelid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /createcdveh [price] [dealership] [modelid]");

	new Float:X,Float:Y,Float:Z,Float:A;
	GetPlayerPos(playerid,X,Y,Z);
	GetPlayerFacingAngle(playerid, A);
	new cdvehicleid = CreateCarDealershipVehicle(dealershipid, modelid, X, Y, Z, A, price);
	if(cdvehicleid == -1)
	{
		SendClientMessageEx(playerid, COLOR_GREY, "ERROR: cdVehicles limit reached.");
	}
	else
	{
		format(string, sizeof(string), " Car Dealership Vehicle created with ID %d.", cdvehicleid);
		SendClientMessageEx(playerid, COLOR_GRAD1, string);
	}
	return 1;
}
Код:
CMD:destroycdveh(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] < 1337)
	{
		SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");
		return 1;
	}

	new string[128], vehid;
	if(sscanf(params, "d", vehid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /destroycdveh [vehicleid]");

	DestroyCarDealershipVehicle(GetCarDealershipId(vehid), GetCarDealershipVehicleId(vehid));
	SavecDealership(GetCarDealershipId(vehid));
	format(string, sizeof(string), " Car Dealership Vehicle destroyed with ID %d.", vehid);
	SendClientMessageEx(playerid, COLOR_GRAD1, string);
	return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)