SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 22/05/2018, 04:41 PM   #1
Nickk888
Little Clucker
 
Nickk888's Avatar
 
Join Date: Oct 2011
Location: Germany
Posts: 20
Reputation: 24
Cool NGATE v3.0 - Create gates, barriers and elevators with only 1 line of code!


About Me:
Hello dear SA-MP community My name's Nickk888, i'm a German/Polish PAWN Scripter for about 6 years now, I own a ******* channel about SA-MP Scripting in Polish language and I create scripts for the public for free. Excuse my English skill, I'm no native English speaker, so please keep this in mind I'll try my best ^_^

About Include:
NGATE(Nickk's Gate Include) is a Include that makes it possible to "generate" fully functional gates, barriers and even elevators! Only using 1 line of code! You can set the direction of movement, the speed of movement, how you want it to trigger, everything! You can even set permissions on your gate or barrier that only for example fraction members are able to use the gate or barrier! On V2.1 you can also set "cascade triggers", means that when you trigger a gate, other gates that are connected to each other will also trigger, that makes it useful for double side gates etc.

Features:
  • Freaking one line of code!
  • Self hooking Include, just include it!
  • Many options to "program" your gate, barrier or elevator!
  • Compatible with ZCMD.
  • Fully optimized include, using PoolSize for gates!(V2.0 & V2.1)
  • No Timers! Trigger using Dynamic Areas!, which makes it super optimized!(V2.5 >)
  • Less CPU usage! Due to Dynamic Areas check!(V2.5 >)
  • No looping operations while checking!(V2.5 >)
  • Pre-defined or Custom gate move to position!(V3.0 >)
  • Pre-defined or Custom barrier rotation!(V3.0 >)

Changelog:
Version 3.0:
Code:
- Switched from "for(new" loops to YSI's "foreach" loops for better performance.
- Changed some variables name to eliminate potential duplicates.
- Added "moveSpeed" parameter for barriers.
- Barriers rotation is now fully custom. You can still use the definitions or put your own rotation value(0-360 degrees).
- Added "MOVE_CUSTOM" definition for gates.
- Added "movetoX", "movetoY", "movetoZ" parameter for custom 'move-to' position.
- Increased max gates from 250 to 1000.
- Increased max groups from 50 to 500.
- Bug Fixed: Barrier or Gate was stuck if player exited while on gate area.
- Bug Fixed: Barrier or Gate was still in group array when destroyed.
- Other small bug fixes which are not very relevant to put into this list.
Version 2.5 Optimization Update:
Code:
- Changed Timer Trigger to Dynamic Area Trigger(No Radius check).
- Deleted "moveTime" parameter.
- Deleted "NGatesCheck" function.
- All Timers deleted.
- Deleted definition "NGATE_UPDATEINTERVAL".
- Added mode "MODE_MANUAL_AUTO".
- Deleted GatesPoolSize.
Version 2.1:
Code:
- Added Groups.
- Added Cascade triggering.
Version 2.0:
Code:
- First Release
Functions:
Code:
NGateCreate(modelID, Float: objectX, Float: objectY, Float: objectZ, Float: objectRotX=0.0, Float: objectRotY=0.0, Float: objectRotZ=0.0, moveDirection = MOVE_DOWN, Float: movetoX = 0.0, Float: movetoY = 0.0, Float: movetoZ = 0.0, moveMode = MODE_ALL_AUTO, Float:moveSpeed = 3.0, Float:moveRadius = 6.0, accessID[]={ -1 }, Float: detectRadius=13.0, detectKey=KEY_CROUCH, CmdToOpen[]="", CmdToClose[]="", Float: cDetectX=0.0, Float: cDetectY=0.0, Float: cDetectZ=0.0, accessIDsize = sizeof accessID)
NBarrierCreate(Float: objectX, Float: objectY, Float: objectZ, Float:objectZRot, moveMode = MODE_ALL_AUTO, Float:RotSpeed = 1.0, accessID[]={ -1 }, Float: detectRadius=13.0,  detectKey=KEY_CROUCH, CmdToOpen[]="", CmdToClose[]="", Float: cDetectX=0.0, Float: cDetectY=0.0, Float: cDetectZ=0.0, accessIDsize = sizeof accessID)
NGateDestroy(gateid);
NGateSetAccessID(playerid, id);
NGateOpen(gateid);
NGateClose(gateid);
NGateIsGateOpen(gateid);
NGateCreateGroup();
NGateAddToGroup(gateid, groupid);
NGateReturnObjectID(gateid);
How to use it(Examples):
To Create a simple gate:
Code:
NGateCreate(MODELID, X, Y, Z, XR, YR, ZR, DIRECTION);
or
NGateCreate(MODELID, X, Y, Z, XR, YR, ZR, MOVE_CUSTOM, MOVETOX, MOVETOY, MOVETOZ);
To Create a simple barrier:
Code:
NBarrierCreate(X, Y, Z, DIRECTION_ROTATION);
Those functions are from my example script:
Code:
//Gates
NGateCreate(969, 1503.50, -2498.4253, 12.7261, 0.0, 0.0, 90.0, MOVE_DOWN);
NGateCreate(969, 1533.50, -2498.4253, 12.7261, 0.0, 0.0, 90.0, MOVE_CUSTOM, 0.0, 0.0, 0.0, MODE_VEHICLE_KEYINPUT, 3.0, 8.0);
NGateCreate(969, 1563.50, -2498.4253, 12.7261, 0.0, 0.0, 90.0, MOVE_UP, 0.0, 0.0, 0.0, MODE_ALL_COMMANDINPUT, 3.0, 8.0, {-1}, 10.0, -1, "/open");
NGateCreate(969, 1593.50, -2498.4253, 12.7261, 0.0, 0.0, 90.0, MOVE_SOUTH, 0.0, 0.0, 0.0, MODE_WALK_COMMANDINPUT, 3.0, 8.0, {20}, 10.0 , -1, "/open", "/close");
gateid1 = NGateCreate(969, 1623.50, -2498.4253, 12.7261, 0.0, 0.0, 90.0, MOVE_NORD, 0.0, 0.0, 0.0, MODE_MANUAL, 3.0, 8.0);
new groupid = NGateCreateGroup();
new tmp_gateid1 = NGateCreate(988, 1653.5431, -2491.3015, 13.5800, 0.0, 0.0, -90.0, MOVE_NORD, 0.0, 0.0, 0.0, MODE_ALL_AUTO, 0.5, 4.0);
new tmp_gateid2 = NGateCreate(988, 1653.5431, -2496.7822, 13.5800, 0.0, 0.0, -90.0, MOVE_SOUTH, 0.0, 0.0, 0.0, MODE_ALL_AUTO, 0.5, 4.0);
NGateAddToGroup(tmp_gateid1, groupid);
NGateAddToGroup(tmp_gateid2, groupid);
gateid2 = NGateCreate(980, 1687.8888, -2494.1372, 12.5575, 90.0, 0.0, 0.0, MOVE_UP, 0.0, 0.0, 0.0, MODE_MANUAL, 3.0, 26.0);
NGateCreate(980, 1693.6348, -2494.5649, 41.1800, 0.0, 0.0, 90.0, MOVE_NORD, 0.0, 0.0, 0.0, MODE_VEHICLE_AUTO, 1.0, 12.0);

//Barriers
NBarrierCreate(1759.87183, -2512.34668, 39.30200, 45.0);
NBarrierCreate(1759.87183, -2542.34668, 39.30200, BARRIER_ROT_OST, MODE_VEHICLE_COMMANDINPUT, 1.0, {10, 15, 64}, 10.0, -1, "/open");
NBarrierCreate(1759.87183, -2572.34668, 39.30200, BARRIER_ROT_OST, MODE_VEHICLE_KEYINPUT);
barierid1 = NBarrierCreate(1759.87183, -2602.34668, 39.30200, BARRIER_ROT_OST, MODE_MANUAL_AUTO, 1.0, {-1}, 10.0);
Defines:
Code:
#define NGATE_MAX_GATES 1000
#define NGATE_MAX_GROUPS 500

#define MOVE_DOWN 0
#define MOVE_UP 1
#define MOVE_NORD 2
#define MOVE_OST 3
#define MOVE_SOUTH 4
#define MOVE_WEST 5
#define MOVE_CUSTOM 6

#define MODE_MANUAL 0
#define MODE_MANUAL_AUTO 1
#define MODE_ALL_AUTO 2
#define MODE_WALK_AUTO 3
#define MODE_VEHICLE_AUTO 4
#define MODE_ALL_KEYINPUT 5
#define MODE_WALK_KEYINPUT 6
#define MODE_VEHICLE_KEYINPUT 7
#define MODE_ALL_COMMANDINPUT 8
#define MODE_WALK_COMMANDINPUT 9
#define MODE_VEHICLE_COMMANDINPUT 10

#define BARRIER_ROT_NORD 90.0
#define BARRIER_ROT_OST 0.0
#define BARRIER_ROT_SOUTH -90.0
#define BARRIER_ROT_WEST 180.0
Video:
https://www.*******.com/watch?v=2PwTTDlonSs

Requirement:
You need Incognitos Streamer Plugin for it to work! Click HERE to download.
You also need the YSI library. Click HERE to download. This library is also included within the NGate package.
There is a possibility that your PAWN compilator will crash while compiling, therefore you should get ZEEX's Pawn Patch. Click HERE to download.

Download:
https://************/NGATE-Release

Credits:
a_samp: SAMP Team
Streamer: Incognito
Y_Hooks and Y_Iterate: Y_Less

Last edited by Nickk888; 10/06/2018 at 12:45 PM. Reason: 3.0 Update
Nickk888 is offline   Reply With Quote
Old 22/05/2018, 05:33 PM   #2
XXpro
Little Clucker
 
Join Date: May 2018
Posts: 20
Reputation: 0
Default Re: NGATE v2.1 - Create gates, barriers and elevators with only 1 line of code!

Nice work
XXpro is offline   Reply With Quote
Old 22/05/2018, 05:38 PM   #3
Eoussama
High-roller
 
Eoussama's Avatar
 
Join Date: Jul 2016
Location: Kingdom of Morocco // Tangier
Posts: 1,259
Reputation: 227
Default Re: NGATE v2.1 - Create gates, barriers and elevators with only 1 line of code!

Amazing, keep that up mate, I had the same idea for the longest time now, +rep.
__________________

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

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


Eoussama is online now   Reply With Quote
Old 22/05/2018, 05:48 PM   #4
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 213
Reputation: 69
Default Re: NGATE v2.1 - Create gates, barriers and elevators with only 1 line of code!

why do you use timers to open gate? instead of opening them instantly also you could use dynamic areas
Lokii is offline   Reply With Quote
Old 22/05/2018, 05:53 PM   #5
CaptainBoi
Big Clucker
 
Join Date: May 2018
Location: India
Posts: 108
Reputation: 10
Default Re: NGATE v2.1 - Create gates, barriers and elevators with only 1 line of code!

awesome
CaptainBoi is offline   Reply With Quote
Old 22/05/2018, 07:58 PM   #6
Nickk888
Little Clucker
 
Nickk888's Avatar
 
Join Date: Oct 2011
Location: Germany
Posts: 20
Reputation: 24
Default Re: NGATE v2.1 - Create gates, barriers and elevators with only 1 line of code!

Quote:
Originally Posted by Lokii View Post
why do you use timers to open gate? instead of opening them instantly also you could use dynamic areas
Thank you for the suggestion! I totally forgot about Dynamic areas I've changed the whole checking system from timers to Dynamic Areas. It's now available in the download link!
Nickk888 is offline   Reply With Quote
Old 23/05/2018, 06:39 AM   #7
NewFreeroamStunt
Banned
 
Join Date: May 2017
Location: Indonesia
Posts: 61
Reputation: 2
Default Re: NGATE v2.1 - Create gates, barriers and elevators with only 1 line of code!

Oh shit, this is very nice bro!
NewFreeroamStunt is offline   Reply With Quote
Old 28/05/2018, 12:46 AM   #8
Chaprnks
Gangsta
 
Chaprnks's Avatar
 
Join Date: Sep 2007
Location: Soviet America
Posts: 745
Reputation: 64
Default Re: NGATE v2.1 - Create gates, barriers and elevators with only 1 line of code!

Glad to see your making use of the YSI library. Since it uses groups, you should use y_groups for that also
__________________
Chaprnks is offline   Reply With Quote
Old 03/06/2018, 09:42 PM   #9
Nickk888
Little Clucker
 
Nickk888's Avatar
 
Join Date: Oct 2011
Location: Germany
Posts: 20
Reputation: 24
Default Re: NGATE v3.0 - Create gates, barriers and elevators with only 1 line of code!

NGate has been updated to version 3.0!
Code:
- Switched from "for(new" loops to YSI's "foreach" loops for better performance.
- Changed some variables name to eliminate potential duplicates.
- Added "moveSpeed" parameter for barriers.
- Barriers rotation is now fully custom. You can still use the definitions or put your own rotation value(0-360 degrees).
- Added "MOVE_CUSTOM" definition for gates.
- Added "movetoX", "movetoY", "movetoZ" parameter for custom 'move-to' position.
- Increased max gates from 250 to 1000.
- Increased max groups from 50 to 500.
- Bug Fixed: Barrier or Gate was stuck if player exited while on gate area.
- Bug Fixed: Barrier or Gate was still in group array when destroyed.
- Other small bug fixes which are not very relevant to put into this list.
Have fun!
Nickk888 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] AutoMove (create automatic gates with ONE LINE!) Lokii Includes 8 18/09/2017 02:55 AM
[FilterScript] My New Map (NEWYORK) With gates and elevators Stanford Filterscripts 1 12/09/2012 04:20 PM
What streamer/code should I use for barriers/moveable gates davelord Scripting Help 3 20/08/2012 05:24 AM
Gates and Elevators thecutkiller Help Archive 1 07/01/2010 05:24 PM
FBI - Gates and Barriers - Los Santos Jedite kod Joa Filterscripts 6 01/09/2009 09:30 AM


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


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