Car Spawn Command bugged?
#1

Hi, when someone spawns a car, everythings is ok but sometimes it destroys that car, or makes tp to another player with spawned car.
What is wrong with my command:
Код:
COMMAND:car(playerid, params[])
{
	new cmdtext[255];
	if(sscanf(params, "s[255]", cmdtext))
	{
		SendClientMessage(playerid, COLOR_ERROR, " (bі№d) Wpisz: /car [nazwa]");
		return 1;
	}

	if(GetPlayerMoney(playerid) < CAR_PRICE && !Player[playerid][Vip] && !IsAdmin(playerid))
	{
		SendClientMessage(playerid, COLOR_ERROR, " (bі№d) Auto kosztuje 10000$. Nie masz tyle kasy.");
		return 1;
	}

	new CarName[255];
	CarName = StrToLower(cmdtext);
	new Model = -1;

	for(new Order = 0; Order < sizeof(VehicleNames); Order++)
	{
	  new RowCar[255];
	  RowCar = StrToLower(VehicleNames[Order]);
	  if(MyStrCmp(CarName, RowCar) || (strlen(CarName) > 2 && MyStrFind(RowCar, CarName) == 0))
	  {
			Model = Order+400;
			break;
	  }
	}

	if(Model < 0)
	{
		SendClientMessage(playerid, COLOR_ERROR, " (bі№d) Nie ma takiego pojazdu.");
		return 1;
	}

	if(!Player[playerid][Vip] || (Player[playerid][Vip] && Model != 520))
	{
		for(new Order = 0; Order < sizeof(InvalidVehicles); Order++)
		{
			if(Model == InvalidVehicles[Order])
			{
				SendClientMessage(playerid, COLOR_ERROR, " (bі№d) Ten pojazd zostaі zakazany przez administratora.");
			  return 1;
			}
		}
	}

	new Float:PlayerPos[4];
	GetPlayerPos(playerid, PlayerPos[0], PlayerPos[1], PlayerPos[2]);
	GetPlayerFacingAngle(playerid, PlayerPos[3]);
	new PlayerWorld = GetPlayerVirtualWorld(playerid);

	SetPlayerPos(playerid, PlayerPos[0], PlayerPos[1], PlayerPos[2]+3.0);

	DestroyVehicle(Player[playerid][SpawnedCar]);
	Player[playerid][SpawnedCar] = CreateVehicle(Model, PlayerPos[0], PlayerPos[1], PlayerPos[2], PlayerPos[3], GetRandomColor(0, Model), GetRandomColor(1, Model), 3600);
	LinkVehicleToInterior(Player[playerid][SpawnedCar], Player[playerid][Interior]);
	SetVehicleVirtualWorld(Player[playerid][SpawnedCar], PlayerWorld);

	PutPlayerInVehicle(playerid, Player[playerid][SpawnedCar], 0);
	TextDrawHideForPlayer(playerid, adresik0);
  TextDrawHideForPlayer(playerid, adresik1);
  TextDrawHideForPlayer(playerid, adresik2);
  
  if(!Player[playerid][Vip] && !IsAdmin(playerid))
		GivePlayerMoney(playerid, -CAR_PRICE);

	SendClientMessage(playerid, JasnoNiebieski, " (info) Pojazd zostaі utworzony.");
	SendClientMessage(playerid, COLOR_GREEN, " (info) Koszt jednorazowego spawnu -10000$");

	return 1;
}
Redgards.
Reply
#2

Anybody?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)