SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 10/02/2014, 11:01 AM   #1
Vanter
Huge Clucker
 
Vanter's Avatar
 
Join Date: Jul 2013
Posts: 391
Reputation: 16
Default Making simple entries and exits [Using pickups]

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? http://wiki.sa-mp.com/wiki/InteriorIDs


Useful links:
3D Text Label Structure: http://wiki.sa-mp.com/wiki/Create3DTextLabel

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

Thank You,
Vanter

Last edited by Vanter; 02/04/2016 at 07:43 PM.
Vanter is offline   Reply With Quote
Old 10/02/2014, 12:51 PM   #2
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,067
Reputation: 2660
Default Re: Making simple entries and exits

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.
__________________
Vince is offline   Reply With Quote
Old 12/02/2014, 08:03 AM   #3
Vanter
Huge Clucker
 
Vanter's Avatar
 
Join Date: Jul 2013
Posts: 391
Reputation: 16
Default Re: Making simple entries and exits

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.
Vanter is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a simple cop system ricardo178 Scripting Help 6 24/02/2012 02:19 PM
[Tutorial] Making A Simple /PM command. AstonDA-G Tutorials 4 29/11/2011 05:12 PM
Making a very simple /help cmd! Dennis Help Archive 20 17/07/2010 11:46 PM
Simple way of making this into a .ttf? iron_war_lord Everything and Nothing 5 17/07/2010 09:29 AM
Making a simple command :D sekol Help Archive 2 17/04/2010 03:55 PM


All times are GMT. The time now is 03:11 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.