SAMP Gitlab CI Test
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

189 lines
5.7 KiB

5 years ago
  1. /* SA-MP NPC Functions
  2. *
  3. * (c) Copyright 2009, SA-MP Team
  4. *
  5. */
  6. #if defined _samp_included
  7. #endinput
  8. #endif
  9. #define _samp_included
  10. #pragma library samp
  11. #pragma tabsize 4
  12. #include <core>
  13. #include <float>
  14. #include <string>
  15. #include <file>
  16. #include <time>
  17. #include <datagram>
  18. // --------------------------------------------------
  19. // Natives
  20. // --------------------------------------------------
  21. // Util
  22. native print(const string[]);
  23. native printf(const format[], {Float,_}:...);
  24. native format(output[], len, const format[], {Float,_}:...);
  25. native SetTimer(funcname[], interval, repeating);
  26. native KillTimer(timerid);
  27. native GetTickCount();
  28. native Float:asin(Float:value);
  29. native Float:acos(Float:value);
  30. native Float:atan(Float:value);
  31. native Float:atan2(Float:x, Float:y);
  32. native SendChat(msg[]);
  33. native SendCommand(commandtext[]);
  34. native GetPlayerState(playerid);
  35. native GetPlayerPos(playerid, &Float:x, &Float:y, &Float:z);
  36. native GetPlayerVehicleID(playerid);
  37. native GetPlayerArmedWeapon(playerid);
  38. native GetPlayerHealth(playerid);
  39. native GetPlayerArmour(playerid);
  40. native GetPlayerSpecialAction(playerid);
  41. native IsPlayerStreamedIn(playerid);
  42. native IsVehicleStreamedIn(vehicleid);
  43. native GetPlayerKeys(playerid, &keys, &updown, &leftright);
  44. native GetPlayerFacingAngle(playerid, &Float:ang);
  45. native GetMyPos(&Float:x, &Float:y, &Float:z);
  46. native SetMyPos(Float:x, Float:y, Float:z);
  47. native GetMyFacingAngle(&Float:ang);
  48. native SetMyFacingAngle(Float:ang);
  49. native GetDistanceFromMeToPoint(Float:X, Float:Y, Float:Z, &Float:Distance);
  50. native IsPlayerInRangeOfPoint(playerid, Float:range, Float:X, Float:Y, Float:Z);
  51. native GetPlayerName(playerid, const name[], len);
  52. native IsPlayerConnected(playerid);
  53. #define PLAYER_RECORDING_TYPE_NONE 0
  54. #define PLAYER_RECORDING_TYPE_DRIVER 1
  55. #define PLAYER_RECORDING_TYPE_ONFOOT 2
  56. native StartRecordingPlayback(playbacktype, recordname[]);
  57. native StopRecordingPlayback();
  58. native PauseRecordingPlayback();
  59. native ResumeRecordingPlayback();
  60. // --------------------------------------------------
  61. // Defines
  62. // --------------------------------------------------
  63. // States
  64. #define PLAYER_STATE_NONE (0)
  65. #define PLAYER_STATE_ONFOOT (1)
  66. #define PLAYER_STATE_DRIVER (2)
  67. #define PLAYER_STATE_PASSENGER (3)
  68. #define PLAYER_STATE_WASTED (7)
  69. #define PLAYER_STATE_SPAWNED (8)
  70. #define PLAYER_STATE_SPECTATING (9)
  71. // Misc
  72. #define MAX_PLAYER_NAME (24)
  73. #define MAX_PLAYERS (500)
  74. #define MAX_VEHICLES (2000)
  75. #define INVALID_PLAYER_ID (0xFFFF)
  76. #define INVALID_VEHICLE_ID (0xFFFF)
  77. #define NO_TEAM (255)
  78. #define MAX_OBJECTS (150)
  79. #define INVALID_OBJECT_ID (255)
  80. #define MAX_GANG_ZONES (1024)
  81. #define MAX_TEXT_DRAWS (1024)
  82. #define MAX_MENUS (128)
  83. #define INVALID_MENU (0xFF)
  84. #define INVALID_TEXT_DRAW (0xFFFF)
  85. #define INVALID_GANG_ZONE (-1)
  86. // Weapons
  87. #define WEAPON_BRASSKNUCKLE (1)
  88. #define WEAPON_GOLFCLUB (2)
  89. #define WEAPON_NITESTICK (3)
  90. #define WEAPON_KNIFE (4)
  91. #define WEAPON_BAT (5)
  92. #define WEAPON_SHOVEL (6)
  93. #define WEAPON_POOLSTICK (7)
  94. #define WEAPON_KATANA (8)
  95. #define WEAPON_CHAINSAW (9)
  96. #define WEAPON_DILDO (10)
  97. #define WEAPON_DILDO2 (11)
  98. #define WEAPON_VIBRATOR (12)
  99. #define WEAPON_VIBRATOR2 (13)
  100. #define WEAPON_FLOWER (14)
  101. #define WEAPON_CANE (15)
  102. #define WEAPON_GRENADE (16)
  103. #define WEAPON_TEARGAS (17)
  104. #define WEAPON_MOLTOV (18)
  105. #define WEAPON_COLT45 (22)
  106. #define WEAPON_SILENCED (23)
  107. #define WEAPON_DEAGLE (24)
  108. #define WEAPON_SHOTGUN (25)
  109. #define WEAPON_SAWEDOFF (26)
  110. #define WEAPON_SHOTGSPA (27)
  111. #define WEAPON_UZI (28)
  112. #define WEAPON_MP5 (29)
  113. #define WEAPON_AK47 (30)
  114. #define WEAPON_M4 (31)
  115. #define WEAPON_TEC9 (32)
  116. #define WEAPON_RIFLE (33)
  117. #define WEAPON_SNIPER (34)
  118. #define WEAPON_ROCKETLAUNCHER (35)
  119. #define WEAPON_HEATSEEKER (36)
  120. #define WEAPON_FLAMETHROWER (37)
  121. #define WEAPON_MINIGUN (38)
  122. #define WEAPON_SATCHEL (39)
  123. #define WEAPON_BOMB (40)
  124. #define WEAPON_SPRAYCAN (41)
  125. #define WEAPON_FIREEXTINGUISHER (42)
  126. #define WEAPON_CAMERA (43)
  127. #define WEAPON_PARACHUTE (46)
  128. #define WEAPON_VEHICLE (49)
  129. #define WEAPON_DROWN (53)
  130. #define WEAPON_COLLISION (54)
  131. // Keys
  132. #define KEY_ACTION (1)
  133. #define KEY_CROUCH (2)
  134. #define KEY_FIRE (4)
  135. #define KEY_SPRINT (8)
  136. #define KEY_SECONDARY_ATTACK (16)
  137. #define KEY_JUMP (32)
  138. #define KEY_LOOK_RIGHT (64)
  139. #define KEY_HANDBRAKE (128)
  140. #define KEY_LOOK_LEFT (256)
  141. #define KEY_SUBMISSION (512)
  142. #define KEY_LOOK_BEHIND (512)
  143. #define KEY_WALK (1024)
  144. #define KEY_ANALOG_UP (2048)
  145. #define KEY_ANALOG_DOWN (4096)
  146. #define KEY_ANALOG_RIGHT (16384)
  147. #define KEY_ANALOG_LEFT (8192)
  148. #define KEY_UP (-128)
  149. #define KEY_DOWN (128)
  150. #define KEY_LEFT (-128)
  151. #define KEY_RIGHT (128)
  152. // --------------------------------------------------
  153. // Forwards (Callback declarations)
  154. // --------------------------------------------------
  155. forward OnNPCModeInit();
  156. forward OnNPCModeExit();
  157. forward OnNPCConnect(myplayerid);
  158. forward OnNPCDisconnect(reason[]);
  159. forward OnNPCSpawn();
  160. forward OnNPCEnterVehicle(vehicleid, seatid);
  161. forward OnNPCExitVehicle();
  162. forward OnClientMessage(color, text[]);
  163. forward OnPlayerDeath(playerid);
  164. forward OnPlayerText(playerid, text[]);
  165. forward OnPlayerStreamIn(playerid);
  166. forward OnPlayerStreamOut(playerid);
  167. forward OnVehicleStreamIn(vehicleid);
  168. forward OnVehicleStreamOut(vehicleid);
  169. forward OnRecordingPlaybackEnd();
  170. // --------------------------------------------------