SA-MP Forums Archive
vehicle&player 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: vehicle&player teleport (/showthread.php?tid=147996)



vehicle&player teleport - Kar - 15.05.2010

can someone make me a teleport that can tele vehicle and the players in the vehicle..


Re: vehicle&player teleport - [MWR]Blood - 15.05.2010

pawn Код:
if ( strcmp ( cmdtext , "/teleportname", true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
new State = GetPlayerState(playerid);
if (IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
{
LinkVehicleToInterior(vehicleid, 0);
SetPlayerInterior(playerid, 0);
SetVehicleZAngle(vehicleid,0);
return SetVehiclePos(vehicleid, X,Y,Z);
}else{
SetPlayerPos(playerid, X,Y,Z);
SetPlayerInterior(playerid, 0);
}
return 1;
}



Re: vehicle&player teleport - Kar - 15.05.2010

doesnt work.. brackets problem L


Re: vehicle&player teleport - [MWR]Blood - 15.05.2010

Quote:
Originally Posted by Kar
doesnt work.. brackets problem L
It works perfect for me dude, what errors do you get?


Re: vehicle&player teleport - Kar - 15.05.2010

this freezes when i compile

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if ( strcmp ( cmdtext , "/drift1", true)==0)
	{
	new vehicleid = GetPlayerVehicleID(playerid);
	new State = GetPlayerState(playerid);
	if (IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
	{
	LinkVehicleToInterior(vehicleid, 0);
	SetPlayerInterior(playerid, 0);
	SetVehicleZAngle(vehicleid,0);
	return SetVehiclePos(vehicleid, 329.3348,1536.3771,76.6117);
	}else{
	SetPlayerPos(playerid, 329.3348,1536.3771,76.6117);
	SetPlayerInterior(playerid, 0);
	}
	return 1;
}



Re: vehicle&player teleport - [MWR]Blood - 15.05.2010

pawn Код:
if ( strcmp ( cmdtext , "/drift1", true)==0)
    {
    new vehicleid = GetPlayerVehicleID(playerid);
    new State = GetPlayerState(playerid);
    if (IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
    {
    LinkVehicleToInterior(vehicleid, 0);
    SetPlayerInterior(playerid, 0);
    SetVehicleZAngle(vehicleid,0);
    SetVehiclePos(vehicleid, 329.3348,1536.3771,76.6117);
    }else{
    SetPlayerPos(playerid, 329.3348,1536.3771,76.6117);
    SetPlayerInterior(playerid, 0);
    }
    return 1;
}
Try now


Re: vehicle&player teleport - Kar - 15.05.2010

it works but now instead of getting teled to drift1 it teles me near area69 in the fly and i fall to death..

and i get this error "function "onplayercommandtext"should have a return value


Re: vehicle&player teleport - Zh3r0 - 15.05.2010

Quote:
Originally Posted by Kar
it works but now instead of getting teled to drift1 it teles me near area69 in the fly and i fall to death..

and i get this error "function "onplayercommandtext"should have a return value
You deleted something.
Also
at this line, the numbers
pawn Код:
SetPlayerPos(playerid, 329.3348,1536.3771,76.6117);
You set your own coordinates.


Re: vehicle&player teleport - Kar - 15.05.2010

i got rid of the error now it just teles me to the wrong place..


Re: vehicle&player teleport - Zh3r0 - 15.05.2010

Quote:
Originally Posted by Kar
i got rid of the error now it just teles me to the wrong place..
Seriously, do you even know how to get coordinates?

Use /save in game, go to your san andreas folder, open saveposition.txt get the coords, tha da.