Teleport - ColdIce - 08.05.2011
Hello, How can I create a simple teleport? Is there any way to just add location of the teleport to the gamemode? Or someone can show me. I made a Hydra area on top of Chilliad mountain and I need a teleport to that place, like /hydra
Re: Teleport -
sleepysnowflake - 08.05.2011
Yeah, you can .... Watch :
You put this under
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
return 0;
}
pawn Код:
if(strcmp(cmdtext, "/hydra", true) == 0)
{
new pName[MAX_PLAYER_NAME];
new string [128];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "*** %s (ID: %d) went to /hydra ", pName, playerid);
SendClientMessageToAll(grey, string);
if(GetPlayerState(playerid) == 2)
{
SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
}
else
{
SetPlayerPos(playerid, x, y, z);
}
GameTextForPlayer(playerid, "~w~Hydra something ~B~ Have fun!", 4000, 6);
SetPlayerInterior(playerid, 0);
return 1;
}
If you want it NOT to teleport with vehicle delete the
pawn Код:
if(GetPlayerState(playerid) == 2)
{
SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
}
EDIT: Instead of x,y,z you put the coordinates where you want to teleport the player ...
TO DO that you gotta go in-game, go to that place, use /save and go to
Код:
C:\Users\Blue\Documents\GTA San Andreas User Files\SAMP
And open savedposition ...
You will find something like :
pawn Код:
--------------------x ---------y----------z------------------------------
AddPlayerClass(155,-1997.2323,567.0696,35.0156,74.2961,0,0,0,0,0,0);
You just take the x, y and z coordinates
Re: Teleport -
sleepysnowflake - 08.05.2011
Uh-huh. But if you want like if player goes to that place and if he is in a vehicle to loose that vehicle you just delete
pawn Код:
if(GetPlayerState(playerid) == 2)
{
SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
}
Re: Teleport -
vengeance89 - 08.05.2011
You could like this if you don't want your car links to you.
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/hydra", true) == 0)
{
SetPlayerPos(playerid, 2263.9978,1397.9921,42.8203);
GameTextForPlayer(playerid, "~w~ColdIce ~B~ Hydra!!! ", 500, 4);
SendClientMessageToAll(COLOR_GREEN, %s has teleported to Mount Chilliad /mcj);
return 1;
}
return 0;
}