SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 15/09/2017, 02:40 PM   #1
Lokii
Big Clucker
 
Join Date: Sep 2017
Posts: 106
Reputation: 51
Default AutoMove (create automatic gates with ONE LINE!)

AutoMove

AutoMove creates any object and moves it when some player is in specific radius of that object.

you can make any object move with this not only gates.

The script i used in the video:

Code:
#include <a_samp>
#include <AutoMove>

#define FILTERSCRIPT

public OnFilterScriptInit()
{
	CreateAutoObject(0, 971, 551.22101, 1659.31995, 9.59222, 0.00000, 0.00000, 304.77103, 75.0, 15.0, 557.70056, 1650.47827, 9.59222, 3);
	CreateAutoObject(1, 971, 532.47937, 1688.40173, 10.33070, 0.00000, 0.00000, 26.49157, 95.0, 20.0, 532.47937, 1688.40173, 6.19246, 2);
	return 1;
}
Functions:

CreateAutoObject(id, modelid, Float, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Floattream_distance, Float:move_distance, Float:tox, Float:toy, Float:toz, Float:move_speed)

DestroyAutoObject(id)

DestroyAllAutoObjects()

PASTEBIN: https://pastebin.com/tmBziB3a

VIDEO: https://www.youtube.com/watch?v=-p-aYxh31lw

Credits:

ME: for AutoMove
incognito: for streamer
y_less: for y_hooks


AutoMove V2:

1. Supports virtural worlds
2. Supports interiors
3. Added callback OnAutoObjectOpen(playerid, auto_objectid)
4. Added callback OnAutoObjectClose(playerid, auto_objectid)
5. Added function OpenAutoObject(id)

6. Added function CloseAutoObject(id)
7. Supports rotations

Now you can make the object move only when player is on foot, only in vehicle or both and a lot more stuff

Functions:

CreateAutoObject(id, modelid, Float, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, Floattream_distance, Float:move_distance, Float:tox, Float:toy, Float:toz, Float:torx, Float:tory, Float:torz, Float:move_speed)

OpenAutoObject(id)
CloseAutoObject(id)
DestroyAutoObject(id)
DestroyAllAutoObjects()

PASTEBIN: https://pastebin.com/SZMuHizQ

example:

Code:
#include <a_samp>
#include <AutoMove>

#define FILTERSCRIPT

public OnFilterScriptInit()
{
	CreateAutoObject(0, 971, 551.22101, 1659.31995, 9.59222, 0.00000, 0.00000, 304.77103, -1, -1, 75.0, 15.0, 557.70056, 1650.47827, 9.59222, 0.00000, 0.00000, 304.77103, 3);  //Cars only.
	CreateAutoObject(1, 971, 532.47937, 1688.40173, 10.33070, 0.00000, 0.00000, 26.49157, -1, -1, 95.0, 20.0, 532.47937, 1688.40173, 6.19246, 0.00000, 0.00000, 26.49157, 2); //Players only.
	CreateAutoObject(2, 971, -62.40447, 1341.03003, 9.79037, 0.00000, 0.00000, 0.00000, -1, -1, 100.5, 10.0, -59.96775, 1344.00391, 9.79037, 0.00000, 0.00000, 300.6515, 2.5); //Cars and Players.
	return 1;
}

public OnAutoObjectOpen(playerid, auto_objectid)
{
	switch(auto_objectid)
	{
	    case 0: //object id 0, can enter only while in vehicle
	    {
	        if(IsPlayerInAnyVehicle(playerid))  //if player enter with vehicle open
	        {
	            SendClientMessage(playerid, 0xFFFF00FF, "Welcome");
	        }
	        else //if player enter on foot dont open
	        {
	            CloseAutoObject(0);  //were using the close function because it automaticly opens, so if we want the object to stay and not move we have to use that function
                SendClientMessage(playerid, 0xFF0000FF, "You have to be in a vehicle");
	        }
	    }
	    case 1:
	    {
	        if(!IsPlayerInAnyVehicle(playerid)) //opposite of id 0
	        {
	            SendClientMessage(playerid, 0xFFFF00FF, "Welcome");
	        }
	        else
	        {
	            CloseAutoObject(1);
                SendClientMessage(playerid, 0xFF0000FF, "Vehicles are not allowed");
	        }
	    }
	    case 2: //opens not matter on foot or in vehicle
	    {
	        SendClientMessage(playerid, 0xFFFF00FF, "Welcome");
	    }
	}
	return 1;
}
V1 vs V2 compressions https://www.youtube.com/watch?v=JAUAM2vzulI

AutoMove V2.1
1. Supports NPC's now

PASTEBIN: https://pastebin.com/QTF1z2re


FOR THOSE WHO DONT TO USE THE Y_HOOKS VERSION:

AutoMove V2.2
1. y_hooks is not required anymore
AMX AVERAGE SIZE:

V1: 39.8 kb
V2: 45.9 kb
V2.1: 45.9 kb
V2.2: 22.4 kb

PASTEBIN: https://pastebin.com/RxUp8Bdr

Last edited by Lokii; 22/10/2017 at 04:13 PM.
Lokii is online now   Reply With Quote
Old 15/09/2017, 02:44 PM   #2
X337
Gangsta
 
Join Date: Sep 2014
Location: Indonesia
Posts: 883
Reputation: 287
Default Re: AutoMove (create automatic gates with ONE LINE!)

Cool. A question, why do you use
Code:
I_AutoMove[id][am_areaid] = CreateDynamicSphere(0, 0, 0, 0, -2, -1, -1);
instead of deleting the area?
__________________
viva la sa-mp
X337 is offline   Reply With Quote
Old 15/09/2017, 02:57 PM   #3
Meller
Banned
 
Join Date: Dec 2016
Posts: 650
Reputation: 132
Default Re: AutoMove (create automatic gates with ONE LINE!)

Useless.




1star ;d
Meller is offline   Reply With Quote
Old 15/09/2017, 07:47 PM   #4
Whatname
Big Clucker
 
Join Date: Aug 2016
Posts: 182
Reputation: 12
Default Re: AutoMove (create automatic gates with ONE LINE!)

not bad, i was planning to make something like that
Whatname is offline   Reply With Quote
Old 15/09/2017, 07:49 PM   #5
Eoussama
High-roller
 
Eoussama's Avatar
 
Join Date: Jul 2016
Location: Kingdom of Morocco // Tangier
Posts: 1,243
Reputation: 193
Default Re: AutoMove (create automatic gates with ONE LINE!)

Cool consept.
__________________

|===[Web taxi]===|
List of my work
Github
Pastebin

|===[Interesting topics]===|
Semantic Versioning


Eoussama is offline   Reply With Quote
Old 17/09/2017, 05:57 PM   #6
Tort
Little Clucker
 
Join Date: Sep 2017
Posts: 4
Reputation: 4
Default Re: AutoMove (create automatic gates with ONE LINE!)

good job
Tort is offline   Reply With Quote
Old 17/09/2017, 06:08 PM   #7
Deadpoop
Big Clucker
 
Deadpoop's Avatar
 
Join Date: Jul 2016
Posts: 110
Reputation: 3
Default Re: AutoMove (create automatic gates with ONE LINE!)

nice
__________________
RELEASES:
































Deadpoop is offline   Reply With Quote
Old 18/09/2017, 01:34 AM   #8
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,374
Reputation: 1208
Default Re: AutoMove (create automatic gates with ONE LINE!)

You can use the extraid with the streamer to assign the array index in which your gate data is located so you don't have to do any looping.

Code:
hook OnPlayerEnterDynamicArea(playerid, areaid)
{
      if(playerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid))
      {
            for(new j = 0; j < MAX_AUTO_OBJECTS;j++)
            if(areaid == I_AutoMove[j][am_areaid])
Pottus is offline   Reply With Quote
Old 18/09/2017, 02:55 AM   #9
DonaldDuck
Banned
 
Join Date: Jun 2017
Location: Phillipines
Posts: 367
Reputation: 91
Thumbs up Re: AutoMove (create automatic gates with ONE LINE!)

Nice i was looking for this.
DonaldDuck 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
[Include] mGates (Easily create automatic gates with one function!) MP2 Includes 37 06/03/2018 03:05 AM
[Include] S32_AutoGates - Create automatic gate with just one line! System64 Includes 19 18/06/2012 10:25 AM
How to create a automatic moving gates? igor_andrusenko Help Archive 3 02/08/2011 04:50 PM
Automatic Gates soldierman Help Archive 2 09/09/2009 04:41 PM
How to create Automatic Gates to one Team ? Plz Reply me SlashPT Help Archive 9 08/09/2009 01:55 AM


All times are GMT. The time now is 07:05 PM.


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