Advertisement
RiccB

Gate System

Oct 31st, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. #define MAX_GATES 5
  2.  
  3.  
  4. new bool:gate[MAX_GATES];
  5. new gateid[MAX_GATES];
  6.  
  7. enum gateinfo
  8. {
  9. VartuID,
  10. Float:gX,
  11. Float:gY,
  12. Float:gZ,
  13. Float:gRX,
  14. Float:gRY,
  15. Float:gRZ
  16. };
  17.  
  18.  
  19. new gates[MAX_GATES][gateinfo]={
  20. {968,-1572.19666,658.63202,6.9021,0.0,90.00,90.0}, //pd
  21. {968,-1701.41809,687.78229,24.6812,0.0,90.0,-90.0}, // pd
  22. {968,-2038.0072,-103.5425,35.3543,0.0,90.0,900.0}, // pd
  23. {980,-717.58337, 964.64331, 13.90640, 0.00000, 0.00000, 90.00000},//gaujos
  24. {968,-2695.253662, -189.174194, 3.864799, 0.000000, -90.000000, 90.000000}}; // TAXI
  25.  
  26.  
  27. stock MoveNearestGate(playerid)
  28. {
  29. for(new g;g<MAX_GATES;g++)
  30. {
  31. if(IsPlayerInRangeOfPoint(playerid,10,gates[g][gX],gates[g][gY],gates[g][gZ]))
  32. {
  33. if(gate[g]==true)
  34. {
  35. if(gates[g][VartuID]==968)
  36. {
  37. MoveDynamicObject(gateid[g],gates[g][gX],gates[g][gY],gates[g][gZ],0.02,gates[g][gRX],gates[g][gRY],gates[g][gRZ]);
  38. gate[g]=false;
  39. }
  40. else
  41. {
  42. MoveDynamicObject(gateid[g],gates[g][gX],gates[g][gY],gates[g][gZ],2,gates[g][gRX],gates[g][gRY],gates[g][gRZ]);
  43. gate[g]=false;
  44. }
  45.  
  46. }
  47.  
  48. else
  49. {
  50. if(gates[g][VartuID]==968)
  51. {
  52. MoveDynamicObject(gateid[g],gates[g][gX],gates[g][gY]+0.05,gates[g][gZ],0.02,gates[g][gRX],gates[g][gRY]-90,gates[g][gRZ]);
  53. gate[g]=true;
  54. }
  55. else
  56. {
  57. MoveDynamicObject(gateid[g],gates[g][gX],gates[g][gY]-12,gates[g][gZ],2,gates[g][gRX],gates[g][gRY],gates[g][gRZ]);
  58. gate[g]=false;
  59. }
  60. }
  61. }
  62. }
  63. return 1;
  64. }
  65.  
  66.  
  67.  
  68.  
  69. public OnGameModeInit()
  70. {
  71. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  72.  
  73. for(new g;g<MAX_GATES;g++)
  74. {
  75. gate[g]=false;
  76. gateid[g] = CreateDynamicObject(gates[g][VartuID],gates[g][gX],gates[g][gY],gates[g][gZ],gates[g][gRX],gates[g][gRY],gates[g][gRZ],-1,-1);
  77. }
  78. return 1;
  79. }
  80.  
  81.  
  82.  
  83. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  84. {
  85. if(newkeys == KEY_YES) MoveNearestGate(playerid);
  86. return 1;
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement