11.01.2016, 17:04
(
Последний раз редактировалось Gigi-The-Beast; 11.01.2016 в 18:09.
)
[WIP] Easy Doors v0.1
Description
WORK IN PROGRESS
This include provides an easy way to implement interactive doors in your gamemode. After creation of a door, it is possible to open and close it easily, check when a player in near a door, or check if a player is near any door.
With every created object, the script also creates a dynamic area that provides an easy way of checking if a player is near the door.
List Of Functions
CreateDoor(modelid, Float: x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
* Function creates a door object with invisible area (if debug is active, it creates 4 debug objects on corners of area)
modelid - the ID of the model for the door object (See restrictions)
x - coordinate X
y - coordinate Y
z - coordinate Z
rx - coordinate of rotation X
ry - coordinate of rotation Y
rz - coordinate of rotation Z
Returns door ID or 0 if door could not be created
DestroyDoor(doorid)
* Function destroys a door
doorid - ID of a door (createdoor returns door id)
Returns 1 on success or 0 if door could not be destroyed
MoveDoor(doorid, doorstate, Float: speed = 1.0)
* Function opens or closes a door depending on the state
doorid - the ID of the door
doorstate - DS_DOOR_CLOSE to close the door or DS_DOOR_OPEN to open it
speed - default is 1.0 and it is instant, if you want to open/close it slowly, use 0.01 to 0.001
Returns 1 on success or 0 if function failed to execute
IsPlayerInDoorZone(playerid, doorid)
* Function checks if player is in a door zone. A door zone is an invisible zone with 1.5 units width and length on both sides of door (too see it, uncomment DS_DEBUG)
playerid - the id of the player that you want to check
doorid - the id of the door
Returns 1 if player is in the zone, or 0 if player is not in the zone
IsPlayerInAnyDoorZone(playerid)
* Function check if player is in any door zone.
playerid - the id of the player for check
Returns ID of the zone the player is in, or 0 if player is not in any zone
Installation
To install this include, you must have Streamer Plugin by Incognito.
Add file "doors.inc" to the Pawno folder and then include it in your gamemode.
To activate/deactivate debug mode, simply comment/uncomment DS_DEBUG row.
To increase max number of doors, change MAX_DOORS to the desired value.
Limitations
Currently only these door modelids are supported: 1504, 1505, 1506, 1507
Soon other doors will be supported too.
Download
http://pastebin.com/aGE5MnPN
Changelog
Код:
v0.1 - 11.01.2016 - Created the code