_DucK_196_

Untitled

Jul 21st, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. #include <a_samp>
  2. #define MAX_OBJ 403
  3.  
  4. new ObjNum;
  5. new RT[MAX_PLAYERS];
  6. enum ObjInfo
  7. {
  8. modelid,
  9. Float:X,
  10. Float:Y,
  11. Float:Z,
  12. Float:rX,
  13. Float:rY,
  14. Float:rZ,
  15. Float:DrawDistance,
  16. Float:mX,
  17. Float:mY,
  18. Float:mZ,
  19. Float:Xrm,
  20. Float:Yrm,
  21. Float:Zrm,
  22. Float:SpeedD,
  23. bool:Rotated,
  24. bool:Moved,
  25. bool:Exists,
  26. bool:Created[MAX_PLAYERS],
  27. iD[MAX_PLAYERS]
  28. };
  29. new ObjVar[MAX_OBJ][ObjInfo];
  30.  
  31. stock DucK_CreateObject(modelido, Float:Xo, Float:Yo, Float:Zo, Float:rXo, Float:rYo, Float:rZo, Float:DrawDistanceo = 200.0)
  32. {
  33. ObjNum++;
  34. ObjVar[ObjNum][modelid] = modelido;
  35. ObjVar[ObjNum][X] = Xo;
  36. ObjVar[ObjNum][Y] = Yo;
  37. ObjVar[ObjNum][Z] = Zo;
  38. ObjVar[ObjNum][rX] = rXo;
  39. ObjVar[ObjNum][rY] = rYo;
  40. ObjVar[ObjNum][rZ] = rZo;
  41. ObjVar[ObjNum][DrawDistance] = DrawDistanceo;
  42. ObjVar[ObjNum][Exists] = true;
  43. if(ObjNum == MAX_OBJ-1) printf("..>> DucK Streamer: ERROR - #define MAX_OBJ Is Too Low.\n..>> DucK Streamer: Only First %d Objects Were Created.", MAX_OBJ+1);
  44. return ObjNum;
  45. }
  46. stock DucK_RemoveObject(Objectid)
  47. {
  48. ObjVar[Objectid][Exists] = false;
  49. }
  50. stock DucK_MoveObject(Objectid, Float:Xm, Float:Ym, Float:Zm, Float:SpeedDm = 2.5, Float:RotXm = -1000.0, Float:RotYm = -1000.0, Float:RotZm = -1000.0)
  51. {
  52. if(ObjVar[Objectid][Exists])
  53. {
  54. if(RotXm == -1000.0) RotXm = ObjVar[Objectid][Xrm];
  55. if(RotYm == -1000.0) RotYm = ObjVar[Objectid][Yrm];
  56. if(RotZm == -1000.0) RotZm = ObjVar[Objectid][Zrm];
  57. ObjVar[Objectid][mX] = Xm;
  58. ObjVar[Objectid][mY] = Ym;
  59. ObjVar[Objectid][mZ] = Zm;
  60. ObjVar[Objectid][Xrm] = RotXm;
  61. ObjVar[Objectid][Yrm] = RotYm;
  62. ObjVar[Objectid][Zrm] = RotZm;
  63. ObjVar[Objectid][SpeedD] = SpeedDm;
  64. ObjVar[Objectid][Moved] = true;
  65. ObjVar[Objectid][Rotated] = true;
  66. }
  67. }
  68. stock DucK_RotateObject(Objectid, Float:RotX, Float:RotY, Float:RotZ)
  69. {
  70. if(ObjVar[Objectid][Exists])
  71. {
  72. ObjVar[Objectid][Xrm] = RotXm;
  73. ObjVar[Objectid][Yrm] = RotYm;
  74. ObjVar[Objectid][Zrm] = RotZm;
  75. ObjVar[Objectid][Rotated] = true;
  76. }
  77. }
  78. stock DucK_ReturnObject(Objectid)
  79. {
  80. ObjVar[Objectid][Rotated] = false;
  81. ObjVar[Objectid][Moved] = false;
  82. }
  83.  
  84. forward RefreshObjects(playerid);
  85. public RefreshObjects(playerid)
  86. {
  87. for(new i; i < ObjNum; i++)
  88. {
  89. if(ObjVar[i][Exists])
  90. {
  91. if(IsPlayerInRangeOfPoint(playerid, ObjVar[i][DrawDistance], ObjVar[i][X], ObjVar[i][Y], ObjVar[i][Z]))
  92. {
  93. if(!ObjVar[i][Created][playerid])
  94. {
  95. ObjVar[i][iD][playerid] = CreatePlayerObject(playerid, ObjVar[i][modelid], ObjVar[i][X], ObjVar[i][Y], ObjVar[i][Z], ObjVar[i][rX], ObjVar[i][rY], ObjVar[i][rZ], ObjVar[i][DrawDistance]);
  96. if(ObjVar[i][Moved])
  97. {
  98. MoveObject(ObjVar[i][iD][playerid], ObjVar[i][mX], ObjVar[i][mY], ObjVar[i][mZ], ObjVar[i][SpeedD], ObjVar[i][Xrm], ObjVar[i][Yrm], ObjVar[i][Zrm]);
  99. }
  100. if(ObjVar[i][Rotated])
  101. {
  102. SetObjectRot(ObjVar[i][iD][playerid], ObjVar[i][Xrm], ObjVar[i][Yrm], ObjVar[i][Zrm]);
  103. }
  104. }
  105. }
  106. else
  107. {
  108. if(ObjVar[i][Created][playerid])
  109. {
  110. DestroyPlayerObject(playerid, ObjVar[i][iD][playerid]);
  111. }
  112. }
  113. }
  114. else if(!ObjVar[i][Exists])
  115. {
  116. DestroyPlayerObject(playerid, ObjVar[i][iD][playerid]);
  117. }
  118. }
  119. return 1;
  120. }
Advertisement
Add Comment
Please, Sign In to add comment