Advertisement
Guest User

Explosive Bullets by GhOsT[X]

a guest
Apr 1st, 2010
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.95 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define distBullet 30
  4.  
  5. public OnFilterScriptInit()
  6. {
  7.     print("\n--------------------------------------");
  8.     print(" €xPLØsiv€ BÜLL€TTS B¥ GhØsT[×] Loaded");
  9.     print("--------------------------------------\n");
  10.     return 1;
  11. }
  12.  
  13. public OnFilterScriptExit()
  14. {
  15.     print("\n--------------------------------------");
  16.     print(" €xPLØsiv€ BÜLL€TTS B¥ GhØsT[×] Unloaded");
  17.     print("--------------------------------------\n");
  18.     return 1;
  19. }
  20.  
  21. public OnPlayerConnect(playerid)
  22. {
  23.     SetPVarInt(playerid,"shootingExplosive",0);
  24.     SetPVarInt(playerid,"exploBullet",0);
  25.     return 1;
  26. }
  27.  
  28. public OnPlayerDisconnect(playerid, reason)
  29. {
  30.     SetPVarInt(playerid,"shootingExplosive",0);
  31.     SetPVarInt(playerid,"exploBullet",0);
  32.     return 1;
  33. }
  34.  
  35. public OnPlayerSpawn(playerid)
  36. {
  37.     SetPVarInt(playerid,"shootingExplosive",0);
  38.     SetPVarInt(playerid,"exploBullet",0);
  39.     GivePlayerWeapon(playerid,30,999);
  40.     return 1;
  41. }
  42.  
  43. public OnPlayerDeath(playerid, killerid, reason)
  44. {
  45.     SetPVarInt(playerid,"shootingExplosive",0);
  46.     return 1;
  47. }
  48.  
  49. public OnVehicleSpawn(vehicleid)
  50. {
  51.     return 1;
  52. }
  53.  
  54. public OnVehicleDeath(vehicleid, killerid)
  55. {
  56.     return 1;
  57. }
  58.  
  59. public OnPlayerText(playerid, text[])
  60. {
  61.     return 1;
  62. }
  63.  
  64. public OnPlayerCommandText(playerid, cmdtext[])
  65. {
  66.     if (strcmp("/explobullet", cmdtext, true, 10) == 0)
  67.     {
  68.     if( GetPVarInt(playerid,"exploBullet") == 1)
  69.     {
  70.         SetPVarInt(playerid,"exploBullet",0);
  71.         SendClientMessage(playerid, 0x400080FF, "Munição Explosiva Desativada!");
  72.     }
  73.     else if( GetPVarInt(playerid,"exploBullet") == 0)
  74.     {
  75.         SetPVarInt(playerid,"exploBullet",1);
  76.         SendClientMessage(playerid, 0x400080FF, "Munição Explosiva Ativada!");
  77.     }
  78.     return 1;
  79.     }
  80.     return 0;
  81. }
  82.  
  83.  
  84. public OnPlayerUpdate(playerid)
  85. {
  86.     if( GetPVarInt(playerid,"shootingExplosive") == 1)
  87.     {
  88.     new Float:blahx, Float:blahy, Float:blahz, Float:angle;
  89.     GetPosFromView(playerid, distBullet, blahx, blahy, blahz);
  90.     GetPlayerFacingAngle(playerid, angle);
  91.     CreateExplosion(blahx, blahy, blahz, 0, 1.0);
  92.     SetPVarInt(playerid,"shootingExplosive",0);
  93.     }
  94.     return 1;
  95. }
  96.  
  97.  
  98. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  99. {
  100. if((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
  101. {
  102. if(GetPVarInt(playerid,"exploBullet") == 1)
  103. {
  104. if(GetPlayerWeapon(playerid) == 29 || GetPlayerWeapon(playerid) == 30 || GetPlayerWeapon(playerid) == 31)
  105. {
  106. if(GetPlayerWeaponState(playerid) != 3 && GetPlayerWeaponState(playerid) == 2)
  107. {
  108. //printf("%d",GetPlayerWeaponState(playerid)); Debugging Purposes
  109. CallLocalFunction("OnPlayerUpdate","d",playerid);
  110. SetPVarInt(playerid,"shootingExplosive",1);
  111. }
  112. }
  113. }
  114. }
  115. return 1;
  116. }
  117.  
  118. stock GetPosFromView(playerid, Float:distance, &Float:x, &Float:y, &Float:z)
  119. {
  120.     new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
  121.     GetPlayerCameraPos(playerid, cx, cy, cz);
  122.     GetPlayerCameraFrontVector(playerid, fx, fy, fz);
  123.     x = fx * distance + cx;
  124.     y = fy * distance + cy;
  125.     z = fz * distance + cz;
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement