[Tutorial] How to make "Teleport In Dialog"
#1

How to make a
♠ ♣ Teleport In Dialog ♥ ♦


//>> Hii guys , im going to show you how to make a Teleport in Dialog . . <<\\
//>> I making this to Show/Help a new scripter who dont know how to make Teleport in Dialog . . <<\\

//>> In this [Tutorial] im using ZCMD . . <<\\

//>> Requirement <<\\
//>> Zcmd Include's by Zeex <<\\
//>> https://sampforum.blast.hk/showthread.php?tid=91354 <<\\


>> Firstly, run your server as local host then join it , then go to anywhere you want it to teleported then /save [TeleportName]
>> and then goto Document/GTA San Andreas User Files/SAMP then open savedpositions.txt

>> It will be like this;

Code:
AddStaticVehicle(402,-1986.5483,305.5474,35.0071,227.2756,22,22); // sf
AddPlayerClass(0,-1969.0593,294.0901,35.1719,89.9102,0,0,0,0,0,0); // sf
AddStaticVehicle(402,1608.3900,-1719.7670,13.3786,179.2136,22,22); // ls
AddPlayerClass(0,1606.3514,-1739.5194,13.5469,42.2198,0,0,0,0,0,0); // ls
AddStaticVehicle(402,2128.2754,1333.6340,10.6558,88.7952,22,22); // lv
AddPlayerClass(0,2096.9543,1322.6205,10.8203,52.1985,0,0,0,0,0,0); // lv
AddStaticVehicle Information; https://sampwiki.blast.hk/wiki/AddStaticVehicle
Code:
Parameters:
(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2)
modelid	The Model ID for the vehicle.
Float:spawn_X	The X-coordinate for the vehicle.
Float:spawn_Y	The Y-coordinate for the vehicle.
Float:spawn_Z	The Z-coordinate for the vehicle.
Float:angle	Direction of vehicle - angle.
color1	The primary color ID.
color2	The secondary color ID.


Returns	The vehicle ID of the vehicle created.
AddPlayerClass Information; https://sampwiki.blast.hk/wiki/AddPlayerClass
Code:
Parameters:
(skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
skin	The skin which the player will spawn with.
Float:X	The X coordinate of the spawnpoint of this class.
Float:Y	The Y coordinate of the spawnpoint of this class.
Float:Z	The Z coordinate of the spawnpoint of this class.
Float:Angle	The direction in which the player should face after spawning.
weapon1	The first spawn-weapon for the player.
weapon1_ammo	The amount of ammunition for the primary spawnweapon.
weapon2	The second spawn-weapon for the player.
weapon2_ammo	The amount of ammunition for the second spawnweapon.
weapon3	The third spawn-weapon for the player.
weapon3_ammo	The amount of ammunition for the third spawnweapon.


Returns	The ID of the class which was just added.
ShowPlayerDialog Information; https://sampwiki.blast.hk/wiki/ShowPlayerDialog
Code:
Parameters:
(playerid, dialogid, style, caption[], info[], button1[], button2[])
playerid	The ID of the player to show the dialog to.
dialogid	An ID to assign this dialog to, so responses can be processed. Max dialogid is 32767. Using negative values will close any open dialog.
style	The style of the dialog.
caption[]	The title at the top of the dialog. The length of the caption can not exceed more than 64 characters before it starts to cut off.
info[]	The text to display in the dialog. Use \n to start a new line and \t to tabulate.
button1[]	The text on the left button.
button2[]	The text on the right button. Leave it blank to hide it.


Returns	This function doesn't return a specific value
Lets Get Started!
pawn Code:
//>> [Tutorial]:How to make a "Teleport in Dialog" - ZCMD
//>> Credit to , Zeex -ZCMD , SA-MP Dev Team - a_samp

//>> include's
#include a_samp
#include zcmd

//>> color's define
#define COLOR_GRAY 0xCECECEFF

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Teleport in Dialog");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#endif

//------------------------------< ZEEXCOMMANDS >------------------------------//
CMD:teleport(playerid, params[])
{
    ShowPlayerDialog(playerid, 1997, DIALOG_STYLE_LIST, "Teleport System in Dialog", "San Fierro\nLos Santos\nLas Venturas", "Teleport", "Close"); // Dialogid 1997 ? you can change it or maybe define it . .
  //ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
    return 1;
}
//----------------------------------------------------------------------------//
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1997) // Check the Dialogid
    {
        switch(listitem) //the list of the item you have in the Dialog ..
        {
            case 0: // case 0; is for San Fierro teleport . .
            {
                new vehicleid = GetPlayerVehicleID(playerid); // check the vehicleID
                new State = GetPlayerState(playerid); // Get the playerState
                if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER) // this will teleport you & your car if you are the driver...
                //if you are not the driver or you maybe a passenger u will just teleport without car ..
                {
                LinkVehicleToInterior(vehicleid,0); //Linkvehicle to interior,this is like SetPlayerInterior . .
                SetPlayerInterior(playerid,0); //this will set the playerinterior
                SetVehicleZAngle(vehicleid,227.2756); //this is the angle of your vehicle
                SetCameraBehindPlayer(playerid); //this will set the camera behind you
                SetVehiclePos(vehicleid,-1986.5483,305.5474,35.0071); //this is the vehicle Pos , Float:X , Float:Y , Float:Z
                return SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to San Fierro!");//this will send u a Message when u was Teleported!. .
                }
                SetPlayerPos(playerid,-1969.0593,294.0901,35.1719);//this is the Player Pos , Float:X , Float:Y , Float:Z
                SetPlayerFacingAngle(playerid,89.9102); //this is the angle of your player
                SetPlayerInterior(playerid,0);//this will set the playerinterior
                SetCameraBehindPlayer(playerid);//this will set the camera behind you
                SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to San Fierro!"); //this will send u a Message when u was Teleported!. .
            }
            case 1: // case 1; is for Los Santos teleport . .
            {
                new vehicleid = GetPlayerVehicleID(playerid);// check the vehicleID
                new State = GetPlayerState(playerid);// Get the playerState
                if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER) // this will teleport you & your car if you are the driver...
                //if you are not the driver or you maybe a passenger u will just teleport without car ..
                {
                LinkVehicleToInterior(vehicleid,0);//Linkvehicle to interior,this is like SetPlayerInterior . .
                SetPlayerInterior(playerid,0);//this will set the playerinterior
                SetVehicleZAngle(vehicleid,179.2136);//this is the angle of your vehicle
                SetCameraBehindPlayer(playerid);//this will set the camera behind you
                SetVehiclePos(vehicleid,1608.3900,-1719.7670,13.3786); //this is the vehicle Pos , Float:X , Float:Y , Float:Z
                return SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Los Santos!");//this will send u a Message when u was Teleported!. .
                }
                SetPlayerPos(playerid,1606.3514,-1739.5194,13.5469);//this is the Player Pos , Float:X , Float:Y , Float:Z
                SetPlayerFacingAngle(playerid,42.2198); //this is the angle of your player
                SetPlayerInterior(playerid,0);//this will set the playerinterior
                SetCameraBehindPlayer(playerid);//this will set the camera behind you
                SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Los Santos!");//this will send u a Message when u was Teleported!. .
            }
            case 2: // case 2; is for Las Venturas teleport . .
            {
                new vehicleid = GetPlayerVehicleID(playerid);// check the vehicleID
                new State = GetPlayerState(playerid);// Get the playerState
                if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)// this will teleport you & your car if you are the driver...
                //if you are not the driver or you maybe a passenger u will just teleport without car ..
                {
                LinkVehicleToInterior(vehicleid,0);//Linkvehicle to interior,this is like SetPlayerInterior . .
                SetPlayerInterior(playerid,0);//this will set the playerinterior
                SetVehicleZAngle(vehicleid,88.7952);//this is the angle of your vehicle
                SetCameraBehindPlayer(playerid);//this will set the camera behind you
                SetVehiclePos(vehicleid,2128.2754,1333.6340,10.6558);//this is the vehicle Pos , Float:X , Float:Y , Float:Z
                return SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Las Venturas!");//this will send u a Message when u was Teleported!. .
                }
                SetPlayerPos(playerid,2096.9543,1322.6205,10.8203);//this is the Player Pos , Float:X , Float:Y , Float:Z
                SetPlayerFacingAngle(playerid,52.1985); //this is the angle of your player
                SetPlayerInterior(playerid,0);//this will set the playerinterior
                SetCameraBehindPlayer(playerid);//this will set the camera behind you
                SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Las Venturas!");//this will send u a Message when u was Teleported!. .
                }
            //Case 3: //add your other tp
            }
                //your code
        }
    return 1;
}
Im so Sorry if this not too much explain, and if i made a mistake tell me ...
Reply
#2

Quote:
Originally Posted by Devilxz97
View Post
How to make a
♠ ♣ Teleport In Dialog ♥ ♦


//>> Hii guys , im going to show you how to make a Teleport in Dialog . . <<\\
//>> I making this to Show/Help a new scripter who dont know how to make Teleport in Dialog . . <<\\

//>> In this [Tutorial] im using ZCMD . . <<\\

//>> Requirement <<\\
//>> Zcmd Include's by Zeex <<\\
//>> https://sampforum.blast.hk/showthread.php?tid=91354 <<\\


>> Firstly, run your server as local host then join it , then go to anywhere you want it to teleported then /save [TeleportName]
>> and then goto Document/GTA San Andreas User Files/SAMP then open savedpositions.txt

>> It will be like this;

Code:
AddStaticVehicle(402,-1986.5483,305.5474,35.0071,227.2756,22,22); // sf
AddPlayerClass(0,-1969.0593,294.0901,35.1719,89.9102,0,0,0,0,0,0); // sf
AddStaticVehicle(402,1608.3900,-1719.7670,13.3786,179.2136,22,22); // ls
AddPlayerClass(0,1606.3514,-1739.5194,13.5469,42.2198,0,0,0,0,0,0); // ls
AddStaticVehicle(402,2128.2754,1333.6340,10.6558,88.7952,22,22); // lv
AddPlayerClass(0,2096.9543,1322.6205,10.8203,52.1985,0,0,0,0,0,0); // lv
AddStaticVehicle Information; https://sampwiki.blast.hk/wiki/AddStaticVehicle
Code:
Parameters:
(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2)
modelid	The Model ID for the vehicle.
Float:spawn_X	The X-coordinate for the vehicle.
Float:spawn_Y	The Y-coordinate for the vehicle.
Float:spawn_Z	The Z-coordinate for the vehicle.
Float:angle	Direction of vehicle - angle.
color1	The primary color ID.
color2	The secondary color ID.


Returns	The vehicle ID of the vehicle created.
AddPlayerClass Information; https://sampwiki.blast.hk/wiki/AddPlayerClass
Code:
Parameters:
(skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
skin	The skin which the player will spawn with.
Float:X	The X coordinate of the spawnpoint of this class.
Float:Y	The Y coordinate of the spawnpoint of this class.
Float:Z	The Z coordinate of the spawnpoint of this class.
Float:Angle	The direction in which the player should face after spawning.
weapon1	The first spawn-weapon for the player.
weapon1_ammo	The amount of ammunition for the primary spawnweapon.
weapon2	The second spawn-weapon for the player.
weapon2_ammo	The amount of ammunition for the second spawnweapon.
weapon3	The third spawn-weapon for the player.
weapon3_ammo	The amount of ammunition for the third spawnweapon.


Returns	The ID of the class which was just added.
ShowPlayerDialog Information; https://sampwiki.blast.hk/wiki/ShowPlayerDialog
Code:
Parameters:
(playerid, dialogid, style, caption[], info[], button1[], button2[])
playerid	The ID of the player to show the dialog to.
dialogid	An ID to assign this dialog to, so responses can be processed. Max dialogid is 32767. Using negative values will close any open dialog.
style	The style of the dialog.
caption[]	The title at the top of the dialog. The length of the caption can not exceed more than 64 characters before it starts to cut off.
info[]	The text to display in the dialog. Use \n to start a new line and \t to tabulate.
button1[]	The text on the left button.
button2[]	The text on the right button. Leave it blank to hide it.


Returns	This function doesn't return a specific value
Lets Get Started!
pawn Code:
//>> [Tutorial]:How to make a "Teleport in Dialog" - ZCMD
//>> Credit to , Zeex -ZCMD , SA-MP Dev Team - a_samp

//>> include's
#include a_samp
#include zcmd

//>> color's define
#define COLOR_GRAY 0xCECECEFF

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Teleport in Dialog");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#endif

//------------------------------< ZEEXCOMMANDS >------------------------------//
CMD:teleport(playerid, params[])
{
    ShowPlayerDialog(playerid, 1997, DIALOG_STYLE_LIST, "Teleport System in Dialog", "San Fierro\nLos Santos\nLas Venturas", "Teleport", "Close"); // Dialogid 1997 ? you can change it or maybe define it . .
  //ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
    return 1;
}
//----------------------------------------------------------------------------//
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1997) // Check the Dialogid
    {
        switch(listitem) //the list of the item you have in the Dialog ..
        {
            case 0: // case 0; is for San Fierro teleport . .
            {
                new vehicleid = GetPlayerVehicleID(playerid); // check the vehicleID
                new State = GetPlayerState(playerid); // Get the playerState
                if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER) // this will teleport you & your car if you are the driver...
                //if you are not the driver or you maybe a passenger u will just teleport without car ..
                {
                LinkVehicleToInterior(vehicleid,0); //Linkvehicle to interior,this is like SetPlayerInterior . .
                SetPlayerInterior(playerid,0); //this will set the playerinterior
                SetVehicleZAngle(vehicleid,227.2756); //this is the angle of your vehicle
                SetCameraBehindPlayer(playerid); //this will set the camera behind you
                SetVehiclePos(vehicleid,-1986.5483,305.5474,35.0071); //this is the vehicle Pos , Float:X , Float:Y , Float:Z
                return SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to San Fierro!");//this will send u a Message when u was Teleported!. .
                }
                SetPlayerPos(playerid,-1969.0593,294.0901,35.1719);//this is the Player Pos , Float:X , Float:Y , Float:Z
                SetPlayerFacingAngle(playerid,89.9102); //this is the angle of your player
                SetPlayerInterior(playerid,0);//this will set the playerinterior
                SetCameraBehindPlayer(playerid);//this will set the camera behind you
                SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to San Fierro!"); //this will send u a Message when u was Teleported!. .
            }
            case 1: // case 1; is for Los Santos teleport . .
            {
                new vehicleid = GetPlayerVehicleID(playerid);// check the vehicleID
                new State = GetPlayerState(playerid);// Get the playerState
                if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER) // this will teleport you & your car if you are the driver...
                //if you are not the driver or you maybe a passenger u will just teleport without car ..
                {
                LinkVehicleToInterior(vehicleid,0);//Linkvehicle to interior,this is like SetPlayerInterior . .
                SetPlayerInterior(playerid,0);//this will set the playerinterior
                SetVehicleZAngle(vehicleid,179.2136);//this is the angle of your vehicle
                SetCameraBehindPlayer(playerid);//this will set the camera behind you
                SetVehiclePos(vehicleid,1608.3900,-1719.7670,13.3786); //this is the vehicle Pos , Float:X , Float:Y , Float:Z
                return SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Los Santos!");//this will send u a Message when u was Teleported!. .
                }
                SetPlayerPos(playerid,1606.3514,-1739.5194,13.5469);//this is the Player Pos , Float:X , Float:Y , Float:Z
                SetPlayerFacingAngle(playerid,42.2198); //this is the angle of your player
                SetPlayerInterior(playerid,0);//this will set the playerinterior
                SetCameraBehindPlayer(playerid);//this will set the camera behind you
                SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Los Santos!");//this will send u a Message when u was Teleported!. .
            }
            case 2: // case 2; is for Las Venturas teleport . .
            {
                new vehicleid = GetPlayerVehicleID(playerid);// check the vehicleID
                new State = GetPlayerState(playerid);// Get the playerState
                if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)// this will teleport you & your car if you are the driver...
                //if you are not the driver or you maybe a passenger u will just teleport without car ..
                {
                LinkVehicleToInterior(vehicleid,0);//Linkvehicle to interior,this is like SetPlayerInterior . .
                SetPlayerInterior(playerid,0);//this will set the playerinterior
                SetVehicleZAngle(vehicleid,88.7952);//this is the angle of your vehicle
                SetCameraBehindPlayer(playerid);//this will set the camera behind you
                SetVehiclePos(vehicleid,2128.2754,1333.6340,10.6558);//this is the vehicle Pos , Float:X , Float:Y , Float:Z
                return SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Las Venturas!");//this will send u a Message when u was Teleported!. .
                }
                SetPlayerPos(playerid,2096.9543,1322.6205,10.8203);//this is the Player Pos , Float:X , Float:Y , Float:Z
                SetPlayerFacingAngle(playerid,52.1985); //this is the angle of your player
                SetPlayerInterior(playerid,0);//this will set the playerinterior
                SetCameraBehindPlayer(playerid);//this will set the camera behind you
                SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Las Venturas!");//this will send u a Message when u was Teleported!. .
                }
            //Case 3: //add your other tp
            }
                //your code
        }
    return 1;
}
Im so Sorry if this not too much explain, and if i made a mistake tell me ...
Looks fine for a newbie, the only problem I see is that newbies and scripters will more or likely just copy/paste and remove the comments.

You barely explain certain aspects in detail, such as what a case is when you are using it and so forth.
Reply
#3

no explanation..
Reply
#4

Quote:
Originally Posted by Kindred
View Post
Looks fine for a newbie, the only problem I see is that newbies and scripters will more or likely just copy/paste and remove the comments.

You barely explain certain aspects in detail, such as what a case is when you are using it and so forth.
okay

Quote:

no explanation..

i can explain too much cause i need to go . .
Reply
#5

Good tutorial
Reply
#6

thanks
Reply
#7

Hmm nice tutorial
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)