Teleporting cars with the player to interiors... - 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: Teleporting cars with the player to interiors... (
/showthread.php?tid=88765)
Teleporting cars with the player to interiors... -
Anthony413 - 28.07.2009
Okay well I've successfully made the teleport work but my car turns invisible when I get there? I made this:
Код:
if(!strcmp(cmdtext,"/teleport4",true))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehiclePos(GetPlayerVehicleID(playerid), -1394.20, 987.62, 1023.96);
SetPlayerInterior(playerid, 15);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be the driver!");
SetPlayerInterior(playerid, 15);
return 1;
}
}
else
{
SetPlayerPos(playerid, -1394.20, 987.62, 1023.96);
}
return 1;
}
Is there like a SetVehicleInterior or something?
Thanks, Anthony.
Re: Teleporting cars with the player to interiors... -
refshal - 28.07.2009
https://sampwiki.blast.hk/wiki/LinkVehicleToInterior
Re: Teleporting cars with the player to interiors... -
boelie - 28.07.2009
Heres a piece of what i use
above ongamemodeinit;
then where you put all vehicles..
Код:
bloodring1 = AddStaticVehicle(502,-2175.7319,-382.5894,35.3296,179.9471,6,8); // carstadium2
LinkVehicleToInterior(bloodring1, 15);
Re: Teleporting cars with the player to interiors... -
Anthony413 - 28.07.2009
Quote:
Originally Posted by еddy
|
Thank you I finished it and it works.
Re: Teleporting cars with the player to interiors... -
pagie1111 - 28.07.2009
if you want to add cars to an interior from the startup of your script:
Код:
forward LinkCars();
//put here all your car defines:Example new Car1;
//then put them on the specified car " Car1 = AddStaticVehcile(.......
OnGameModeInit();
{
//all your stuff here then this
LinkCars();
return 1;
}
public LinkCars()
{
//here put the links EXAPMPLE: LinkVehicleToInterior(Car1, 15);
return 1;
}
The command you asked for:
Код:
if(!strcmp(cmdtext,"/teleport4",true))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Car;
Car = GetPlayerVehicleID(playerid);
LinkVehicleToInterior(Car,15);
SetVehiclePos(GetPlayerVehicleID(playerid), -1394.20, 987.62, 1023.96);
SetPlayerInterior(playerid, 15);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be the driver!");
SetPlayerInterior(playerid, 15);
return 1;
}
}
else
{
SetPlayerPos(playerid, -1394.20, 987.62, 1023.96);
}
return 1;
}
The Addition of:
Код:
new Car;
Car = GetPlayerVehicleId(playerid);
will detect the car the player is in at the time.
boeile's version can only allow THAT car to be TP'ed into the arena with the player.
Not sure if it works...... but you could try
EDIT: Tested, works