Simple Teleport System (With Dialog) -
Teemo - 09.06.2014
Introduction
First of all guys, Today i am going to show you how to make a very simple Teleport system (Dialogs).
What's it?
All you have to do is to enter the playerid in the below and He will be teleported to you
Things/Progams that you need
Just sscanf - Click here to download it.
ZCMD - Click here to download
Command Line:
pawn Код:
CMD:gethere(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2) //This is for admin rank, You don't need to use it.
{
ShowPlayerDialog(playerid, DIALOG_GETHERE, DIALOG_STYLE_INPUT, "Enter the playerid", "Please make sure the player you wish to teleport to your position is online.\nPlease input the playerid below of the player you wish to teleport.", "Teleport", "Cancel");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
}
return 1;
}
In this step, You need to enter the playerid in the below.
Now OnDialogResponse:
pawn Код:
if(response)
{
new id, Float:x, Float:y, Float:z;
if(id != INVALID_PLAYER_ID)
{
ShowPlayerDialog(playerid, DIALOG_GETHERE, DIALOG_STYLE_INPUT, "Enter the playerID", "You entered a wrong PlayerID\nPlease Enter the playerid that you wish to teleport him to your position.", "Teleport", "Cancel");
}
else
{
if(GetPlayerState(id) == PLAYER_STATE_SPECTATING)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "That person is spectating someone.");
return 1;
}
SetPlayerVirtualWorld(id, PlayerInfo[playerid][pVW]);
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(id, x, y+2, z);
if (GetPlayerState(id) == 2)
{
fVehSpeed[id] = 0.0;
new tmpcar = GetPlayerVehicleID(id);
SetVehiclePos(tmpcar, x, y+4, z);
LinkVehicleToInterior(GetPlayerVehicleID(id), GetPlayerInterior(playerid));
SetPlayerInterior(id, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(GetPlayerVehicleID(id), GetPlayerVirtualWorld(playerid));
SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(playerid));
}
else
{
SetPlayerPos(id,x,y+2, z);
SetPlayerInterior(id, GetPlayerInterior(playerid));
SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(playerid));
}
}
}
return true;
}
In this step, When you enter the playerid in the below, He will be teleported to you, Take a look at this line:
pawn Код:
SetPlayerPos(id,x,y+2, z);
SetPlayerInterior(id, GetPlayerInterior(playerid));
SetPlayerVirtualWorld(id, GetPlayerVirtualWorld(playerid));
We defined the players's float, Take a look:
pawn Код:
new id, Float:x, Float:y, Float:z;
Well I think That's the end
, I hope this helped you
Re: Simple Teleport System (With Dialog) -
TakeiT - 09.06.2014
Nice tutorial, but why would you use a dialog instead of sscanf?
Re: Simple Teleport System (With Dialog) -
Teemo - 09.06.2014
A new system instead of that old /gethere [playerid]
Re: Simple Teleport System (With Dialog) -
psoni9697 - 09.06.2014
Good
Re: Simple Teleport System (With Dialog) -
Zorono - 15.04.2016
You Copied/Stolen It From An RP gamemode
Re: Simple Teleport System (With Dialog) -
REMAK3 - 26.04.2016
Good job!
Re: Simple Teleport System (With Dialog) -
Infinity - 26.04.2016
This is not a tutorial. In a tutorial you explain what you did and why one should do it. This is basically a code snippit. (With horrible indentation, no less)
Re: Simple Teleport System (With Dialog) -
Ryan_Bowe - 02.05.2016
Lol, you call this a tutorial?