Advertisement
Guest User

Untitled

a guest
Dec 29th, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. #include <a_singleplayer>
  2. #include "RouteConnector.inc"
  3.  
  4. main()
  5. {
  6. gps_AddPlayer(0);
  7. ChangeOPCNIURate(2);
  8. }
  9.  
  10. public OnScriptExit()
  11. {
  12. gps_RemovePlayer(0);
  13. return 1;
  14. }
  15.  
  16. new Size = 0;
  17. new Float:RoutePos[2048][3];
  18. new calculating = 0;
  19.  
  20. public GPS_WhenRouteIsCalculated(routeid,node_id_array[],amount_of_nodes,Float:distance,Float:Polygon[],Polygon_Size)//Every processed Queue will be called here
  21. {
  22. for(new i = 0; i < amount_of_nodes; ++i)
  23. {
  24. GetNodePos(node_id_array[i],RoutePos[i][0],RoutePos[i][1],RoutePos[i][2]);
  25. }
  26. Size = amount_of_nodes;
  27. calculating = 0;
  28. return 1;
  29. }
  30.  
  31. public OnPlayerClosestNodeIDChange(playerid,old_NodeID,new_NodeID)
  32. {
  33. if(calculating)
  34. {
  35. if(GetTickCount()-calculating < 1000)
  36. {
  37. return 1;
  38. }
  39. calculating = 0;
  40. RemoveAllRouteIDFromQueue();
  41. }
  42. new id = new_NodeID;
  43. if(id == (-1))
  44. {
  45. id = NearestPlayerNode(0);
  46. }
  47. CalculatePath(id,0);
  48. calculating = GetTickCount();
  49. return 1;
  50. }
  51.  
  52. public DirectXRenderer()
  53. {
  54. if(Size > 15)
  55. {
  56. for(new i = 0; i < 30; ++i)
  57. {
  58. SP_DrawLine(RoutePos[i][0],RoutePos[i][1],RoutePos[i][2],RoutePos[i+1][0],RoutePos[i+1][1],RoutePos[i+1][2],0xFF00FF00);
  59. }
  60. }
  61. else
  62. {
  63. for(new i = 0; i < (Size-1); ++i)
  64. {
  65. SP_DrawLine(RoutePos[i][0],RoutePos[i][1],RoutePos[i][2],RoutePos[i+1][0],RoutePos[i+1][1],RoutePos[i+1][2],0xFF00FF00);
  66. }
  67. }
  68. return 1;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement