Help With Deleting Car When Teleporting
#1

I got this code:

Код:
  	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;
	  }
But the DestroyVehicle(GetPlayerVehicleID(playerid)); work but the Vehicle doesn't spawn back... it delete the vehicle until i restart the server...

Is there a way to fix it?

Sorry for my english?
Reply
#2

Try this.

pawn Код:
if(strcmp(cmdtext, "/bmx1", true) == 0)
{
  new vehicle = GetPlayerVehicleID(playerid);
  if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  {
    SetVehiclePos(vehicle, 1964.5905,1923.5120,130.9375);
    LinkVehicleToInterior(vehicle, 0);
  }
  else
  {
    SetVehicleToRespawn(vehicle);
    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


Forum Jump:


Users browsing this thread: 1 Guest(s)