Guest User

Streamer2

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