GTAMP.com

Grand Theft Auto Multiplayer
It is currently Wed Jan 23, 2019 4:48 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Doors
PostPosted: Wed Jun 13, 2012 3:46 pm 
Offline
Ped

Joined: Wed May 23, 2012 12:43 pm
Posts: 4
Hello Guys...
I want to make a door in a multi-player map that opens only for players who have 10,000 points or more, but I have some problems...

Here's what I tried:
Code:
// Door Data
DOOR_DATA sg_door = SINGLE (11, 5, 2) (11.0, 6.0, 2.0, 1.0, 1.0)
BOTTOM 0 ANY_PLAYER CLOSE_WHEN_OPEN_RULE_FAILS 0 NOT_FLIPPED NOT_REVERSED
MAKE_DOOR_MANUAL(sg_door)

// Subroutines For The Door
sg_opendoor_Pa:
     IF(CHECK_SCORE_GREATER(Pa, 9999))
          ADD_SCORE(Pa, -10000)
          UPDATE_DOOR_TARGET(sg_door, Pa)
          MAKE_DOOR_AUTOMATIC(sg_door)
     ENDIF
RETURN

sg_opendoor_Pb:
     IF(CHECK_SCORE_GREATER(Pb, 9999))
          ADD_SCORE(Pb, -10000)
          UPDATE_DOOR_TARGET(sg_door, Pb)
          MAKE_DOOR_AUTOMATIC
     ENDIF
RETURN

sg_closedoorbehind:
     CLOSE_DOOR(sg_door)
RETURN

// Thread Triggers For The Door
THREAD_TRIGGER sg_waitdooropen_Pa = THREAD_WAIT_FOR_CHAR_IN_BLOCK
(Pa, 11, 6, 2, sg_opendoor_Pa:)
THREAD_TRIGGER sg_waitdooropen_Pb = THREAD_WAIT_FOR_CHAR_IN_BLOCK
(Pb, 11, 6, 2, sg_opendoor_Pb:)
THREAD_TRIGGER sg_waitdoorclose_Pa = THREAD_WAIT_FOR_CHAR_IN_BLOCK
(Pa, 11, 4, 2, sg_closedoorbehind:)
THREAD_TRIGGER sg_waitdoorclose_Pb = THREAD_WAIT_FOR_CHAR_IN_BLOCK
(Pb, 11, 4, 2, sg_closedoorbehind:)

ENABLE_THREAD_TRIGGER(sg_waitdooropen_Pa)
ENABLE_THREAD_TRIGGER(sg_waitdooropen_Pb)
ENABLE_THREAD_TRIGGER(sg_waitdoorclose_Pa)
ENABLE_THREAD_TRIGGER(sg_waitdoorclose_Pb)


The door opens for the first time, and then it doesn't open again? Any ideas?


Top
 Profile  
 
 Post subject: Re: Doors
PostPosted: Wed Jun 13, 2012 4:22 pm 
Offline
User avatar

Joined: Wed Mar 17, 2010 4:07 am
Posts: 414
Location: Wales, UK
A few things that come to mind:

1 - If your score was high enough and were in the area by the door, it would constantly deduct $10,000.
2 - If two (or more) people went to the door at the same time, they'd both lose $10,000.
3 - The 'THREAD_WAIT_FOR_CHAR_IN_BLOCK' only applies if they are on foot.
4 - You don't really need thread triggers for this, you can use IF statements instead and generally more flexible. You can use things like LOCATE_CHARACTER_ANY_MEANS for both people in vehicles or on foot or LOCATE_CHARACTER_ON_FOOT for just foot only. You'll need to add some counters too to check who has paid so it doesn't constantly deduct money and if the door(s) is open etc.

I have a garage tutorial here and a more expanded, working tutorial here if you want to look at them.

_________________


Top
 Profile  
 
 Post subject: Re: Doors
PostPosted: Wed Jun 13, 2012 4:29 pm 
Offline
Hitman

Joined: Sat May 19, 2012 6:12 pm
Posts: 108
Location: Holland, AKA The Netherlands
I'm still not entirely sure how Thread Triggers work entirely but i assume they disable themselves after one use? I suggest running ENABLE_THREAD_TRIGGER(TT_Name) somewhere in the script after the thread trigger did its thing assuming they work like that. Perhaps using counters to check if its in use and recently activated and run the command after its activated for more uses.

If the Thread Triggers are not to blame somehow i suggest trying keeping the door manual and manually script-wise opening and closing it without updating the target whenever a target gets close enough. As doors can be weird like that to stop functioning correctly after target updates. And probaly one to check if no player is stuck in the door when its trying to close.

Doors are tricky bastards though... Try anything you can think of, GTA2 scripting was always a bit about that, getting around the limits with something inventive, heh.


Top
 Profile  
 
 Post subject: Re: Doors
PostPosted: Wed Jun 13, 2012 9:19 pm 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:00 pm
Posts: 953
Location: F21B3EED
Do you want the door to stay open? that would be easier to script.

_________________
My GTA2 related projects:


Top
 Profile  
 
 Post subject: Re: Doors
PostPosted: Thu Jun 14, 2012 1:39 pm 
Offline

Joined: Sat May 16, 2009 6:14 am
Posts: 889
Location: London, UK
Dafe's Death Valley has something like this. You can go into a barn near the West coast and steal a Coach. But only if you have $5,000 or more, I think.

DOOR objects are too weird for multiplayer. Weapons are blocked when inside the door, to avoid cars being shot while they are parking.

_________________
GTA5 Race, DM & Capture | GTA2 Levels & Coding | GTA2 YouTube Videos
Gran Turismo 6 custom track club(Sign in with PSN details, then follow link again.)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group