SA-MP Forums Archive
Can't RESPAWN filterscript's cars with /rac - 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: Can't RESPAWN filterscript's cars with /rac (/showthread.php?tid=435779)



Can't RESPAWN filterscript's cars with /rac - AlexSkyrise - 08.05.2013

Hi guys,


Why i cant Respawn the vehicles that created with AddStaticVehicleEx, AddStaticVehicle, CreateVehicle IN FILTERSCRIPT?
(im using Id while creating them)


Thanks


Re: Can't RESPAWN filterscript's cars with /rac - vvhy - 08.05.2013

Show the part where you are trying to respawn them.


Respuesta: Can't RESPAWN filterscript's cars with /rac - LoLeRo - 08.05.2013

Try using this:

Quote:

for(new cars=0; cars<MAX_VEHICLES; cars++)
{
SetVehicleToRespawn(cars);
}




Re: Can't RESPAWN filterscript's cars with /rac - AlexSkyrise - 08.05.2013

FS:
Код:
public OnFilterScriptInit()
{
	Vehicle1 = AddStaticVehicleEx(VEHICLE_PREMIER, 2051.8303, -1919.18, 13.30, 0.00, 1, 1, 15);
	Vehicle2 = AddStaticVehicleEx(VEHICLE_PREMIER, 2062.2217, -1919.19, 13.30, 0.00, 1, 1, 0);
	Vehicle3 = AddStaticVehicleEx(VEHICLE_PREMIER, 2069.4231, -1919.19, 13.30, 0.00, 1, 1, -1);
	Vehicle4 = CreateVehicle(VEHICLE_PREMIER, 2065.5669, -1904.50, 13.30, 180.00, 1, 1, 15);
	Vehicle5 = CreateVehicle(VEHICLE_PREMIER, 2059.1699, -1904.50, 13.30, 180.00, 1, 1, 0);
	Vehicle6 = CreateVehicle(VEHICLE_PREMIER, 2052.5505, -1904.50, 13.30, 180.00, 1, 1, -1);
	Vehicle7 = AddStaticVehicle(VEHICLE_PREMIER, 2065.5669, -1904.50, 13.30, 180.00, 1, 1);
	Vehicle8 = AddStaticVehicle(VEHICLE_PREMIER, 2059.1699, -1904.50, 13.30, 180.00, 1, 1);
	Vehicle9 = AddStaticVehicle(VEHICLE_PREMIER, 2052.5505, -1904.50, 13.30, 180.00, 1, 1);
	return 1;
}
Command in GM:
Код:
	if(!strcmp(cmd, "/respawnallcars", true) || !strcmp(cmd, "/rac", true))
	{
		if(Player[playerid][piAdminRank] >= RANK_STAFF_GA)
		{
			new bool:unwanted[MAXIMUM_VEHICLES];
			for(new P = 0; P < MAX_PLAYERS; P ++)
			{
				if(IsPlayerInAnyVehicle(P)) unwanted[GetPlayerVehicleID(P)] = true;
			}
			for(new V = 0; V < MAX_VEHICLES; V ++)
			{
				if(!unwanted[V]) SetVehicleToRespawn(V);
				if(CarInfo[V][tOwned] && CarInfo[V][tLicensePlate])
				{
					new plate[10];
					strmid(plate, CarInfo[V][tLicensePlate], 0, strlen(CarInfo[V][tLicensePlate]), 255);
					SetVehicleNumberPlate(V, plate);
				}
			}
			format(string, sizeof(string), "INFO: All unoccupied vehicles respawned by %s.", ReturnPlayerName(playerid, false));
			SendClientMessageToAll(COLOR_LIGHTRED, string);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "   You are not authorized to use this command.");
		}
		return 1;
	}



Respuesta: Can't RESPAWN filterscript's cars with /rac - LoLeRo - 08.05.2013

Try with this:
Quote:

if(!strcmp(cmd, "/respawnallcars", true) || !strcmp(cmd, "/rac", true))
{
if(Player[playerid][piAdminRank] >= RANK_STAFF_GA)
{
new bool:unwanted[MAXIMUM_VEHICLES];
for(new P = 0; P < MAX_PLAYERS; P ++)
{
if(IsPlayerInAnyVehicle(P)) unwanted[GetPlayerVehicleID(P)] = true;
}
for(new V = 0; V < MAX_VEHICLES; V ++)
{
if(!unwanted[V])
{
SetVehicleToRespawn(Vehicle1);
SetVehicleToRespawn(Vehicle2);
SetVehicleToRespawn(Vehicle3);
SetVehicleToRespawn(Vehicle4);
SetVehicleToRespawn(Vehicle5);
SetVehicleToRespawn(Vehicle6);
SetVehicleToRespawn(Vehicle7);
SetVehicleToRespawn(Vehicle8);
SetVehicleToRespawn(Vehicle9);
}
if(CarInfo[V][tOwned] && CarInfo[V][tLicensePlate])
{
new plate[10];
strmid(plate, CarInfo[V][tLicensePlate], 0, strlen(CarInfo[V][tLicensePlate]), 255);
SetVehicleNumberPlate(V, plate);
}
}
format(string, sizeof(string), "INFO: All unoccupied vehicles respawned by %s.", ReturnPlayerName(playerid, false));
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not authorized to use this command.");
}
return 1;
}

I dont know if that is the function you want to get, if it doesnt, please describe more what you want to do.


Re: Can't RESPAWN filterscript's cars with /rac - AlexSkyrise - 09.05.2013

Tnx for help, but im just want to respawn these cars (fs) in Gamemode(runtime). WO editing gamemode.
thats all


Respuesta: Can't RESPAWN filterscript's cars with /rac - LoLeRo - 09.05.2013

It will not respawn all cars, only will respawn Vehicle1-9 only if they are !unwanted.