Advertisement
Guest User

a_npc

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