[Tutorial] Making a teleport menu --> By Fedee!
#1

Im making this tutorial because the first time that I wanted to do one (I was noob ), I couldn find one, on SAMP I did use search but nothing, programs dint work and Wiki tutorial, I dind understand. Hope you like it!

Pay attention!!

Ok, lets do it !! :P

How to do it:
*Step 1:Open PAWNO and press CTRL+N, then select all and delete it.
*Step 2:On top add:
Quote:
#define FILTERSCRIPT
Quote:
#include <a_samp>
Quote:
#if defined FILTERSCRIPT
*Step 3:Then, below that, we start creating the variable for the menus.
Quote:
//Menu
new Menu: DMZones;

*Step 5:Now, to make the menus we need to use CreateMenu, here a example:
Quote:

DMZones = CreateMenu("DMZones", 1, 18.0, 102.0, 165.0, 165.0);

(You have to do that for each variable created on Step 3.)
You must add that below of:
Quote:
public OnFilterScriptInit()
{
}

Here a example:
Quote:
public OnFilterScriptInit()
{
DMZones = CreateMenu("DMZones", 1, 18.0, 102.0, 165.0, 165.0);
}

*Step 6: Okay, now we have made the menu , now we just need to add some items to the menu.
Now, under CreateMenu add:
Quote:

AddMenuItem(MenuID, Column, "Title");

Here a example
Quote:
public OnFilterScriptInit()
{
DMZones = CreateMenu("DMZones", 1, 18.0, 102.0, 165.0, 165.0);
AddMenuItem(DMZones, 0, "DildoDM");
}

(You can only have 12 items per menu. Or server may crash.)
Once you finish it for all, proceed to Step 7.
*Step 7: Okay, we have made a menu in the foregoing steps, now, we are going to add the effect that should make the item if you choose it. To do that, we are using the callback
Quote:
public OnPlayerSelectedMenuRow(playerid, row)

So, under that callback, we must add this:
Quote:
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if(CurrentMenu == DMZones)
{
switch(row)
{
case 0:
{
//Effect
}

*Step 8: Now, what we want? Teleport :P, and for that case im gonna use a stock that teleports me as well my car, and shows up for everyone to what place I have gone to.(This stock is modified by me, the original one was from Fallout, so credits to him )
Here is the stock(You have to add it on the last line.):
Quote:

stock TeleWithCar(playerid, telename[], Float:Vx, Float:Vy, Float:Vz, Float:Va, Float:Px, Float:Py, Float:Pz, Float:Pa, interior)
{
DMZone[playerid] = 0;
ResetPlayerWeapons(playerid);
TogglePlayerControllable(playerid, 1);
new b[256], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehiclePos(GetPlayerVehicleID(playerid),Vx,Vy,V z);
SetVehicleZAngle(GetPlayerVehicleID(playerid),Va);
LinkVehicleToInterior(GetPlayerVehicleID(playerid) ,interior);
}
else
{
InCar[playerid] = false;
SetPlayerPos(playerid,Px,Py,Pz);
SetPlayerFacingAngle(playerid,Pa);
SetPlayerWorldBounds(playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000);
}
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, interior);
format(b, sizeof(b), "*** %s has teleported to /%s", playerName, telename);
SendClientMessageToAll(COLOR_JOIN,b);
}

Its easy to use, here an explanation about the TeleWithCar arguments:
Quote:

TeleWithCar(playerid, telename[],X, Y, Z, Rot, X, Y, Z, Rot, interior)

Example:
Quote:

TeleWithCar(playerid, "dildodm",2526.65,-1202.77,67.98,0,2526.65,-1202.77,67.98,0,0);

Easy right? Lets go to Step 8

**[color=red]NOTE**: You will have to add:
Quote:
new DMZone[MAX_PLAYERS];
new bool: InCar[MAX_PLAYERS];

Below #includes, #defines, forwards, etc. If you dont add it, you will have errors!

*Step 8: How can I add that stock to my menu? Its easy, just get the cords of the place you wanna teleport, and simply paste it to X, Y and Z cords. (Remember to put them twice )
So here a example:
Quote:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if(CurrentMenu == DMZones)
{
switch(row)
{
case 0:
{
TeleWithCar(playerid, "dildodm",2526.65,-1202.77,67.98,0,2526.65,-1202.77,67.98,0,0);
GivePlayerWeapon(playerid, 10, 50);// This gives him a dildo :P
}
}
}
}

*Step 9: Cool! We are almost finished! We just need to add a command that will show us up the menu
So, on:
Quote:
public OnPlayerCommandText(playerid, cmdtext[])
{
}

callback, we just must add this:
Quote:
if(strcmp(cmdtext, "/teles", true) == 0)
{
ShowMenuForPlayer(DMZones, playerid);
TogglePlayerControllable(playerid, 0);
return 1;
}

Now it would look like this:
Quote:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/teles", true) == 0)
{
ShowMenuForPlayer(DMZones, playerid);
TogglePlayerControllable(playerid, 0);
return 1;
}
return 0;
}

And thats it One more thing, remember to add at the last line
Quote:
#endif
Because this is a Filterscipt

Here is the finished version of the teleport menu that I made on this tutorial:
Quote:
#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT

//Menu
new Menu: DMZones;
// ================================================== ======================== //
new DMZone[MAX_PLAYERS];
new bool: InCar[MAX_PLAYERS];

public OnFilterScriptInit()
{
DMZones = CreateMenu("DMZones", 1, 18.0, 102.0, 165.0, 165.0);
AddMenuItem(DMZones, 0, "DildoDM");
}

public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if(CurrentMenu == DMZones)
{
switch(row)
{
case 0:
{
TeleWithCar(playerid, "dildodm",2526.65,-1202.77,67.98,0,2526.65,-1202.77,67.98,0,0);
}
}
}
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/teles", true) == 0)
{
ShowMenuForPlayer(DMZones, playerid);
TogglePlayerControllable(playerid, 0);
return 1;
}
return 0;
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
stock TeleWithCar(playerid, telename[], Float:Vx, Float:Vy, Float:Vz, Float:Va, Float:Px, Float:Py, Float:Pz, Float:Pa, interior)
{
DMZone[playerid] = 0;
ResetPlayerWeapons(playerid);
TogglePlayerControllable(playerid, 1);
new b[256], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehiclePos(GetPlayerVehicleID(playerid),Vx,Vy,V z);
SetVehicleZAngle(GetPlayerVehicleID(playerid),Va);
LinkVehicleToInterior(GetPlayerVehicleID(playerid) ,interior);
}
else
{
InCar[playerid] = false;
SetPlayerPos(playerid,Px,Py,Pz);
SetPlayerFacingAngle(playerid,Pa);
SetPlayerWorldBounds(playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000);
}
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, interior);
format(b, sizeof(b), "*** %s has teleported to /%s", playerName, telename);
SendClientMessageToAll(0x74E80099,b);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
If you did all step-by-step, you should have no problems and errors at all !

Credits:
*Just to Fallout, for the stock. :P

Hope you like it, see ya !!
Reply
#2

My easyports include is easyer to use
Check my sig
Reply
#3

This is not the finished one :S

By mistake I pressed "Post" instead of "Preview" lol

Will be finished in minutes

Finished !
Reply
#4

I prefer dialogs rather than menu's
Reply
#5

This is very useful, I might use this one day!
Reply
#6

i'd rather use dialogs, easier to make and looks better
Reply
#7

Quote:
Originally Posted by Niixie
i'd rather use dialogs, easier to make and looks better
Depends on the taste..

I preffer menus..
Reply
#8

I'd prefer for beginners to use a application. There's lots of Generators these days. But if you seriously want to learn. Then you have to Follow Tutorials. And try to figure out the errors by your self.

~Hakam.
Reply
#9

nice but.. I prefer dialogs because are sexy
Reply
#10

Quote:
Originally Posted by Teneckz
nice but.. I prefer dialogs because are sexy
XD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)