1
0

cnpc.inc 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. * Created: 09.03.10
  3. * Author: 009
  4. * Last Modifed: 29.08.10
  5. * Description: íàòèâû óïðàâëåíèÿ NPC
  6. */
  7. #if defined _cnpc_included
  8. #endinput
  9. #endif
  10. #define _cnpc_included
  11. #pragma library cnpc
  12. //
  13. // Defines
  14. //
  15. #define MAX_NPCS 500
  16. #define MAX_NODES 100
  17. #define NPC_STATE_REQUEST_CLASS 0
  18. #define NPC_STATE_ONFOOT 1
  19. #define NPC_STATE_DRIVER 2
  20. #define NPC_STATE_PASSANGER 3
  21. #define NPC_STATE_DEATH 4
  22. #define NPC_STATE_PLAYBACK 5
  23. #define PLAYER_RECORDING_TYPE_NONE 0
  24. #define PLAYER_RECORDING_TYPE_DRIVER 1
  25. #define PLAYER_RECORDING_TYPE_ONFOOT 2
  26. #define NPC_RECORD_END_REASON_END 1
  27. #define NPC_RECORD_END_REASON_DEATH 2
  28. #define NPC_RECORD_END_REASON_STOP 3
  29. #define NPC_RECORD_END_REASON_DESTROY 4
  30. //
  31. // Natives
  32. //
  33. // core
  34. native CreateNPC(npcid,npcname[]);
  35. native CreateNPCPlayer(id,name[]);
  36. native IsValidNPC(npcid);
  37. native DestroyNPC(npcid);
  38. native KillNPC(npcid);
  39. native SpawnNPC(npcid);
  40. native PutNPCInVehicle(npcid,vehicleid,seat);
  41. native StopNPC(npcid);
  42. native SetNPCImpregnable(npcid,istate);
  43. native IsNPCImpregnable(npcid);
  44. native GetNPCState(npcid);
  45. native ToogleVisualDeath(tstate);
  46. native DisableJoinPartLogging();
  47. native FindLastFreeSlot();
  48. // on foot controlls
  49. native SetNPCPos(npcid,Float:X,Float:Y,Float:Z);
  50. native GetNPCPos(npcid,&Float:X,&Float:Y,&Float:Z);
  51. native SetNPCFacingAngle(npcid,Float:angle);
  52. native Float:GetNPCFacingAngle(npcid);
  53. native SetNPCVelocity(npcid,Float:X,Float:Y,Float:Z);
  54. native GetNPCVelocity(npcid,&Float:X,&Float:Y,&Float:Z);
  55. native SetNPCKeys(npcid,updown,leftright,keys);
  56. native GetNPCKeys(npcid,&updown,&leftright,&keys);
  57. native SetNPCSkin(npcid,skin);
  58. native GetNPCSkin(npcid);
  59. native SetNPCInterior(npcid,interior);
  60. native GetNPCInterior(npcid);
  61. native SetNPCSpecialAction(npcid,action);
  62. native GetNPCSpecialAction(npcid);
  63. native SetNPCWeapon(npcid,weaponid);
  64. native GetNPCWeapon(npcid);
  65. native SetNPCWeaponSkillLevel(npcid,weapontype,level);
  66. native GetNPCWeaponSkillLevel(npcid,weapontype);
  67. native SetNPCHealth(npcid,Float:amount);
  68. native Float:GetNPCHealth(npcid);
  69. native SetNPCArmour(npcid,Float:amount);
  70. native Float:GetNPCArmour(npcid);
  71. native SetNPCSurfing(npcid,Float:X,Float:Y,Float:Z);
  72. native GetNPCSurfing(npcid,&Float:X,&Float:Y,&Float:Z);
  73. native SetNPCSurfingVehicle(npcid,vehicleid);
  74. native GetNPCSurfingVehicle(npcid);
  75. // aim controls
  76. native SetNPCCameraPos(npcid,Float:X,Float:Y,Float:Z);
  77. native GetNPCCameraPos(npcid,&Float:X,&Float:Y,&Float:Z);
  78. native SetNPCCameraFrontVector(npcid,Float:X,Float:Y,Float:Z);
  79. native GetNPCCameraFrontVector(npcid,&Float:X,&Float:Y,&Float:Z);
  80. native SetNPCCameraMode(npcid,mode);
  81. native GetNPCCameraMode(npcid);
  82. native SetNPCWeaponState(npcid,wstate);
  83. native GetNPCWeaponState(npcid);
  84. // driver controls
  85. native SetNPCVehiclePos(npcid,Float:X,Float:Y,Float:Z);
  86. native GetNPCVehiclePos(npcid,&Float:X,&Float:Y,&Float:Z);
  87. native SetNPCVehicleQuaternion(npcid,Float:X,Float:Y,Float:Z,Float:Scal);
  88. native GetNPCVehicleQuaternion(npcid,&Float:X,&Float:Y,&Float:Z,&Float:Scal);
  89. native SetNPCVehicleVelocity(npcid,Float:X,Float:Y,Float:Z);
  90. native GetNPCVehicleVelocity(npcid,&Float:X,&Float:Y,&Float:Z);
  91. native SetNPCVehicleKeys(npcid,updown,leftright,keys);
  92. native GetNPCVehicleKeys(npcid,&updown,&leftright,&keys);
  93. native SetNPCVehicleSiren(npcid,vstate);
  94. native GetNPCVehicleSiren(npcid);
  95. native SetNPCVehicleWeapon(npcid,weaponid);
  96. native GetNPCVehicleWeapon(npcid);
  97. // standart actions
  98. native NPC_WalkTo(npcid,Float:X,Float:Y,Float:Z,is_z_map);
  99. native NPC_RunTo(npcid,Float:X,Float:Y,Float:Z,is_z_map);
  100. native NPC_SprintTo(npcid,Float:X,Float:Y,Float:Z,is_z_map);
  101. native NPC_LookAt(npcid,Float:X,Float:Y,Float:Z);
  102. native NPC_AimAt(npcid,Float:X,Float:Y,Float:Z);
  103. native NPC_ShotAt(npcid,Float:X,Float:Y,Float:Z);
  104. native NPC_DriveTo(npcid,Float:X,Float:Y,Float:Z,Float:speed,is_z_map);
  105. // damage config
  106. native SetWeaponDamageForNPC(weaponid,Float:damage);
  107. native SetWeaponReloadTimeForNPC(weaponid,mstime);
  108. // .rec playbacks
  109. native StartRecordingPlayback(npcid,name[]);
  110. native PauseRecordingPlayback(npcid);
  111. native ContinueRecordingPlayback(npcid);
  112. native StopRecordingPlayback(npcid);
  113. // GTA SA paths
  114. native Node:OpenNode(name[]);
  115. native CloseNode(Node:nodeid);
  116. native GetNodeHeader(Node:nodeid,&nodes,&vehicle_nodes,&ped_nodes,&navi_nodes);
  117. native SetNodePoint(Node:nodeid,pointid);
  118. native GetNodePoint(Node:nodeid);
  119. native GetNodePointPos(Node:nodeid,&Float:X,&Float:Y,&Float:Z);
  120. native GetNodePointLinkId(Node:nodeid);
  121. native GetNodePointAreaId(Node:nodeid);
  122. native GetNodePointWidth(Node:nodeid);
  123. native GetNodePointLinkCount(Node:pointid);
  124. native GetNodePointTrafficLevel(Node:nodeid);
  125. native IsNodePointRoadBlock(Node:nodeid);
  126. native IsNodePointBoats(Node:nodeid);
  127. native IsNodePointEmergency(Node:nodeid);
  128. native IsNodePointNotHighway(Node:nodeid);
  129. native IsNodePointSpawn(Node:nodeid);
  130. native IsNodePointRoadBlock1(Node:nodeid);
  131. native IsNodePointParking(Node:nodeid);
  132. native IsNodePointRoadBlock2(Node:nodeid);
  133. native GetNodePointType(Node:nodeid);
  134. native SetNodeLink(Node:nodeid,linkid);
  135. native GetNodeLinkAreaId(Node:nodeid);
  136. native GetNodeLinkNodeId(Node:nodeid);
  137. // ZMap
  138. native ZMap_Init(mapname[]);
  139. native Float:ZMap_GetZForCoords(Float:X,Float:Y);
  140. // Rolls
  141. native Float:ConvertRollToGrad(Float:roll);
  142. native Float:ConvertGradToRoll(Float:grad);
  143. // CPlayer structure
  144. native GetPlayerStructureInfoByte(playerid,structure_offset);
  145. native GetPlayerStructureInfoInt(playerid,structure_offset);
  146. native Float:GetPlayerStructureInfoFloat(playerid,structure_offset);
  147. // CVehicle structure
  148. native GetVehicleStructureInfoByte(vehicleid,structure_offset);
  149. native GetVehicleStructureInfoInt(vehicleid,structure_offset);
  150. native Float:GetVehicleStructureInfoFloat(vehicleid,structure_offset);
  151. // Foot sync
  152. native GetFootSyncDataByte(playerid,offset);
  153. native GetFootSyncDataInt(playerid,offset);
  154. native Float:GetFootSyncDataFloat(playerid,offset);
  155. //
  156. // Callbacks
  157. //
  158. forward OnNPCGetDamage(npcid,playerid,Float:health_loss,bodypart);
  159. forward OnRecordingPlaybackEnd(npcid,reason);
  160. forward OnNPCMovingComplete(npcid);
  161. forward OnNPCSpawn(npcid);
  162. forward OnNPCDeath(npcid,killerid,reason);