Advertisement
Guest User

Wafffllesss

a guest
Feb 16th, 2010
2,854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.47 KB | None | 0 0
  1. #include <a_samp>
  2. #include <a_angles>
  3.  
  4. #define DeathMessage // Comment to remove death message.
  5.  
  6. forward NpcKiller(playerid,bool:KickAfter);
  7. forward Float:GetDistanceToPlayer(playerid,playerid2);
  8.  
  9. enum enum_pInfo{
  10. lastAmmo
  11. }
  12. new pFiringInfo[MAX_PLAYERS][enum_pInfo];
  13.  
  14. new Float:MyNpcHealth[MAX_PLAYERS]=100.0;
  15.  
  16. new WeaponDamage[] = {
  17. 6, // Unarmed
  18. 8, //Brass Knuckles
  19. 13, //Golf Club
  20. 13, //Nite Stick
  21. 14, //Knife
  22. 12, //Baseball Bat
  23. 11, //Shovel
  24. 11, //Pool Cue
  25. 18, //Katana
  26. 26, //ChainSaw
  27. -5, //Purple Dildo
  28. -5, //Small White Vibrator
  29. -5, //Large White Vibrator
  30. -5, //Silver Vibrator
  31. -100, //Flowers
  32. 10, //Cane
  33. 20, //Grenade (Dano Baixo pq n funciona direito.)
  34. 2, //Teargas
  35. 20, //Molotov (Dano Baixo pq n funciona direito.)
  36. 0, // null
  37. 0, // null
  38. 0, // null
  39. 20, // 9mm
  40. 20, //Silenced 9mm
  41. 25, //Desert Eagle
  42. 32, //Shotgun
  43. 38, //Sawn-off Shotgun
  44. 30, //Combat Shotgun
  45. 18, //Micro SMG
  46. 24, //SMG
  47. 31, //AK47
  48. 28, //M4
  49. 16, //Tec 9
  50. 55, //Country Rifle
  51. 95, //Sniper Rifle
  52. 80, //Rocket Launcher
  53. 80, //Heat Seeker
  54. 75, //Flamethrower
  55. 65, //Minigun
  56. 0,
  57. 0,
  58. 0,
  59. 0,
  60. 0,
  61. 0,
  62. 0
  63. };
  64. new Float:WeaponRanges[] = {
  65. 1.0, // Unarmed
  66. 1.0, //Brass Knuckles
  67. 1.2, //Golf Club
  68. 1.2, //Nite Stick
  69. 1.1, //Knife
  70. 1.2, //Baseball Bat
  71. 1.2, //Shovel
  72. 1.3, //Pool Cue
  73. 1.2, //Katana
  74. 1.3, //ChainSaw
  75. 0.5, //Purple Dildo
  76. 0.5, //Small White Vibrator
  77. 0.5, //Large White Vibrator
  78. 0.5, //Silver Vibrator
  79. 0.5, //Flowers
  80. 1.4, //Cane
  81. 22.0, //Grenade (Dano Baixo pq n funciona direito.)
  82. 22.0, //Teargas
  83. 22.0, //Molotov (Dano Baixo pq n funciona direito.)
  84. 0.0, // null
  85. 0.0, // null
  86. 0.0, // null
  87. 38.0, // 9mm
  88. 39.0, //Silenced 9mm
  89. 40.0, //Desert Eagle
  90. 36.0, //Shotgun
  91. 35.0, //Sawn-off Shotgun
  92. 37.0, //Combat Shotgun
  93. 38.0, //Micro SMG
  94. 41.0, //SMG
  95. 45.0, //AK47
  96. 55.0, //M4
  97. 36.0, //Tec 9
  98. 78.0, //Country Rifle
  99. 95.0, //Sniper Rifle
  100. 40.0, //Rocket Launcher
  101. 40.0, //Heat Seeker
  102. 23.0, //Flamethrower
  103. 47.0, //Minigun
  104. 0.0,
  105. 0.0,
  106. 0.0,
  107. 0.0,
  108. 0.0,
  109. 0.0,
  110. 0.0
  111. };
  112. new Float:WeaponPrecision[] = {
  113. 2.0, // Unarmed
  114. 2.0, //Brass Knuckles
  115. 2.2, //Golf Club
  116. 2.2, //Nite Stick
  117. 2.1, //Knife
  118. 2.2, //Baseball Bat
  119. 2.2, //Shovel
  120. 2.3, //Pool Cue
  121. 2.2, //Katana
  122. 2.0, //ChainSaw
  123. 1.5, //Purple Dildo
  124. 1.5, //Small White Vibrator
  125. 1.5, //Large White Vibrator
  126. 1.5, //Silver Vibrator
  127. 1.5, //Flowers
  128. 2.0, //Cane
  129. 5.0, //Grenade (Dano Baixo pq n funciona direito.)
  130. 5.0, //Teargas
  131. 5.0, //Molotov (Dano Baixo pq n funciona direito.)
  132. 0.0, // null
  133. 0.0, // null
  134. 0.0, // null
  135. 5.0, // 9mm
  136. 4.5, //Silenced 9mm
  137. 5.0, //Desert Eagle
  138. 8.0, //Shotgun
  139. 10.0, //Sawn-off Shotgun
  140. 9.0, //Combat Shotgun
  141. 7.0, //Micro SMG
  142. 4.0, //SMG
  143. 6.0, //AK47
  144. 3.0, //M4
  145. 8.0, //Tec 9
  146. 2.0, //Country Rifle
  147. 1.0, //Sniper Rifle
  148. 3.0, //Rocket Launcher
  149. 3.0, //Heat Seeker
  150. 10.0, //Flamethrower
  151. 8.0, //Minigun
  152. 0.0,
  153. 0.0,
  154. 0.0,
  155. 0.0,
  156. 0.0,
  157. 0.0,
  158. 0.0
  159. };
  160.  
  161. public OnFilterScriptInit()
  162. {
  163. for(new i =0;i<MAX_PLAYERS;i++){
  164. if(IsPlayerNPC(i)){
  165. MyNpcHealth[i] = 100.0;
  166. }
  167. }
  168. print("\n--------------------------------------");
  169. print(" Kill NPCS by Wafffllesss");
  170. print("--------------------------------------\n");
  171. return 1;
  172. }
  173.  
  174. public OnFilterScriptExit()
  175. {
  176. return 1;
  177. }
  178. public OnPlayerSpawn(playerid){
  179. if(IsPlayerNPC(playerid)){
  180. MyNpcHealth[playerid] = 100.0;
  181. }
  182. }
  183. stock NoAmmo(weaponid){
  184. switch(weaponid){
  185. case 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14: return true;
  186. }
  187. return false;
  188. }
  189. public OnPlayerUpdate(playerid){
  190. if(!IsPlayerNPC(playerid)){
  191. new key_lr,key_ud,key_sp;
  192. GetPlayerKeys(playerid,key_sp,key_ud,key_lr);
  193. if( (key_sp == KEY_FIRE || key_sp == (KEY_FIRE+128)) && (GetPlayerAmmo(playerid) < pFiringInfo[playerid][lastAmmo] || NoAmmo(GetPlayerWeapon(playerid))) ){
  194. OnPlayerShootNpc(playerid);
  195. }
  196. pFiringInfo[playerid][lastAmmo] = GetPlayerAmmo(playerid);
  197. }
  198. return true;
  199. }
  200. stock Float:GetDistanceToPlayer(playerid,playerid2) {
  201. new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
  202. if (!IsPlayerConnected(playerid) || !IsPlayerConnected(playerid2)) {
  203. return -1.00;
  204. }
  205. GetPlayerPos(playerid,x1,y1,z1);
  206. GetPlayerPos(playerid2,x2,y2,z2);
  207. return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
  208. }
  209.  
  210. stock OnPlayerShootNpc(playerid){
  211. new Float:x,Float:y,Float:z,Float:ax,Float:ay,Float:az;
  212. new wp = GetPlayerWeapon(playerid);
  213. new Damage = WeaponDamage[wp];
  214. GetPlayerPos(playerid,x,y,z);
  215. for(new i=0;i<MAX_PLAYERS;i++){
  216. if(IsPlayerNPC(i)){
  217. GetPlayerPos(i,ax,ay,az);
  218. printf("Good? [ %b ]",(IsPlayerFacingPlayer(playerid,i,WeaponPrecision[wp]) && z >= (az-10.0) && z <= (az+10.0) && GetDistanceToPlayer(playerid,i) <= WeaponRanges[wp]) );
  219. if(IsPlayerFacingPlayer(playerid,i,WeaponPrecision[wp]) && z >= (az-10.0) && z <= (az+10.0) && GetDistanceToPlayer(playerid,i) <= WeaponRanges[wp]){
  220. MyNpcHealth[i] -= float(Damage);
  221. if(MyNpcHealth[i] <= 0.0){
  222. KillNpc(i,true);
  223. OnPlayerDeath(i, playerid, GetPlayerWeapon(playerid));
  224. }
  225. }
  226. }
  227. }
  228. }
  229. stock KillNpc(playerid,bool:KickAfter){
  230. TogglePlayerControllable(playerid,false);
  231. ApplyAnimation(playerid,"Knife","KILL_Knife_Ped_Die",1,0,1,0,0,0);
  232. SetTimerEx("NpcKiller",1400,0,"ib",playerid,KickAfter);
  233. }
  234. public NpcKiller(playerid,bool:KickAfter){
  235. if(KickAfter){
  236. Kick(playerid);
  237. }else{
  238. TogglePlayerControllable(playerid,true);
  239. SetPlayerHealth(playerid,0.0);
  240. }
  241. }
  242.  
  243. public OnPlayerDisconnect(playerid, reason)
  244. {
  245. return 1;
  246. }
  247.  
  248. public OnPlayerDeath(playerid, killerid, reason)
  249. {
  250. if(IsPlayerNPC(playerid)){
  251. #if defined DeathMessage
  252. if(killerid != 255){
  253. SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
  254. }else{
  255. SendDeathMessage(killerid,playerid,reason);
  256. }
  257. #endif
  258. }
  259. return 1;
  260. }
  261.  
  262. public OnVehicleSpawn(vehicleid)
  263. {
  264. return 1;
  265. }
  266.  
  267. public OnVehicleDeath(vehicleid, killerid)
  268. {
  269. return 1;
  270. }
  271.  
  272. public OnPlayerText(playerid, text[])
  273. {
  274. return 1;
  275. }
  276.  
  277. public OnPlayerCommandText(playerid, cmdtext[])
  278. {
  279. return 0;
  280. }
  281.  
  282. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  283. {
  284. return 1;
  285. }
  286.  
  287. public OnPlayerExitVehicle(playerid, vehicleid)
  288. {
  289. return 1;
  290. }
  291.  
  292. public OnPlayerStateChange(playerid, newstate, oldstate)
  293. {
  294. return 1;
  295. }
  296.  
  297. public OnPlayerEnterCheckpoint(playerid)
  298. {
  299. return 1;
  300. }
  301.  
  302. public OnPlayerLeaveCheckpoint(playerid)
  303. {
  304. return 1;
  305. }
  306.  
  307. public OnPlayerEnterRaceCheckpoint(playerid)
  308. {
  309. return 1;
  310. }
  311.  
  312. public OnPlayerLeaveRaceCheckpoint(playerid)
  313. {
  314. return 1;
  315. }
  316.  
  317. public OnRconCommand(cmd[])
  318. {
  319. return 1;
  320. }
  321.  
  322. public OnPlayerRequestSpawn(playerid)
  323. {
  324. return 1;
  325. }
  326.  
  327. public OnObjectMoved(objectid)
  328. {
  329. return 1;
  330. }
  331.  
  332. public OnPlayerObjectMoved(playerid, objectid)
  333. {
  334. return 1;
  335. }
  336.  
  337. public OnPlayerPickUpPickup(playerid, pickupid)
  338. {
  339. return 1;
  340. }
  341.  
  342. public OnVehicleMod(playerid, vehicleid, componentid)
  343. {
  344. return 1;
  345. }
  346.  
  347. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  348. {
  349. return 1;
  350. }
  351.  
  352. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  353. {
  354. return 1;
  355. }
  356.  
  357. public OnPlayerSelectedMenuRow(playerid, row)
  358. {
  359. return 1;
  360. }
  361.  
  362. public OnPlayerExitedMenu(playerid)
  363. {
  364. return 1;
  365. }
  366.  
  367. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  368. {
  369. return 1;
  370. }
  371.  
  372. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  373. {
  374. return 1;
  375. }
  376.  
  377. public OnRconLoginAttempt(ip[], password[], success)
  378. {
  379. return 1;
  380. }
  381.  
  382. public OnPlayerStreamIn(playerid, forplayerid)
  383. {
  384. return 1;
  385. }
  386.  
  387. public OnPlayerStreamOut(playerid, forplayerid)
  388. {
  389. return 1;
  390. }
  391.  
  392. public OnVehicleStreamIn(vehicleid, forplayerid)
  393. {
  394. return 1;
  395. }
  396.  
  397. public OnVehicleStreamOut(vehicleid, forplayerid)
  398. {
  399. return 1;
  400. }
  401.  
  402. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  403. {
  404. return 1;
  405. }
  406.  
  407. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  408. {
  409. return 1;
  410. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement