RouteConnector
From SA-MP Wiki
Documentation for Gamer_Z's RouteConnector Plugin.
Plugin Functions
Note | All the plugin source can be found in Route Connector Github page |
AddNode
Description:
Float:X | 3D coordinates from position X |
Float:Y | 3D coordinates from position Y |
Float:Z | 3D coordinates from position Z |
AddToPathFinder | If set to 1 it will also make sure the graph will be updated so when searching for a route it will be added to the list |
AddToScanner | If set to 1 the node will be available in OnPlayerClosestNodeIDChange, else not |
Return Values:
Note | NEVER set AddToPathFinder to 1 when a calculation is in progress! That is your own responsability if it happens! |
AddNodeEx
Description:
ID | ID as Custom NodeID |
Float:X | 3D coordinates from position X |
Float:Y | 3D coordinates from position Y |
Float:Z | 3D coordinates from position Z |
AddToPathFinder | If set to 1 it will also make sure the graph will be updated so when searching for a route it will be added to the list |
AddToScanner | If set to 1 the node will be available in OnPlayerClosestNodeIDChange, else not |
Return Values:
Note | NEVER set AddToPathFinder to 1 when a calculation is in progress! That is your own responsability if it happens! |
ConnectNodes
Description:
NodeID_one | NodeID_one as NodeID |
NodeID_two | NodeID_two as NodeID |
AddToPathFinder | if set to 1 it will also make sure the graph will be updated so when searching for a route it will be added to the list |
direction | you can choose to only connect nodeID one with nodeID two (1) or to connect them together (0) |
Return Values:
-1 - NodeOne is out of boundaries -2 - NodeTwo is out of boundaries -3 - NodeOne equals NodeTwo -4 - NodeOne doesn't exist -5 - NodeTwo doesn't exist -6 - NodeOne already connected with NodeTwo -7 - NodeTwo already connected with NodeOne -8 - No more connection slots left or direction does not equal 1 or 0Anything above or equal to 0 means success (the NodeOne[connectid] is retuned).
Note | NEVER set AddToPathFinder to 1 when a calculation is in progress! That is your own responsability if it happens! |
NearestPlayerNode
Description:
playerid | The playerid to count from |
MaxDist | The maximal distance to search from the player |
IgnoreNodeID | This node ID will not be returned as the closest one, it will be ignored in the search. |
UseAreas | If set to 0 it will go through all nodes in memory, else if to 1 it will do just the nodes in the area where the player is (not so accurate). |
Return Values:
NearestNodeFromPoint
Description:
Float:X | 3D coordinates from X |
Float:Y | 3D coordinates from Y |
Float:Z | 3D coordinates from Z |
MaxDist | The maximal distance to search from the point |
IgnoreNodeID | This node ID will not be returned as the closest one, it will be ignored in the search. |
UseAreas | If set to 0 it will go through all nodes in memory, else if to 1 it will do just the nodes in the area where the player is (not so accurate). |
Return Values:
WriteNodesToFile
Description:
filename[] | The 'path/filename.extension' to store the information in, note that if you want to make a file in the scriptfiles folder you need to supply: WriteNodesToFile('path/filename.extension'); |
Return Values:
ReadNodesFromFile
Description:
filename[] | The 'path/filename.extension' to read the information from, note that if you want to read a file in the scriptfiles folder you need to supply: ReadNodesFromFile('scriptfiles/your.file.name'); |
GetNodePos
Description:
NodeID | The The NodeID to get the position from |
Float:X | The 3D coordinate X passed by reference |
Float:Y | The 3D coordinate Y passed by reference |
Float:Z | The 3D coordinate Z passed by reference |
Return Values:
CalculatePath
Description:
Start | The start NodeID |
End | The destination NodeID |
RouteID | (optional) Here you can specify an integer value that will be passed to the callback, Along with the calculated path information, for example the PlayerID |
CreatePolygon | Creates a polygon around the path if set to true |
PolygonWidth | The width from the node lines to the edge of the polygon |
bool:GrabNodePositions | If true, make sure that NodePos array is filled with usefull information. |
Return Values:
IsNodeIntersection
Description:
NodeID | The NodeID to check |
Return Values:
GetAngleBetweenNodes
Description:
NodeID_one | The first node ID |
NodeID_two | The second node ID |
NodeID_three | The third node ID |
Return Values:
GetConnectedNodes
Description:
NodeID | The NodeID to get connected nodes. |
Return Values:
GetNextEmptyNodeID
Description:
NodeID | The NodeID to get closest empty nodes. |
Example: new id = GetNextEmptyNodeID(); if(id != -1)AddNodeEx(id,X,Y,Z); //However this example results in: AddNode(X,Y,Z);
Return Values:
GetQueueSize
Description:
Return Values:
GetConnectedNodeID
Description:
NodeID | The NodeID to get connected nodes. |
NodeID | The Connected NodeID variable passed by reference. |
Return Values:
Float:GetConnectedNodeDistance
Description:
NodeID | The first connected NodeID. |
ConnectID | The second connected NodeID. |
Return Values:
Float:GetDistanceBetweenNodes
Description:
NodeID_one | The first node ID |
NodeID_two | The second node ID |
Return Values:
IsNodeInPathFinder
Description:
NodeID | The NodeID to check |
Return Values:
GetRouteArray
Description:
ID | The ID of Route Array |
destination | The destination which data will be stored in |
size | The size of destination |
Return Values:
GetRouteAtPos
Description:
ID | The ID of Route |
array_pos | The position of node in Route Array |
amount_of_nodes | (optional)The size of destination by default |
Return Values:
StoreRouteArray
Description:
amount_of_nodes | The amount of Nodes which will be stored |
array | The array which will be stored in plugin's vector memory |
Return Values:
DeleteArray
Description:
ID | The array ID which content will be removed. |
Return Values:
AddExistingNodeToPathFinder
Description:
NodeID | The node to be added in routecalculator |
Return Values:
RemoveNode
Description:
NodeID | The node to be deleted |
Return Values:
DisconnectNodeFromNode
Description:
NodeID_One | The first NodeID |
NodeID_Two | The second NodeID |
Return Values:
DisconnectAllFromNode
Description:
NodeID | The NodeID which will be disconnected |
Return Values:
DeleteNodeSystemAtNode
Description:
NodeID | The NodeID which will be the deleted in the array |
array[] | The array which the NodeSystem will be Deleted |
size | The size of array by default |
Return Values:
Plugin Callbacks
OnPlayerClosestNodeIDChange
Description:
playerid | The player which node has changed |
old_NodeID | The previous node id |
new_NodeID | The new node id |
GPS_WhenRouteIsCalculated
Description:
routeid | The id of calculated route |
node_id_array[] | This array is up to 1792 cells long it is build from the following information: node_id_array[0] ... node_id_array[1791] - all points (Node ID's) on the route in following order: from start, to end |
amount_of_nodes | This is the amount of nodes the total path is, is set to 0 when it's impossible to calculate the route. |
Float:distance | The total distance all nodes take, rounded to an integer, is -1 if it's impossible to calculate the route. |
Float:Polygon[] | The polygon around the path, only given if you specified it at calculatepath. |
Float:Polygon_Size/2 | amount of points in polygon. |
Float:NodePosX[] | The specified node coordinate X. |
Float:NodePosY[] | The specified node coordinate Y. |
Float:NodePosZ[] | The specified node coordinate Z. |
//Example of usage: public GPS_WhenRouteIsCalculated(...) { for(new i = 0; i < amount_of_nodes; ++i) { printf("Point(%d)=NodeID(%d),position(X;Y;Z):%f;%f;%f}", i,node_id_array[i:NodePosX[i],:NodePosY[i],:NodePosZ[i]); } return 1; }