Teleporting with a car - 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: Teleporting with a car (
/showthread.php?tid=479845)
Teleporting with a car -
KingyKings - 07.12.2013
So i have looked at quite a lot of tutorials but still can't get it to work?
Here is the code:
Код:
if(strcmp(cmd, "/lsair", true) == 0) {
if(InDM[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "Please type /leavedm first!");
return 1;
}
else
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new getv = GetPlayerVehicleID(playerid);
SetVehiclePos(getv,1643.1212,-2419.4958,13.2818);
SetPlayerPos(playerid,1643.1212,-2419.4958,13.2818);
PutPlayerInVehicle(playerid,getv,0);
return 1;
}
else
{
SetPlayerPos(playerid, 1648.6609,-2414.7664,13.5547);
return 1;
}
}
}
It compiles fine but in game it doesn't work?
It is suppost to teleport WITH the car however it doesn't.
Any help appreciated!
Re: Teleporting with a car -
Konstantinos - 07.12.2013
pawn Код:
if(!strcmp(cmd, "/lsair", true))
{
if(InDM[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "Please type /leavedm first!");
switch(GetPlayerState(playerid))
{
case PLAYER_STATE_ONFOOT: SetPlayerPos(playerid, 1648.6609,-2414.7664,13.5547);
case PLAYER_STATE_DRIVER: SetVehiclePos(GetPlayerVehicleID(playerid),1643.1212,-2419.4958,13.2818);
case PLAYER_STATE_PASSENGER:
{
RemovePlayerFromVehicle(playerid);
SetPlayerPos(playerid, 1648.6609,-2414.7664,13.5547);
}
}
return 1;
}
Re: Teleporting with a car -
KingyKings - 07.12.2013
Thankyou so much for the help mate but it still appears not to be working O.o
I get in a vehicle types /lsair and it just teleports me without the car O>o
Re: Teleporting with a car -
Audi_Quattrix - 07.12.2013
try this:
pawn Код:
if(!strcmp(cmd, "/lsair", true))
{
if(InDM[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "Please type /leavedm first!");
switch(GetPlayerState(playerid))
{
case PLAYER_STATE_ONFOOT: SetPlayerPos(playerid, 1648.6609,-2414.7664,13.5547);
case PLAYER_STATE_DRIVER:
{
new veh = GetPlayerVehicleID(playerid);
SetVehiclePos(veh,1643.1212,-2419.4958,13.2818);
SetPlayerPos(playerid,1643.1212,-2419.4958,13.2818);
PutPlayerInVehicle(playerid,veh,0);
}
case PLAYER_STATE_PASSENGER:
{
RemovePlayerFromVehicle(playerid);
SetPlayerPos(playerid, 1648.6609,-2414.7664,13.5547);
}
}
return 1;
}
Re: Teleporting with a car -
KingyKings - 07.12.2013
That works, thankyou so much!
Re: Teleporting with a car -
Audi_Quattrix - 07.12.2013
No problem