[Tutorial] Making simple entries and exits
#1

What is this tutorial? Making simple entries and exits for buildings, ammu-nations, stores..etc

What's the key for it? Checkpoints, Virtual Worlds, Interiors, or Pickups.

What will we use? We're going to use dynamic pickups, if you don't have the streamer installed, just remove the ''Dynamic'' in every word in the script.

Here we go
We're going to create the entry and exit pickups, in this case, ammunation.
PHP Code:
new AmmuEnt1;
new 
AmmuExt1
Then under OnGameModeInIt(), we're gonna define the creation of them.
PHP Code:
//This one is in Come-A-Lot in LV
    
AmmuEnt1 CreateDynamicPickup(131712159.53943.209.820); //usally make the the Z axis, is -1, so the pickup is slightly up the ground.
    
Create3DTextLabel("Ammunation\nEnterance"0xFF0000AA2159.53943.2810.8220.001); //3D Text Label to define the entrance.
    
AmmuExt1 CreateDynamicPickup(13171315.71, -143.66998.01); //Ammu-nation exit to the world. the last ''1'' is the Virtual world. which we will be setting as our first virtual world.
//What is a virtual world? It's a world where only people assigned to it be able to see each other. 
Now, we'll come to where's the action of teleporting the player to the interior and virtual world we want.
PHP Code:
public OnPlayerPickUpDynamicPickup(playeridpickupid)
{
if(
pickupid == AmmuEnt1//incase of Ammunation entry.
    
{
       
SetPlayerInterior(playerid7);  //which is the Ammu-nation Interior.
       
SetPlayerVirtualWorld(playerid1); //which is the first virtual world we create for players, if you want to make another ammu-nation, make sure the virtual world is 2, or any number not repeated.
       
SetPlayerPos(playerid315.24, -140.89999.60); // Coordinates in Ammu-Nation
       
SetPlayerFacingAngle(playerid0); // You can edit the player's facing angle whatever you like.
       
return 1;
    }
    if(
pickupid == AmmuExt1//Incase of the ammu-nation exit
    
{
       
SetPlayerInterior(playerid0); //Setting the player to interior 0, which is the world.
       
SetPlayerVirtualWorld(playerid0);  //As usual, normal virtual worlds are always 0.
       
SetPlayerPos(playerid2154.62942.7810.82); //Setting the player position, which must be outside the ammu-nation.
       
SetPlayerFacingAngle(playerid90); //Setting player's facing angle.
       
return 1;
    } 
   return 
1;

Where can I get the interior IDs? https://sampwiki.blast.hk/wiki/InteriorIDs


Useful links:
3D Text Label Structure: https://sampwiki.blast.hk/wiki/Create3DTextLabel

I hope this helps you creating entrances and exits in your gamemode

Thank You,
Vanter
Reply
#2

While this may work for a handful of entrances, it doesn't aid expandability. Imagine doing this for more than 30 buildings. You're simply going to end up with bloated code that'll be very hard to maintain.
Reply
#3

I might make a program/command with dialogs to create interiors and with automatic posting to script, so you have no work to do just, /createentry - choose which interior - choose a text label for enterance. and done.
Expect it anytime soon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)