Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {$CLEO .cs}
- const
- // not only does constants for vars in SB make it easier to remember vars we can also change the
- // vars at any time for better var management (very useful if you forgot to leave space for a string)
- stage = 0@
- door = 1@
- open_door = 2@
- player = $PLAYER_CHAR
- scplayer = $PLAYER_ACTOR
- // #KMB_LOCKEDDOOR is not allowed. Doesn't mean we have to stick with a number and later be clueless as to which model is which.
- KMB_LOCKEDDOOR = 2949
- // And here we save 4 variables
- doorPosX = 191.141
- doorPosY = 1870.04
- doorPosZ = 18.4766
- doorTarX = 181.141 // x coord door will slide to
- end
- stage = 0
- :mainloop
- WAIT 0
- // there's still always room for low-construct where it doesn't really make a difference :P
- IS_PLAYER_PLAYING player
- ELSE_GOTO @mainloop
- IF stage == 0
- THEN
- IF // any means == by car or foot
- LOCATE_CHAR_ANY_MEANS_3D scplayer 191.141 1870.04 18.4766 80.5 80.5 80.5 FALSE // R*N comments exactly where the coords point to.. makes sense, why not us?
- THEN
- doorPosX = 191.141
- doorPosY = 1870.04
- doorPosZ = 18.4766
- doorTarX = 181.141
- REQUEST_MODEL KMB_LOCKEDDOOR
- WHILE NOT HAS_MODEL_LOADED KMB_LOCKEDDOOR // better than repeat..until, since we have a chance to avoid WAIT altogether
- WAIT 0
- END
- CREATE_OBJECT KMB_LOCKEDDOOR doorPosX doorPosY doorPosZ door
- SET_OBJECT_HEADING door 90.0
- open_door = 0
- stage = 1
- END
- END
- IF
- stage == 1
- THEN
- IF
- LOCATE_CHAR_ANY_MEANS_3D scplayer doorPosX doorPosY doorPosZ 90.5 90.5 90.5 FALSE
- THEN
- IF
- LOCATE_CHAR_ANY_MEANS_3D scplayer doorPosX doorPosY doorPosZ 10.5 10.5 10.5 TRUE
- THEN
- IF
- open_door == 0
- THEN
- SLIDE_OBJECT door doorTarX doorPosY doorPosZ 0.1 0.1 0 FALSE
- IF LOCATE_OBJECT_2D door doorTarX doorPosY 1.0 1.0 FALSE
- THEN open_door = 1
- END
- ELSE
- SLIDE_OBJECT door doorPosX doorPosY doorPosZ 0.1 0.1 0 FALSE
- IF LOCATE_OBJECT_2D door doorPosX doorPosY 1.0 1.0 FALSE
- THEN open_door = 0
- END
- END
- END
- ELSE
- DELETE_OBJECT door // why set a flag to make the streamer remove it when we can remove it? :)
- MARK_MODEL_AS_NO_LONGER_NEEDED KMB_LOCKEDDOOR
- END
- END
- GOTO @mainloop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement