Teleport to place/player and teleport player to you. [/goto][/gotoid][/gethere]
#1

if you want teleport to place:
Quote:

CMD:goto(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= /*put here admin level*/) // this if you want it only admins can teleport..
{
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}
if(isnull(params))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /goto [location]");
SendClientMessage(playerid, COLOR_GRAD1, "Locations: location1 , location2");
return 1;
}
if(strcmp(params,"put here after /goto [text/location name you want]",true) == 0)
{
if(GetPlayerState(playerid) == 2)
{
new tmpcar = GetPlayerVehicleID(playerid);
SetVehiclePos(tmpcar, // put here the positian that you want to go to [this because if you driving vehicle. to teleport with you]);
LinkVehicleToInterior(tmpcar, TeleportDestInt2[playerid]);
}
else
{
SetPlayerPos(playerid, // put here the positian that you want to go to);
}
SetPlayerInterior(playerid,TeleportDestInt2[playerid]);
PlayerInfo[playerid][pInt] = TeleportDestInt2[playerid];
SendClientMessage(playerid, COLOR_WHITE, "Your message after teleport.");
}
else if(strcmp(params,"put here after /goto [text/location name you want]",true) == 0)
{
if(GetPlayerState(playerid) == 2)
{
new tmpcar = GetPlayerVehicleID(playerid);
SetVehiclePos(tmpcar, // put here the positian that you want to go to [this because if you driving vehicle. to teleport with you]);
LinkVehicleToInterior(tmpcar, 0);
SetVehicleVirtualWorld(tmpcar, 0);
TelePos[playerid][0] = 0.0;TelePos[playerid][0] = 0.0;
fVehSpeed[playerid] = 0.0;
}
else
{
SetPlayerPos(playerid, // put here the positian that you want to go to);
}
SendClientMessage(playerid, COLOR_WHITE, "// your messge after teleport.");
SetPlayerInterior(playerid,0);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVW] = 0;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
}
return 1;
}

and this to teleport to player/id:
Quote:

CMD:gotoid(playerid, params[])
{
new giveplayerid;

if(sscanf(params, "u", giveplayerid))
return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid/partofname]");

new Floatlocx,Floatlocy,Floatlocz;
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[playerid][pAdmin] >= 2) //if you want admins only teleport to any player
{
return 1;
}
if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
{
SendClientMessage(playerid, COLOR_GRAD2, "That player is spectating someone.");
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
{
SendClientMessage(playerid, COLOR_GRAD2, "You can't do this while spectating.");
return 1;
}
GetPlayerPos(giveplayerid, plocx, plocy, plocz);
Streamer_UpdateEx(playerid, plocx, plocy, plocz);

if(GetPlayerState(playerid) == 2)
{
new tmpcar = GetPlayerVehicleID(playerid);
SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
fVehSpeed[playerid] = 0.0;
}
else
{
SetPlayerPos(playerid,plocx,plocy+2, plocz);
}

SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
new giveplayeridvw = GetPlayerVirtualWorld(giveplayerid);
new giveplayerint = GetPlayerInterior(giveplayerid);
PlayerInfo[playerid][pVW] = giveplayeridvw;
PlayerInfo[playerid][pInt] = giveplayerint;

SendClientMessage(playerid, COLOR_WHITE, "You have been teleported!");
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
}

}
else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}

and this to teleport and player/id to you:
Quote:

CMD:gethere(playerid, params[])
{
new giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gethere [playerid]");

new Floatlocx,Floatlocy,Floatlocz;
if (IsPlayerConnected(giveplayerid))
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin])
{
SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator.");
return 1;
}
if (PlayerInfo[playerid][pAdmin] >= 2) // if you want it admins only can use it
{
if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "That player is spectating someone.");
return 1;
}
GetPlayerPos(playerid, plocx, plocy, plocz);
Streamer_UpdateEx(giveplayerid, plocx, plocy, plocz);
SetPVarInt(playerid, "BeingTeleported", 1);
SetPlayerVirtualWorld(giveplayerid, PlayerInfo[playerid][pVW]);

PlayerInfo[giveplayerid][pLocal] = PlayerInfo[playerid][pLocal];

if (GetPlayerState(giveplayerid) == 2)
{
TelePos[giveplayerid][0] = 0.0;
TelePos[giveplayerid][1] = 0.0;
new tmpcar = GetPlayerVehicleID(giveplayerid);
SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
LinkVehicleToInterior(GetPlayerVehicleID(giveplaye rid), GetPlayerInterior(playerid));
SetPlayerInterior(giveplayerid, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(GetPlayerVehicleID(giveplay erid), GetPlayerVirtualWorld(playerid));
SetPlayerVirtualWorld(giveplayerid, GetPlayerVirtualWorld(playerid));
}
else
{
SetPlayerPos(giveplayerid,plocx,plocy+2, plocz);
SetPlayerInterior(giveplayerid, GetPlayerInterior(playerid));
SetPlayerVirtualWorld(giveplayerid, GetPlayerVirtualWorld(playerid));
}
GameTextForPlayer(playerid, "~w~Teleporting", 5000, 1);
SendClientMessageEx(giveplayerid, COLOR_GRAD1, " You have been teleported to the admin!");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}

}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}

if it helped you. +Rep me. thanks
Reply
#2

A couple of things regarding this;
- This wont work with other peoples codes, cause there are some functions most people don't have.
- This can be made as a much smaller code.
- Incorrect board.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)