Functions - Pottus/ColAndreas GitHub Wiki
CA_Init
- Returns:
- 0 when there is no data loaded (ex. when you don't have the data file)
- 1 when loaded map successfully or was already loaded
CA_RemoveBuilding
- Parameters:
modelid
: The model to be removed
Float:x, Float:y, Float:z
: The coordinates in which the objects will be removed
Float:radius
: The radius around the specified point to remove from
- Returns:
- 0 when the map is already initialized
- 1 when successfully removed
- Remarks:
- You must use this function before using
CA_Init
CA_RestoreBuilding
- Parameters:
modelid
: The model to be restored
Float:x, Float:y, Float:z
: The coordinates in which the objects will be restored
Float:radius
: The radius around the specified point to restored from
- Returns:
- 0 when the map is not initialized
- 1 when successfully restored
- Remarks:
- You must use this function after using
CA_Init
CA_RayCastLine
- Parameters:
Float:StartX, Float:StartY, Float:StartZ
: The beginning point of the ray
Float:EndX, Float:EndY, Float:EndZ
: The ending point of the ray
&Float:x, &Float:y, &Float:z
: The point that the ray collided
- Returns:
- 0 if the ray didn't collide with anything
- WATER_OBJECT if the ray collided with water
- The model of the object the ray collided
CA_RayCastLineID
- Parameters:
Float:StartX, Float:StartY, Float:StartZ
: The beginning point of the ray
Float:EndX, Float:EndY, Float:EndZ
: The ending point of the ray
&Float:x, &Float:y, &Float:z
: The point that the ray collided
- Returns:
- -1 if the ray collided with a static object or water
- 0 if the ray didn't collide with anything
- The index of the object the ray collided
- Remarks:
- This only works with objects created with
add
enabled in CA_CreateObject
, such as the objects created by the "_DC" functions
CA_RayCastLineExtraID
- Parameters:
type
: The extra ID index
Float:StartX, Float:StartY, Float:StartZ
: The beginning point of the ray
Float:EndX, Float:EndY, Float:EndZ
: The ending point of the ray
&Float:x, &Float:y, &Float:z
: The point that the ray collided
- Returns:
- -1 if the ray collided with a static object or water
- -1 if the extra ID is unmodified
- 0 if the ray didn't collide with anything
- The index of the object the ray collided
- Remarks:
- This only works with objects created with
add
enabled in CA_CreateObject
, such as the objects created by the "_DC" functions
CA_RayCastMultiLine
- Parameters:
Float:StartX, Float:StartY, Float:StartZ
: The beginning point of the ray
Float:EndX, Float:EndY, Float:EndZ
: The ending point of the ray
Float:retx[], Float:rety[], Float:retz[]
: The points that the ray collided
Float:retdist[]
: The distances between the beginning point and the point collided
ModelIDs[]
: The object models that the ray collided
size = sizeof(retx)
: The maximum number of points to collide
- Returns:
- -1 if the ray collided with more points than than permitted by the
size
parameter
- 0 if the ray didn't collide with anything
- The number of points collided
- Remarks:
- Currently doesn't order points in order of collision (you can still use the distances to sort them)
CA_RayCastLineAngle
- Parameters:
Float:StartX, Float:StartY, Float:StartZ
: The beginning point of the ray
Float:EndX, Float:EndY, Float:EndZ
: The ending point of the ray
&Float:x, &Float:y, &Float:z
: The point that the ray collided
&Float:rx, &Float:ry, &Float:rz
: The rotation of the face that the ray collided
- Returns:
- 0 if the ray didn't collide with anything
- WATER_OBJECT if the ray collided with water
- The model of the object the ray collided
CA_RayCastReflectionVector
- Parameters:
Float:StartX, Float:StartY, Float:StartZ
: The beginning point of the ray
Float:EndX, Float:EndY, Float:EndZ
: The ending point of the ray
&Float:x, &Float:y, &Float:z
: The point that the ray collided
&Float:nx, &Float:ny, &Float:nz
: The reflection vector of the face that the ray collided
- Returns:
- 0 if the ray didn't collide with anything
- WATER_OBJECT if the ray collided with water
- The model of the object the ray collided
CA_RayCastLineNormal
- Parameters:
Float:StartX, Float:StartY, Float:StartZ
: The beginning point of the ray
Float:EndX, Float:EndY, Float:EndZ
: The ending point of the ray
&Float:x, &Float:y, &Float:z
: The point that the ray collided
&Float:nx, &Float:ny, &Float:nz
: The surface normal of the face that the ray collided
- Returns:
- 0 if the ray didn't collide with anything
- WATER_OBJECT if the ray collided with water
- The model of the object the ray collided
CA_ContactTest
- Parameters:
modelid
: The object model to be tested
Float:x, Float:y, Float:z
: The object position to test
Float:rx, Float:ry, Float:rz
: The object rotation to test
- Returns:
- 0 if the object model doesn't collide with the world with the specified
- 1 otherwise
CA_EulerToQuat
- Parameters:
Float:rx, Float:ry, Float:rz
: GTA euler rotations to be converted
&Float:x, &Float:y, &Float:z, &Float:w
: The quaternion angles returned
- Returns:
CA_QuatToEuler
- Parameters:
&Float:x, &Float:y, &Float:z, &Float:w
: The quaternion angles to be converted
Float:rx, Float:ry, Float:rz
: GTA euler rotations returned
- Returns:
CA_GetModelBoundingSphere
- Parameters:
modelid
: The object model
&Float:offx, &Float:offy, &Float:offz
: The offset of the model's bounding sphere
&Float:radius
: The radius of the model's bounding sphere
- Returns:
- 0 if the model is invalid
- 1 otherwise
CA_GetModelBoundingBox
- Parameters:
modelid
: The object model
&Float:minx, &Float:miny, &Float:minz
: The "minimum" point of the model's bounding box
&Float:maxx, &Float:maxy, &Float:maxz
: The "maximum" point of the model's bounding box
- Returns:
- 0 if the model is invalid
- 1 otherwise
CA_SetObjectExtraID
- Parameters:
index
: The index of the ColAndreas object
type
: The index of the extra ID to be set (from 0 to 9)
data
: The data stored in the extra ID
- Returns:
- Always 1 (which needs to be changed to be like CA_GetObjectExtraID's returns...)
CA_GetObjectExtraID
- Parameters:
index
: The index of the ColAndreas object
type
: The index of the extra ID to be set
- Returns:
- -1 if the index or type is invalid
- The data stored in the extra ID
CA_RayCastLineEx
- Parameters:
Float:StartX, Float:StartY, Float:StartZ
: The beginning point of the ray
Float:EndX, Float:EndY, Float:EndZ
: The ending point of the ray
&Float:x, &Float:y, &Float:z
: The point that the ray collided
&Float:rx, &Float:ry, &Float:rz, &Float:rw
: The quaternion rotation of the object that the ray collided
&Float:cx, &Float:cy, &Float:cz
: The position of the object that the ray collided
- Returns:
- 0 if the ray didn't collide with anything
- WATER_OBJECT if the ray collided with water
- The model of the object the ray collided
CA_RayCastLineAngleEx
- Parameters:
Float:StartX, Float:StartY, Float:StartZ
: The beginning point of the ray
Float:EndX, Float:EndY, Float:EndZ
: The ending point of the ray
&Float:x, &Float:y, &Float:z
: The point that the ray collided
&Float:rx, &Float:ry, &Float:rz
: The rotation of the face that the ray collided
&Float:ocx, &Float:ocy, &Float:ocz
: The position of the object that the ray collided
&Float:orx, &Float:ory, &Float:orz
: The rotation of the object that the ray collided
- Returns:
- 0 if the ray didn't collide with anything
- WATER_OBJECT if the ray collided with water
- The model of the object the ray collided
CA_LoadFromDff
- Parameters:
newid
: Custom model id to be added to col. pool
dffFileName
: Dff file path you want to load its collision
- Returns:
- -1 if plugin couldn't find/open file (related to permissions or wrong path)
- 0 if dff file had no collision or corrupted data
- 1 if loading dff file and reading collision data was successful objects)
- Remarks:
- Loads collision from given dff file to support SA-MP 0.3DL custom models.
CA_CreateObject
- Parameters:
modelid
: The collision model to create
Float:x, Float:y, Float:z
: The position in which to create the collision model
Float:rx, Float:ry, Float:rz
: The rotation of the collision model
bool:add = false
: Whether or not to store this objects index for manual management
- Returns:
- -1 if the specified model has no collision (should be changed to -2, to avoid confusion with unmanaged objects)
- -1 if
add
is false
- The index of the created collision object
- Remarks:
- ONLY CREATES THE COLLISION, NOT THE IN-GAME OBJECT
CA_DestroyObject
- Parameters:
index
: The index of the object to be destroyed
- Returns:
- -1 if the specified model has no collision (should be changed to -2, to avoid confusion with unmanaged objects)
- -1 if
add
is false
- The index of the created collision object
CA_IsValidObject
- Parameters:
index
: Checks if an object with the ID provided exists
- Returns:
- -1 if the specified model has no collision
- 0 if the object does not exist
- 1 if the object exists
CA_SetObjectPos
- Parameters:
index
: The index of the object to be moved
Float:x, Float:y, Float:z
: The new position
- Returns:
- 0 if the object doesn't exist
- 1 if the new position was set successfully
CA_SetObjectRot
- Parameters:
index
: The index of the object to be moved
Float:rx, Float:ry, Float:rz
: The new rotation
- Returns:
- 0 if the object doesn't exist
- 1 if the new rotation was set successfully
CA_CreateObject_DC
- Parameters:
modelid
: The model to create
Float:x, Float:y, Float:z
: The position in which to create the object
Float:rx, Float:ry, Float:rz
: The rotation of the object
Float:drawdistance = 300.0
: Whether or not to store this objects index for manual management
- Returns:
- -1 if the object couldn't be created
- -1 if there are too many "DC" objects
- The "DC" index of the created object
- Remarks:
- The index returned by this function can only be used by "DC" functions
CA_DestroyObject_DC
- Parameters:
index
: The DC index of the object to destroy
- Returns:
- -1 if the index is invalid
- -1 if the object doesn't exist
- 1 or next interator index if the object was destroyed
CA_SetObjectPos_DC
- Parameters:
index
: The DC index of the object to be moved
Float:x, Float:y, Float:z
: The new position
- Returns:
- -1 if the index is invalid
- -1 if the object doesn't exist
- 1 if the new position was set successfully
CA_SetObjectRot_DC
- Parameters:
index
: The DC index of the object to be moved
Float:rx, Float:ry, Float:rz
: The new rotation
- Returns:
- -1 if the index is invalid
- -1 if the object doesn't exist
- 1 if the new rotation was set successfully
CA_DestroyAllObjects_DC
CA_FindZ_For2DCoord
- Remarks:
- The ColAndreas alternative for MapAndreas's entire function
- This function does everything MapAndreas is capable of doing, and without the ground limit
CA_RayCastExplode
- Returns:
- Every collided point as an array
- Remarks:
- Explode ray casts in every direction
CA_IsPlayerOnSurface
- Parameters:
playerid
: The playerid to check
Float:tolerance = 1.5
: The distance to check for the ground
- Returns:
- 0 if the player is not on the ground
- 1 if the player is on the ground
CA_IsVehicleOnSurface
- Parameters:
vehicleid
: The vehicleid to check
Float:tolerance = 1.5
: The distance to check for the ground
- Returns:
- 0 if the vehicle is not on the ground
- 1 if the vehicle is on the ground
CA_RemoveBarriers
- Returns:
- Remarks:
- Removes all of the barrier object collisions
- You must use this function before using
CA_Init
CA_RemoveBreakableBuildings
- Returns:
- Remarks:
- Removes all of the breakable object collisions
- You must use this function before using
CA_Init
CA_IsPlayerInWater
- Parameters:
playerid
: The playerid to check
&Float:depth
: The lowest collision point found
&Float:playerdepth
: How deep the player is below the surface
- Returns:
- 0 if the player is not in water
- 1 if the player is in water
CA_IsVehicleInWater
- Parameters:
vehicleid
: The vehicleid to check
&Float:depth
: The lowest collision point found
&Float:vehicledepth
: How deep the vehicle is below the surface
- Returns:
- 0 if the vehicle is not in water
- 1 if the vehicle is in water
CA_IsPlayerNearWater
- Parameters:
playerid
: The playerid to check
Float:dist = 3.0
: The distance to check for water
Float:height = 3.0
: The height the player can be from the water
- Returns:
- 0 if the player is not near water
- 1 if the player is near water
- Remarks:
- Checks for water all around the player
CA_IsVehicleNearWater
- Parameters:
vehicleid
: The vehicleid to check
Float:dist = 3.0
: The distance to check for water
Float:height = 3.0
: The height the vehicle can be from the water
- Returns:
- 0 if the vehicle is not near water
- 1 if the vehicle is near water
- Remarks:
- Checks for water all around the vehicle
CA_IsPlayerFacingWater
- Parameters:
playerid
: The playerid to check
Float:dist = 3.0
: The distance to check for water
Float:height = 3.0
: The height the player can be from the water
- Returns:
- 0 if the player is not facing water
- 1 if the player is facing water
- Remarks:
- Checks for water only in front of the player
CA_IsVehicleFacingWater
- Parameters:
vehicleid
: The vehicleid to check
Float:dist = 3.0
: The distance to check for water
Float:height = 3.0
: The height the vehicle can be from the water
- Returns:
- 0 if the vehicle is not facing water
- 1 if the vehicle is facing water
- Remarks:
- Checks for water only in front of the vehicle
CA_IsPlayerBlocked
- Parameters:
playerid
: The playerid to check
Float:dist = 1.5
: The distance to check for a wall
Float:height = 0.5
: The height the wall can be from the ground
- Returns:
- 0 if the player is not blocked
- 1 if the player is blocked
CA_IsVehicleBlocked
- Parameters:
vehicleid
: The vehicleid to check
Float:dist = 1.5
: The distance to check for a wall
Float:height = 0.5
: The height the wall can be from the ground
- Returns:
- 0 if the vehicle is not blocked
- 1 if the vehicle is blocked
CA_GetRoomHeight
- Parameters:
Float:x, Float:y, Float:z
: A point in the area to be checked
- Returns:
- 0.0 if there is either no floor or no ceiling
- The distance from the ceiling to the floor
CA_GetRoomCenter
- Parameters:
Float:x, Float:y, Float:z
: A point in the area to be checked
&Float:m_x, &Float:m_y
: The center X and Y of the area
- Returns:
- -1.0 if there isn't enough collisions to determine the center
- The radius of the circle formed by the test