[FilterScript] Simple Gates | 1 Line, 1 Gate
#1

Hello all,
I woke up this morning, and thought about what i could do for you guys, well, seeing as this is my first release, and i know everyone for the first release has done an AFK system, well i like to be different, and i havent seen many of these gate scripts, so here it is:

http://pawn.pastebin.com/AEW4uZRK

Installation:
Copy the file into your PAWN Compiler, add any gates that are required, click compile! Copy it into your FilterScripts folder, and add {your file name} to the filterscripts line in server.cfg

Example gate?
I have included an example gate, near the crossover where the house is in SOUTH LV (You do a mission with a monster truck there) - I do however reccomened you comment this gate out, and only use it as an example to copy off, as people can just walk round this gate!

Add me a gate?
Send me your co-ordinates (open x, y, z, rotx, roty, rotz and closed x, y, z) and ill happily do it for you

Explain how to?
Ok. This script uses an array and loops to create and operate the gates, it loops for a defined amount of gates. The script then create a "command" loop, so it waits for a players command, and tries to find it in the array. You need to fill in all the details requested in the array. Like so:

pawn Код:
{gateid, closedx, closedy, closedz, rotationx, rotationy, rotationz, openx, openy, openz, command (with /), gatemodel}
Gate ID: Means the "number" of the gate
Gate Model: The actual ID of the object you wish to be the gate

To get these coordinates, use a map editor, or SAMP's /save function (although this may not be very accurate for what you want it for)

I need help?!
PM me

I hope you enjoy this script, it was quite irritating to make, but as usual, just a couple of numbers and letters fixed it

Edit: If anybody wants this converting to dcmd, let me know and ill do it for you

Thanks
Ash

Credits:
dice7 - Array/Enum fix
SAMP Team - Creating such a wonderful thing
SAMP Forum - for all the comments and posts that have helped me learn PAWN - im quite good now, according to some people

Enjoy
Reply
#2

The code looks ok, but the array is really static, there's no need for the MAX_GATES constant, you can keep the 1st dimenon empty, aslong as you are filling the array from there, you cannot create a empty array and do something with it anywhere else in the script, otherwise the size will be 0.

And you should remove the timer when you use the command, quick look through 'callbacks' will give you a good idea

Anyway it's a nice job, I like your command operating idea.
Reply
#3

Simple,but very cool and usefull
Ty!
Reply
#4

Quote:
Originally Posted by Joe_
Посмотреть сообщение
The code looks ok, but the array is really static, there's no need for the MAX_GATES constant, you can keep the 1st dimenon empty, aslong as you are filling the array from there, you cannot create a empty array and do something with it anywhere else in the script, otherwise the size will be 0.

And you should remove the timer when you use the command, quick look through 'callbacks' will give you a good idea

And the gateid varible in your array is rather useless, you could just use the index of the array as the gateid, it's not as complex as it sounds.

Anyway it's a nice job, I like your command operating idea.
Cheers mate - i just took a look at your jGate system, and it look quite literally, awesome

About you're gateid comment, i use that as the name so i can trigger move object with that number, and then hopefully, noobish users get the drift a bit better

Thanks
Ash
Reply
#5

Haha sorry, I forgot that you actually do need the gateid varible (I have it too), talked before I thought, forgive me lol.
Reply
#6

Really good, awesome work mate!
Keep it up
Reply
#7

Quote:
Originally Posted by Montserrat
Посмотреть сообщение
Simple,but very cool and usefull
Ty!
Thanks Anytime
Reply
#8

Quote:
Originally Posted by ikarus
Посмотреть сообщение
Really good, awesome work mate!
Keep it up
Cheers I will, hopefully

Quote:
Originally Posted by _Joe
Haha sorry, I forgot that you actually do need the gateid varible (I have it too), talked before I thought, forgive me lol.
Well done Ill let you off

*Double Post, sorry
Reply
#9

Simple and nice
Reply
#10

Quote:
Originally Posted by markokk888
Посмотреть сообщение
Simple and nice
Thanks
Reply
#11

Good Job
Reply
#12

Thanks adri93

- I hope this has been useful for everyone
Reply
#13

so. can i have gates that rotate, instead of go up and down?
how would i do this?
Reply
#14

Quote:
Originally Posted by Hal
Посмотреть сообщение
so. can i have gates that rotate, instead of go up and down?
how would i do this?
They can also go left and right, however i dont think there is a native function or callback to change and objects rotation with a speed. Although you can use SetObjectRot to change the rotation of an object, but doing SetObjectRot will not look very nice, and will look like the gate "jumps" from one position to another.

If you still wish to rotate the gate just add this to the script (where the OnPlayerCommand callback is (in the strcmp section)) - (this is only if you want to rotate one gate on the individual gate command.

pawn Код:
if(Gates[i][command] == {YOUR GATE COMMAND})
{
     SetObjectRot({YOUR GATE ID}, {ITS NEW ROTATION});
}
The information you need to change i have put in:
Код:
{ and }
(squiggly brackets) XD - Hopefully this all goes ok, as i havent tested it.
Reply
#15

I have some gates and I want to make them to open automatically...I searched a lot and tryed but I failed...See more down.

In the first SS the gate is closed and the cords are : x:2156.2241210938 y:-53.90096282959 z:6.9096240997314
x:5.4986572265625 y:357.98950195313 z:357.61999511719 (rotation)
/imageshack/img525/6...0729093740.png

I want the gate to be open in the right side...like in the 2nd SS

/imageshack/img18/227...0729093803.png
The cords are : x:2144.4741210938 y:-53.597415924072 z:6.9096240997314
x:5.4986572265625 y:357.98950195313 z:357.61999511719 (rotation)

If you can make me a pawno code for this gates...i'll be very happy...+a cmd like /open(if it's possible to open it from into the car) and then after 7 seconds to close automatically..

Thank you very much,
T4viY
Reply
#16

Quote:
Originally Posted by T4vY
Посмотреть сообщение
I have some gates and I want to make them to open automatically...I searched a lot and tryed but I failed...See more down.

In the first SS the gate is closed and the cords are : x:2156.2241210938 y:-53.90096282959 z:6.9096240997314
x:5.4986572265625 y:357.98950195313 z:357.61999511719 (rotation)
/imageshack/img525/6...0729093740.png

I want the gate to be open in the right side...like in the 2nd SS

/imageshack/img18/227...0729093803.png
The cords are : x:2144.4741210938 y:-53.597415924072 z:6.9096240997314
x:5.4986572265625 y:357.98950195313 z:357.61999511719 (rotation)

If you can make me a pawno code for this gates...i'll be very happy...+a cmd like /open(if it's possible to open it from into the car) and then after 7 seconds to close automatically..

Thank you very much,
T4viY
This is what i created this script for? However i can add you're co-ordinates in for you. If you want to change how long the gates stay open for, then edit the
pawn Код:
#define OPEN_FOR 10000
line (20). This number is in milliseconds

If you dont wish to use my script, then you can either PM me for some help on you're gate, or post a help thread in the "Scripting Discussion" forum. If you do wish to use my script, PM me, as i said on the first post.
Reply
#17

nice work buts whats the difference between gateid and gatemodel?
Reply
#18

Quote:
Originally Posted by a!DaN)_)-)
Посмотреть сообщение
nice work buts whats the difference between gateid and gatemodel?
Thanks, i should of explained this a bit further i guess, but here you go:

Gate ID: Means the "number" of the gate
Gate Model: The actual ID of the object you wish to be the gate
Reply
#19

God Job Very god
Reply
#20

Quote:
Originally Posted by sergio_xd
Посмотреть сообщение
God Job Very god
Thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)