31.07.2010, 21:31
(
Последний раз редактировалось Joe_; 02.08.2010 в 20:25.
)
jGate
Automatic Gate System
With this Filterscript you can create a automatic gate with the choices of having them for a vehicle only, onfoot only, or both.
jGate supports up, down, left, right moving, it also supports SETTING rotation.
I did not include a smooth rotation (maybe used for barriers) because it wouldn't be worth the very fast timer per moving object, so keep in mind this uses the Icognito's Streamer's SetDynamicObjectRot, which sets the rot, not movies it slowly.
jGate also supports interiors and virtual worlds.
jGate requires Icognitos streamer plugin installed and running, you can download it at:
https://sampforum.blast.hk/showthread.php?tid=102865
Description
jGate is a stand-alone Filterscript used for creating a automatic gate with many options, all in one line, whilst being rather efficient.
Performance
jGate has its ups and downs.
There's one timer, the callback that the timer uses has one player loop, that has as many itterations as your maxplayers in your server.cfg, for every player, there's a loop that checks all gates, so more gates you have, the more recourses will be used.
maxplayers * amount of gates = total itterations
which would be called every X seconds, so try to keep the timer interval at a slow rate, I used 3 as a example, which is still rather low, 5 looks decents, depending on your average player count.
The code has been optimized for speed and at the same time be as dynamic as possible.
Please keep in mind this script has only been tested with one player, reworking the script logically didn't show up any bugs that would only make it work for one player, if you do find such a bug, tell me.
Bugs
If you have two gates in the same vercinity (rather close, for example, the two gates at SF airport in singleplayer) only one of them will open, this is because there's only one cell in an array for every player, if I would've let both open, the first GateID that was stored in that cell would be erased, hense the gate never closing, I am thinking of reworking this in the future.
Install
Go to the file 'pawno' in your server directory and open it, there open 'pawno.exe' and click 'new'.
Once you've done that, right click and click 'select all' then press delete.
Then you'll need the code, which is in the 'Download' section below, go to the link and copy and paste the code into the pawno document, for instructions on how to insert a gate, read below.
Once you have pasted the code into the pawno document, compile and close.
Add the name of the file to the end of your 'filterscripts' line in your server.cfg.
Then you're finished.
Adding a Gate
Adding a gate with jGate is rather simple.
The script itself is based on arrays, so it's super easy.
Steps:
Open jGate.pwn and find the line 'new gData[][E_GATE_DATA]'
Underneath will be the format used to create a gate.
Where the example gate is (the code starting with '1337') delete it, and use the following format to create your gate:
Once finished, double check your coordinates to make sure they're correct and compile, then close.
Please remember, YOU WILL NEED TO GET THE GATE COORDINATES YOURSELF! THIS IS JUST A HANDLER.
Then you're finished, have fun with your new gate!
Remember, you can add more gates, not just one. (Wouldn't that be a buzzkill)
Suggestions
If you have a suggestion that will add more options, please post them !
Download
Pastebin: http://joelewis.pastebin.com/5WDdAAsZ
Changelog
02/08/2010 - Added rotation support
Automatic Gate System
With this Filterscript you can create a automatic gate with the choices of having them for a vehicle only, onfoot only, or both.
jGate supports up, down, left, right moving, it also supports SETTING rotation.
I did not include a smooth rotation (maybe used for barriers) because it wouldn't be worth the very fast timer per moving object, so keep in mind this uses the Icognito's Streamer's SetDynamicObjectRot, which sets the rot, not movies it slowly.
jGate also supports interiors and virtual worlds.
jGate requires Icognitos streamer plugin installed and running, you can download it at:
https://sampforum.blast.hk/showthread.php?tid=102865
Description
jGate is a stand-alone Filterscript used for creating a automatic gate with many options, all in one line, whilst being rather efficient.
Performance
jGate has its ups and downs.
There's one timer, the callback that the timer uses has one player loop, that has as many itterations as your maxplayers in your server.cfg, for every player, there's a loop that checks all gates, so more gates you have, the more recourses will be used.
maxplayers * amount of gates = total itterations
which would be called every X seconds, so try to keep the timer interval at a slow rate, I used 3 as a example, which is still rather low, 5 looks decents, depending on your average player count.
The code has been optimized for speed and at the same time be as dynamic as possible.
Please keep in mind this script has only been tested with one player, reworking the script logically didn't show up any bugs that would only make it work for one player, if you do find such a bug, tell me.
Bugs
If you have two gates in the same vercinity (rather close, for example, the two gates at SF airport in singleplayer) only one of them will open, this is because there's only one cell in an array for every player, if I would've let both open, the first GateID that was stored in that cell would be erased, hense the gate never closing, I am thinking of reworking this in the future.
Install
Go to the file 'pawno' in your server directory and open it, there open 'pawno.exe' and click 'new'.
Once you've done that, right click and click 'select all' then press delete.
Then you'll need the code, which is in the 'Download' section below, go to the link and copy and paste the code into the pawno document, for instructions on how to insert a gate, read below.
Once you have pasted the code into the pawno document, compile and close.
Add the name of the file to the end of your 'filterscripts' line in your server.cfg.
Then you're finished.
Adding a Gate
Adding a gate with jGate is rather simple.
The script itself is based on arrays, so it's super easy.
Steps:
Open jGate.pwn and find the line 'new gData[][E_GATE_DATA]'
Underneath will be the format used to create a gate.
Where the example gate is (the code starting with '1337') delete it, and use the following format to create your gate:
pawn Код:
{Model, ClosedX, ClosedY, ClosedZ, ClosedRotX, ClosedRotY, ClosedRotZ, OpenX, OpenY, OpenZ, OpenRotX, OpenRotY, OpenRotZ, Interior, World, Drawdistance, Radius, Speed, State (KEEP FALSE), ignorevehicle (0 = driver+onfoot, 1 = onfoot, 2 = driver), GateID (KEEP -1)}
Please remember, YOU WILL NEED TO GET THE GATE COORDINATES YOURSELF! THIS IS JUST A HANDLER.
Then you're finished, have fun with your new gate!
Remember, you can add more gates, not just one. (Wouldn't that be a buzzkill)
Suggestions
If you have a suggestion that will add more options, please post them !
Download
Pastebin: http://joelewis.pastebin.com/5WDdAAsZ
Changelog
02/08/2010 - Added rotation support