Help Teleport
#1

i have a problem with my teleport when i'm in a car and make /lv its teleported to the lv place
but when i go out from my car and make /lv its not teleporter
Help me please

What is the problem:
Код:
	if(strcmp(cmd, "/lv", true) == 0)
	{
     	SetVehiclePos(GetPlayerVehicleID(playerid), 2030.837158, 1343.022338, 10.415551);
     	GameTextForPlayer(playerid, "~b~Las Venturas", 3000, 3);
		}
		else
		{
     	SetPlayerPos(playerid,2030.837158, 1343.022338, 10.415551);
     	GameTextForPlayer(playerid, "~b~Las Venturas", 3000, 3);
		}
		return 1;
	}
any suggestion to fix it please
Reply
#2

You have made a logical mistake. Whenever the player types /lv, the SetVehiclePos code is executed. Whenever the player types a command that is not recognized, the SetPlayerPos code is executed. You have no check in place to see whether or not the player is currently in a car.

The problem is probably made more clear by using proper indenting of your code: (this is not a fix, just the same code with good indenting)

Код:
  if(strcmp(cmd, "/lv", true) == 0)
  {
    SetVehiclePos(GetPlayerVehicleID(playerid), 2030.837158, 1343.022338, 10.415551);
    GameTextForPlayer(playerid, "~b~Las Venturas", 3000, 3);
  }
  else
  {
    SetPlayerPos(playerid,2030.837158, 1343.022338, 10.415551);
    GameTextForPlayer(playerid, "~b~Las Venturas", 3000, 3);
  }
  return 1;
}
Reply
#3

LOCKED I FIX IT
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)