SA-MP Forums Archive
Spawn cars - 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: Spawn cars (/showthread.php?tid=606238)



Spawn cars - Micko123 - 01.05.2016

Hey guys
Код:
CMD:qw(playerid)
{
	new Float:x;
	new Float:y;
	new Float:z;
	new Float:a;
	GPP(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, a);
	new car = AddStaticVehicleEx(400, x+1, y+1, z, a, -1, -1, 1);
	vehicle3Dtext[car] = Create3DTextLabel("LANDSTALKER", 0xFF0000AA, 0.0, 0.0, 0.0, 20.0, 0, 1);
	Attach3DTextLabelToVehicle(vehicle3Dtext[car], car, 0.0, 0.0, 0.0);
	PutPlayerInVehicle(playerid, car, 0);
	SCM(playerid, 0xF81414, "Spawnovali ste Landstalkera");
	return 1;
}
With command above i spawn Landstalker but there is problem. When i type "qw" again it will spawn another landstalker near and another and another. How can i make if player is not in vehicle for x sec it will just dissapear from map??


Re: Spawn cars - oMa37 - 01.05.2016

SetTimer
OnPlayerExitVehicle
KillTimer
DestroyVehicle


Re: Spawn cars - Micko123 - 01.05.2016

Код:
CMD:qw(playerid)
{
	new Float:x;
	new Float:y;
	new Float:z;
	new Float:a;
	GPP(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, a);
	DestroyVehicle(pCar[playerid]);
	new car = CreateVehicle(400, x+1, y+1, z, a, -1, -1, 1);
	vehicle3Dtext[car] = Create3DTextLabel("LANDSTALKER", 0xFF0000AA, 0.0, 0.0, 0.0, 20.0, 0, 1);
	Attach3DTextLabelToVehicle(vehicle3Dtext[car], car, 0.0, 0.0, 0.0);
	PutPlayerInVehicle(playerid, car, 0);
	pCar[playerid] = GetPlayerVehicleID(playerid);
	SCM(playerid, 0xF81414, "Spawnovali ste Landstalkera");
	return 1;
}
Don't worry i've dont it. Now when he spawnes another vehicle first one will get destorey But thanks