Teleport Only Me And Not The Car
#1

I got this codes:
Код:
if(strcmp(cmdtext, "/bmx1", true) == 0)
	  {

			if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	    {
				SetPlayerPos(playerid, 1964.5905,1923.5120,130.9375);
	 			DestroyVehicle(GetPlayerVehicleID(playerid));
	 			LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
			}
	    else
	    {
	      DestroyVehicle(GetPlayerVehicleID(playerid));
	    	SetPlayerPos(playerid, 1964.5905,1923.5120,130.9375);
	    }
			GameTextForPlayer(playerid, ".:::::BMX 1:::::.",1500,5);
			SendClientMessage(playerid, COLOR_YELLOW, "TELEPORTED TO /BMX1 .");
			TogglePlayerControllable(playerid, 1);
	 		SetPlayerInterior(playerid, 0);
			ResetPlayerWeapons(playerid);
			return 1;
	  }
It work but the car doesn't spawn back....... I need to restart my server to repawn the vehicle....
Sorry for my english
Reply
#2

Try adding your vehicle with AddStaticVehicleEx - It respawns them, and you choose when https://sampwiki.blast.hk/wiki/AddStaticVehicleEx
Reply
#3

If you destroy the vehicles, they won't respawn. Use SetVehicleToRespawn to force the respawning.
Reply
#4

how do i that with SetVehicleToRespawn?
Reply
#5

Quote:
Originally Posted by Smiths
how do i that with SetVehicleToRespawn?
Have you tried the AddStaticVehicleEx ? It should do the job :P
Reply
#6

Im using this....
CreateVehicle(481,1966.2937,1917.5670,130.4553,29. 8565,0,0, 10); //

So i only change CreateVehicle to AddStaticVehicleEx
Reply
#7

Try changing the delay to 60, tho it's not the fix lol.

Strange..It should work. But try with the 60 seconds and then AddStaticVehicleEx, yes you just replace the name.
Reply
#8

It doesn't work... it do the same thing.... It delete the vehicle but it doesn't spawn back!

is there any code who do the same thing like DestroyVehicle(GetPlayerVehicleID(playerid)); ??
Reply
#9

Код:
if(strcmp(cmdtext, "/bmx1", true) == 0)
{
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		RemovePlayerFromVehicle(playerid); // or delete this line if dont works
		SetVehicleToRespawn(GetPlayerVehicleID(playerid));
		LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
		SetPlayerPos(playerid, 1964.5905,1923.5120,130.9375);
	}else{
		SetPlayerPos(playerid, 1964.5905,1923.5120,130.9375);
	}
	GameTextForPlayer(playerid, ".:::::BMX 1:::::.",1500,5);
	SendClientMessage(playerid, COLOR_YELLOW, "TELEPORTED TO /BMX1 .");
	TogglePlayerControllable(playerid, 1);
	SetPlayerInterior(playerid, 0);
	ResetPlayerWeapons(playerid);
	return 1;
}
Reply
#10

DestroyVehicle doesn't respawn the vehicle. Use SetVehicleToRespawn. https://sampwiki.blast.hk/wiki/SetVehicleToRespawn
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)