Help Teleport - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help Teleport (
/showthread.php?tid=64441)
Help Teleport -
gunit_j - 04.02.2009
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
Re: Help Teleport -
trc_ - 04.02.2009
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;
}
Re: Help Teleport -
gunit_j - 04.02.2009
LOCKED I FIX IT