Guest User

Streamer

a guest
Sep 6th, 2014
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.24 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2014 Incognito
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16.  
  17. #include <a_samp>
  18.  
  19. // Definitions
  20.  
  21. #define STREAMER_TYPE_OBJECT (0)
  22. #define STREAMER_TYPE_PICKUP (1)
  23. #define STREAMER_TYPE_CP (2)
  24. #define STREAMER_TYPE_RACE_CP (3)
  25. #define STREAMER_TYPE_MAP_ICON (4)
  26. #define STREAMER_TYPE_3D_TEXT_LABEL (5)
  27. #define STREAMER_TYPE_AREA (6)
  28. #define OBJECT_MATERIAL_SIZE_256x128 (7)
  29.  
  30. #define STREAMER_AREA_TYPE_CIRCLE (0)
  31. #define STREAMER_AREA_TYPE_CYLINDER (1)
  32. #define STREAMER_AREA_TYPE_SPHERE (2)
  33. #define STREAMER_AREA_TYPE_RECTANGLE (3)
  34. #define STREAMER_AREA_TYPE_CUBOID (4)
  35. #define STREAMER_AREA_TYPE_POLYGON (5)
  36.  
  37. #define STREAMER_OBJECT_TYPE_GLOBAL (0)
  38. #define STREAMER_OBJECT_TYPE_PLAYER (1)
  39. #define STREAMER_OBJECT_TYPE_DYNAMIC (2)
  40.  
  41. #if !defined FLOAT_INFINITY
  42. #define FLOAT_INFINITY (Float:0x7F800000)
  43. #endif
  44.  
  45. // Include File Version
  46.  
  47. public Streamer_IncludeFileVersion = 0x27301;
  48.  
  49. #pragma unused Streamer_IncludeFileVersion
  50.  
  51. // Enumerator
  52.  
  53. enum
  54. {
  55. E_STREAMER_ATTACHED_OBJECT,
  56. E_STREAMER_ATTACHED_PLAYER,
  57. E_STREAMER_ATTACHED_VEHICLE,
  58. E_STREAMER_ATTACH_OFFSET_X,
  59. E_STREAMER_ATTACH_OFFSET_Y,
  60. E_STREAMER_ATTACH_OFFSET_Z,
  61. E_STREAMER_ATTACH_R_X,
  62. E_STREAMER_ATTACH_R_Y,
  63. E_STREAMER_ATTACH_R_Z,
  64. E_STREAMER_ATTACH_X,
  65. E_STREAMER_ATTACH_Y,
  66. E_STREAMER_ATTACH_Z,
  67. E_STREAMER_COLOR,
  68. E_STREAMER_DRAW_DISTANCE,
  69. E_STREAMER_EXTRA_ID,
  70. E_STREAMER_INTERIOR_ID,
  71. E_STREAMER_MAX_X,
  72. E_STREAMER_MAX_Y,
  73. E_STREAMER_MAX_Z,
  74. E_STREAMER_MIN_X,
  75. E_STREAMER_MIN_Y,
  76. E_STREAMER_MIN_Z,
  77. E_STREAMER_MODEL_ID,
  78. E_STREAMER_MOVE_R_X,
  79. E_STREAMER_MOVE_R_Y,
  80. E_STREAMER_MOVE_R_Z,
  81. E_STREAMER_MOVE_SPEED,
  82. E_STREAMER_MOVE_X,
  83. E_STREAMER_MOVE_Y,
  84. E_STREAMER_MOVE_Z,
  85. E_STREAMER_NEXT_X,
  86. E_STREAMER_NEXT_Y,
  87. E_STREAMER_NEXT_Z,
  88. E_STREAMER_PLAYER_ID,
  89. E_STREAMER_R_X,
  90. E_STREAMER_R_Y,
  91. E_STREAMER_R_Z,
  92. E_STREAMER_SIZE,
  93. E_STREAMER_STREAM_DISTANCE,
  94. E_STREAMER_STYLE,
  95. E_STREAMER_TEST_LOS,
  96. E_STREAMER_TYPE,
  97. E_STREAMER_WORLD_ID,
  98. E_STREAMER_X,
  99. E_STREAMER_Y,
  100. E_STREAMER_Z
  101. }
  102.  
  103. // Natives (Settings)
  104.  
  105. native Streamer_GetTickRate();
  106. native Streamer_SetTickRate(rate);
  107. native Streamer_GetMaxItems(type);
  108. native Streamer_SetMaxItems(type, items);
  109. native Streamer_GetVisibleItems(type);
  110. native Streamer_SetVisibleItems(type, items);
  111. native Streamer_GetCellDistance(&Float:distance);
  112. native Streamer_SetCellDistance(Float:distance);
  113. native Streamer_GetCellSize(&Float:size);
  114. native Streamer_SetCellSize(Float:size);
  115.  
  116. // Natives (Updates)
  117.  
  118. native Streamer_ProcessActiveItems();
  119. native Streamer_ToggleIdleUpdate(playerid, toggle);
  120. native Streamer_IsToggleIdleUpdate(playerid);
  121. native Streamer_ToggleItemUpdate(playerid, type, toggle);
  122. native Streamer_IsToggleItemUpdate(playerid, type);
  123. native Streamer_Update(playerid);
  124. native Streamer_UpdateEx(playerid, Float:x, Float:y, Float:z, worldid = -1, interiorid = -1);
  125.  
  126. // Natives (Data Manipulation)
  127.  
  128. native Streamer_GetFloatData(type, {Text3D,_}:id, data, &Float:result);
  129. native Streamer_SetFloatData(type, {Text3D,_}:id, data, Float:value);
  130. native Streamer_GetIntData(type, {Text3D,_}:id, data);
  131. native Streamer_SetIntData(type, {Text3D,_}:id, data, value);
  132. native Streamer_GetArrayData(type, {Text3D,_}:id, data, dest[], maxdest = sizeof dest);
  133. native Streamer_SetArrayData(type, {Text3D,_}:id, data, const src[], maxsrc = sizeof src);
  134. native Streamer_IsInArrayData(type, {Text3D,_}:id, data, value);
  135. native Streamer_AppendArrayData(type, {Text3D,_}:id, data, value);
  136. native Streamer_RemoveArrayData(type, {Text3D,_}:id, data, value);
  137. native Streamer_GetUpperBound(type);
  138.  
  139. // Natives (Miscellaneous)
  140.  
  141. native Streamer_GetDistanceToItem(Float:x, Float:y, Float:z, type, {Text3D,_}:id, &Float:distance, dimensions = 3);
  142. native Streamer_GetItemInternalID(playerid, type, {Text3D,_}:streamerid);
  143. native Streamer_GetItemStreamerID(playerid, type, {Text3D,_}:internalid);
  144. native Streamer_IsItemVisible(playerid, type, {Text3D,_}:id);
  145. native Streamer_DestroyAllVisibleItems(playerid, type, serverwide = 1);
  146. native Streamer_CountVisibleItems(playerid, type, serverwide = 1);
  147. native Streamer_DestroyAllItems(type, serverwide = 1);
  148. native Streamer_CountItems(type, serverwide = 1);
  149.  
  150. // Natives (Objects)
  151.  
  152. native CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 200.0, Float:drawdistance = 0.0);
  153. native DestroyDynamicObject(objectid);
  154. native IsValidDynamicObject(objectid);
  155. native SetDynamicObjectPos(objectid, Float:x, Float:y, Float:z);
  156. native GetDynamicObjectPos(objectid, &Float:x, &Float:y, &Float:z);
  157. native SetDynamicObjectRot(objectid, Float:rx, Float:ry, Float:rz);
  158. native GetDynamicObjectRot(objectid, &Float:rx, &Float:ry, &Float:rz);
  159. native MoveDynamicObject(objectid, Float:x, Float:y, Float:z, Float:speed, Float:rx = -1000.0, Float:ry = -1000.0, Float:rz = -1000.0);
  160. native StopDynamicObject(objectid);
  161. native IsDynamicObjectMoving(objectid);
  162. native AttachCameraToDynamicObject(playerid, objectid);
  163. native AttachDynamicObjectToVehicle(objectid, vehicleid, Float:offsetx, Float:offsety, Float:offsetz, Float:rx, Float:ry, Float:rz);
  164. native EditDynamicObject(playerid, objectid);
  165. native GetDynamicObjectMaterial(objectid, materialindex, &modelid, txdname[], texturename[], &materialcolor, maxtxdname = sizeof txdname, maxtexturename = sizeof texturename);
  166. native SetDynamicObjectMaterial(objectid, materialindex, modelid, const txdname[], const texturename[], materialcolor = 0);
  167. native GetDynamicObjectMaterialText(objectid, materialindex, text[], &materialsize, fontface[], &fontsize, &bold, &fontcolor, &backcolor, &textalignment, maxtext = sizeof text, maxfontface = sizeof fontface);
  168. native SetDynamicObjectMaterialText(objectid, materialindex, const text[], materialsize = OBJECT_MATERIAL_SIZE_256x128, const fontface[] = "Arial", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0);
  169.  
  170. // Natives (Pickups)
  171.  
  172. native CreateDynamicPickup(modelid, type, Float:x, Float:y, Float:z, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
  173. native DestroyDynamicPickup(pickupid);
  174. native IsValidDynamicPickup(pickupid);
  175.  
  176. // Natives (Checkpoints)
  177.  
  178. native CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
  179. native DestroyDynamicCP(checkpointid);
  180. native IsValidDynamicCP(checkpointid);
  181. native TogglePlayerDynamicCP(playerid, checkpointid, toggle);
  182. native TogglePlayerAllDynamicCPs(playerid, toggle);
  183. native IsPlayerInDynamicCP(playerid, checkpointid);
  184. native GetPlayerVisibleDynamicCP(playerid);
  185.  
  186. // Natives (Race Checkpoints)
  187.  
  188. native CreateDynamicRaceCP(type, Float:x, Float:y, Float:z, Float:nextx, Float:nexty, Float:nextz, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
  189. native DestroyDynamicRaceCP(checkpointid);
  190. native IsValidDynamicRaceCP(checkpointid);
  191. native TogglePlayerDynamicRaceCP(playerid, checkpointid, toggle);
  192. native TogglePlayerAllDynamicRaceCPs(playerid, toggle);
  193. native IsPlayerInDynamicRaceCP(playerid, checkpointid);
  194. native GetPlayerVisibleDynamicRaceCP(playerid);
  195.  
  196. // Natives (Map Icons)
  197.  
  198. native CreateDynamicMapIcon(Float:x, Float:y, Float:z, type, color, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0, style = MAPICON_LOCAL);
  199. native DestroyDynamicMapIcon(iconid);
  200. native IsValidDynamicMapIcon(iconid);
  201.  
  202. // Natives (3D Text Labels)
  203.  
  204. native Text3D:CreateDynamic3DTextLabel(const text[], color, Float:x, Float:y, Float:z, Float:drawdistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
  205. native DestroyDynamic3DTextLabel(Text3D:id);
  206. native IsValidDynamic3DTextLabel(Text3D:id);
  207. native GetDynamic3DTextLabelText(Text3D:id, text[], maxtext = sizeof text);
  208. native UpdateDynamic3DTextLabelText(Text3D:id, color, const text[]);
  209.  
  210. // Natives (Areas)
  211.  
  212. native CreateDynamicCircle(Float:x, Float:y, Float:size, worldid = -1, interiorid = -1, playerid = -1);
  213. native CreateDynamicCylinder(Float:x, Float:y, Float:minz, Float:maxz, Float:size, worldid = -1, interiorid = -1, playerid = -1);
  214. native CreateDynamicSphere(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1);
  215. native CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1);
  216. native CreateDynamicCuboid(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worldid = -1, interiorid = -1, playerid = -1);
  217. native CreateDynamicCube(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worldid = -1, interiorid = -1, playerid = -1);
  218. native CreateDynamicPolygon(Float:points[], Float:minz = -FLOAT_INFINITY, Float:maxz = FLOAT_INFINITY, maxpoints = sizeof points, worldid = -1, interiorid = -1, playerid = -1);
  219. native DestroyDynamicArea(areaid);
  220. native IsValidDynamicArea(areaid);
  221. native GetDynamicPolygonPoints(areaid, Float:points[], maxpoints = sizeof points);
  222. native GetDynamicPolygonNumberPoints(areaid);
  223. native TogglePlayerDynamicArea(playerid, areaid, toggle);
  224. native TogglePlayerAllDynamicAreas(playerid, toggle);
  225. native IsPlayerInDynamicArea(playerid, areaid, recheck = 0);
  226. native IsPlayerInAnyDynamicArea(playerid, recheck = 0);
  227. native IsAnyPlayerInDynamicArea(areaid, recheck = 0);
  228. native IsAnyPlayerInAnyDynamicArea(recheck = 0);
  229. native GetPlayerDynamicAreas(playerid, areas[], maxareas = sizeof areas);
  230. native GetPlayerNumberDynamicAreas(playerid);
  231. native IsPointInDynamicArea(areaid, Float:x, Float:y, Float:z);
  232. native IsPointInAnyDynamicArea(Float:x, Float:y, Float:z);
  233. native AttachDynamicAreaToObject(areaid, objectid, type = STREAMER_OBJECT_TYPE_DYNAMIC, playerid = INVALID_PLAYER_ID);
  234. native AttachDynamicAreaToPlayer(areaid, playerid);
  235. native AttachDynamicAreaToVehicle(areaid, vehicleid);
  236.  
  237. // Natives (Extended)
  238.  
  239. native CreateDynamicObjectEx(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float:drawdistance = 0.0, Float:streamdistance = 200.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  240. native CreateDynamicPickupEx(modelid, type, Float:x, Float:y, Float:z, Float:streamdistance = 100.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  241. native CreateDynamicCPEx(Float:x, Float:y, Float:z, Float:size, Float:streamdistance = 100.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  242. native CreateDynamicRaceCPEx(type, Float:x, Float:y, Float:z, Float:nextx, Float:nexty, Float:nextz, Float:size, Float:streamdistance = 100.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  243. native CreateDynamicMapIconEx(Float:x, Float:y, Float:z, type, color, style = MAPICON_LOCAL, Float:streamdistance = 100.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  244. native Text3D:CreateDynamic3DTextLabelEx(const text[], color, Float:x, Float:y, Float:z, Float:drawdistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0, Float:streamdistance = 100.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  245. native CreateDynamicCircleEx(Float:x, Float:y, Float:size, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  246. native CreateDynamicCylinderEx(Float:x, Float:y, Float:minz, Float:maxz, Float:size, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  247. native CreateDynamicSphereEx(Float:x, Float:y, Float:z, Float:size, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  248. native CreateDynamicRectangleEx(Float:minx, Float:miny, Float:maxx, Float:maxy, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  249. native CreateDynamicCuboidEx(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  250. native CreateDynamicCubeEx(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  251. native CreateDynamicPolygonEx(Float:points[], Float:minz = -FLOAT_INFINITY, Float:maxz = FLOAT_INFINITY, maxpoints = sizeof points, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players);
  252.  
  253. // Natives (Deprecated)
  254.  
  255. native Streamer_TickRate(rate);
  256. native Streamer_MaxItems(type, items);
  257. native Streamer_VisibleItems(type, items);
  258. native Streamer_CellDistance(Float:distance);
  259. native Streamer_CellSize(Float:size);
  260. native Streamer_CallbackHook(callback, {Float,_}:...);
  261.  
  262. native DestroyAllDynamicObjects();
  263. native CountDynamicObjects();
  264. native DestroyAllDynamicPickups();
  265. native CountDynamicPickups();
  266. native DestroyAllDynamicCPs();
  267. native CountDynamicCPs();
  268. native DestroyAllDynamicRaceCPs();
  269. native CountDynamicRaceCPs();
  270. native DestroyAllDynamicMapIcons();
  271. native CountDynamicMapIcons();
  272. native DestroyAllDynamic3DTextLabels();
  273. native CountDynamic3DTextLabels();
  274. native DestroyAllDynamicAreas();
  275. native CountDynamicAreas();
  276.  
  277. // Callbacks
  278.  
  279. forward OnDynamicObjectMoved(objectid);
  280. forward OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);
  281. forward OnPlayerSelectDynamicObject(playerid, objectid, modelid, Float:x, Float:y, Float:z);
  282. forward OnPlayerShootDynamicObject(playerid, weaponid, objectid, Float:x, Float:y, Float:z);
  283. forward OnPlayerPickUpDynamicPickup(playerid, pickupid);
  284. forward OnPlayerEnterDynamicCP(playerid, checkpointid);
  285. forward OnPlayerLeaveDynamicCP(playerid, checkpointid);
  286. forward OnPlayerEnterDynamicRaceCP(playerid, checkpointid);
  287. forward OnPlayerLeaveDynamicRaceCP(playerid, checkpointid);
  288. forward OnPlayerEnterDynamicArea(playerid, areaid);
  289. forward OnPlayerLeaveDynamicArea(playerid, areaid);
Add Comment
Please, Sign In to add comment