PDA

View Full Version : [FilterScript] Simple Gates | 1 Line, 1 Gate


Ash.
01/08/2010, 10:15 AM
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:

{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 :)

Joe_
01/08/2010, 10:22 AM
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.

nuriel8833
01/08/2010, 10:30 AM
Simple,but very cool and usefull
Ty!

Ash.
01/08/2010, 10:51 AM
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

Joe_
01/08/2010, 11:14 AM
Haha sorry, I forgot that you actually do need the gateid varible (I have it too), talked before I thought, forgive me lol.

[MWR]Blood
01/08/2010, 11:24 AM
Really good, awesome work mate!
Keep it up

Ash.
01/08/2010, 01:29 PM
Simple,but very cool and usefull
Ty!

Thanks :) Anytime

Ash.
01/08/2010, 01:31 PM
Really good, awesome work mate!
Keep it up

Cheers :) I will, hopefully

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 :)

markokk888
01/08/2010, 09:09 PM
Simple and nice :D

Ash.
02/08/2010, 08:16 AM
Simple and nice :D

Thanks :)

adri93
02/08/2010, 03:05 PM
Good Job

Ash.
02/08/2010, 04:33 PM
Thanks adri93 :)

- I hope this has been useful for everyone :)

Hal
02/08/2010, 07:24 PM
so. can i have gates that rotate, instead of go up and down?
how would i do this?

Ash.
02/08/2010, 08:01 PM
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.


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.

T4vY
04/08/2010, 09:06 AM
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)
http://img525.imageshack.us/img525/6209/mtascreen20100729093740.png

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

http://img18.imageshack.us/img18/2277/mtascreen20100729093803.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

Ash.
04/08/2010, 09:37 AM
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)
http://img525.imageshack.us/img525/6209/mtascreen20100729093740.png

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

http://img18.imageshack.us/img18/2277/mtascreen20100729093803.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 #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 (http://forum.sa-mp.com/forumdisplay.php?f=12)" forum. If you do wish to use my script, PM me, as i said on the first post.

a!DaN)_)-)
04/08/2010, 08:16 PM
nice work buts whats the difference between gateid and gatemodel?

Ash.
05/08/2010, 06:34 PM
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

sergio_xd
05/08/2010, 07:56 PM
God Job :D Very god

Ash.
06/08/2010, 09:15 AM
God Job :D Very god

Thanks :)

a!DaN)_)-)
06/08/2010, 05:24 PM
ah so gate id is your personal gate id in a sorta way ok i get it so your first gate would be 1 for the id?

Hal
19/08/2010, 02:45 AM
ah so gate id is your personal gate id in a sorta way ok i get it so your first gate would be 1 for the id?

yes, you would number them in order for simplicity.

MBX97
14/10/2010, 06:05 AM
its kinda BASIC , OLD , SIMPLE
but any way :
GUD JOB MATE AND KEEP UP THE GUD WORK

Slice
14/10/2010, 07:05 AM
You can use sizeof( Gates ) instead of maintaining MAX_GATES.

byrongta
27/10/2010, 06:34 PM
I have a bug, tell me you would know why?
E: \ Users \ Byron \ Documents \ SERVER \ filterscripts \ puertas.pwn (25): error 029: invalid expression, assumes zero

this is the line

{1, -760.57293701172,730.67974853516,17.14900970459,0.0 ,0.0,328.23999023438, -767.73754882813,735.09216308594,17.14900970459, / mygate, 969}

multinfs
14/11/2010, 05:51 PM
well it works for me but i get these errors:

G:\server\filterscripts\Gatesystem.pwn(25) : warning 213: tag mismatch
G:\server\filterscripts\Gatesystem.pwn(25) : warning 213: tag mismatch
G:\server\filterscripts\Gatesystem.pwn(25) : warning 213: tag mismatch
G:\server\filterscripts\Gatesystem.pwn(25) : warning 213: tag mismatch
G:\server\filterscripts\Gatesystem.pwn(26) : warning 213: tag mismatch
G:\server\filterscripts\Gatesystem.pwn(26) : warning 213: tag mismatch
G:\server\filterscripts\Gatesystem.pwn(26) : warning 213: tag mismatch
G:\server\filterscripts\Gatesystem.pwn(27) : warning 213: tag mismatch
G:\server\filterscripts\Gatesystem.pwn(27) : warning 213: tag mismatch
G:\server\filterscripts\Gatesystem.pwn(27) : warning 213: tag mismatch
G:\server\filterscripts\Gatesystem.pwn(27) : warning 213: tag mismatch
G:\server\filterscripts\Gatesystem.pwn(27) : warning 213: tag mismatch
i got 3 lines with gates and i put co-ordinates right as the example.
and can you make it possible to do /close too? just so noone will get in before the gate closes.

••• ĤÁĶÁM •••
14/11/2010, 06:33 PM
Looks cool, well done!

Ash.
17/11/2010, 06:09 PM
well it works for me but i get these errors:

i got 3 lines with gates and i put co-ordinates right as the example.
and can you make it possible to do /close too? just so noone will get in before the gate closes.

The gates close automatically

- Can you show me the code that corresponds to those errors (lines: 25, 26 and 27)

I have a bug, tell me you would know why?
E: \ Users \ Byron \ Documents \ SERVER \ filterscripts \ puertas.pwn (25): error 029: invalid expression, assumes zero

this is the line

{1, -760.57293701172,730.67974853516,17.14900970459,0.0 ,0.0,328.23999023438, -767.73754882813,735.09216308594,17.14900970459, / mygate, 969}

Replace your'e bugged line with this:
{1, -760.57293701172,730.67974853516,17.14900970459,0.0 ,0.0,328.23999023438, -767.73754882813,735.09216308594,17.14900970459, "/mygate", 969}

[HUN]Poldzsiii
08/12/2010, 12:30 PM
Nice job Ash :D

Ash.
17/12/2010, 04:44 PM
Poldzsiii;947547']Nice job Ash :D

Thanks :)

Stefan_Toretto
17/12/2010, 09:15 PM
Yes, (n00b's friendly)