Guest User

Untitled

a guest
Jun 22nd, 2011
482
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*******************************************************************************
  2. * *
  3. * Laser Weapon v0.1 FilterScript *
  4. * Crediti: Angelo *
  5. * Non Rimuvere i crediti! *
  6. * *
  7. ******************************************************************************/
  8.  
  9. #include <a_samp>
  10.  
  11. //Dialoghi
  12.  
  13. #define DialogoLaser 1111
  14.  
  15. //Variabili
  16.  
  17. enum pWeaponLaser
  18. {
  19. Object,
  20. Type,
  21. bool:Attached,
  22. }
  23. new
  24. pLaser[MAX_PLAYERS][pWeaponLaser];
  25.  
  26. //Funzioni
  27.  
  28. stock bool:isInvalidLaserWeapon(weaponid)
  29. {
  30. switch(weaponid)
  31. {
  32. case 0..22, 26, 28, 32, 35..54:
  33. return true;
  34. }
  35. return false;
  36. }
  37.  
  38. //CallBacks
  39.  
  40. public OnFilterScriptInit()
  41. {
  42. print(" ");
  43. print(" pWeaponLaser v0.1 by Angelo Loaded.");
  44. print(" ");
  45. return 1;
  46. }
  47.  
  48. public OnFilterScriptExit()
  49. {
  50. print(" ");
  51. print(" pWeaponLaser v0.1 by Angelo UnLoaded.");
  52. print(" ");
  53. return 1;
  54. }
  55.  
  56. public OnPlayerCommandText(playerid, cmdtext[])
  57. {
  58. if(!strcmp(cmdtext, "/Laser", true))
  59. {
  60. if(isInvalidLaserWeapon(GetPlayerWeapon(playerid))) return SendClientMessage(playerid, -1, "{FF0000}Errore: {FFFFFF}Hai già il laser sulla tua arma, per toglierlo digita {FF0000}/LaserOff");
  61. if(!pLaser[playerid][Attached]) return ShowPlayerDialog(playerid, DialogoLaser, DIALOG_STYLE_LIST, "Tipo Di Laser", "{FF0000}Laser Rosso\n{0000FF}Laser Blu\n{FFA9FF}Laser Rosa\n{FF9A00}Laser Arancio\n{00FF00}Laser Verde\n{FFFF00}Laser Giallo", "Accetta", "Cancella");
  62. SendClientMessage(playerid, -1, "{FF0000}Errore: {FFFFFF}Hai già il laser sulla tua arma, per toglierlo digita {FF0000}/LaserOff");
  63. return 1;
  64. }
  65.  
  66. if(!strcmp(cmdtext, "/LaserOff", true))
  67. {
  68. if(pLaser[playerid][Attached])
  69. {
  70. RemovePlayerAttachedObject(playerid, 1);
  71. pLaser[playerid][Attached] = false;
  72. DestroyObject(pLaser[playerid][Object]);
  73. return 1;
  74. }
  75. SendClientMessage(playerid, -1, "{FF0000}Errore: Non hai il laser sulla tua arma, per averlo digita {FF0000}/Laser");
  76. return 1;
  77. }
  78. return 0;
  79. }
  80.  
  81. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  82. {
  83. switch(dialogid)
  84. {
  85. case DialogoLaser:
  86. {
  87. if(response)
  88. {
  89. switch(listitem)
  90. {
  91. case 0: pLaser[playerid][Type] = 18643;
  92. case 1: pLaser[playerid][Type] = 19080;
  93. case 2: pLaser[playerid][Type] = 19081;
  94. case 3: pLaser[playerid][Type] = 19082;
  95. case 4: pLaser[playerid][Type] = 19083;
  96. case 5: pLaser[playerid][Type] = 19084;
  97. }
  98. pLaser[playerid][Object] = CreateObject(pLaser[playerid][Type], 0, 0, 0, 0, 0, 0, 50.0);
  99. SetPlayerAttachedObject(playerid, 1, pLaser[playerid][Type], 6);
  100. pLaser[playerid][Attached] = true;
  101. }
  102. }
  103. }
  104. return 1;
  105. }
  106.  
  107. public OnPlayerUpdate(playerid)
  108. {
  109. if(pLaser[playerid][Attached])
  110. {
  111. switch(GetPlayerWeapon(playerid))
  112. {
  113.  
  114. case 23: SetPlayerAttachedObject(playerid, 1, pLaser[playerid][Type], 6, 0.078, 0.027, 0.113, -11.132, 350.602, 362.384, 1, 1, 1);
  115. case 24: SetPlayerAttachedObject(playerid, 1, pLaser[playerid][Type], 6, 0.12, 0.02, 0.12, 1.0, 1.0, 358.0, 1, 1, 1);
  116. case 25: SetPlayerAttachedObject(playerid, 1, pLaser[playerid][Type], 6, 0.18, 0.019, 0.139, 1.0, -8.8, -6.0, 1, 1, 1);
  117. case 27: SetPlayerAttachedObject(playerid, 1, pLaser[playerid][Type], 6, 0.2, 0.025, 0.19, 1.0, -8.7, -6.1, 1, 1, 1);
  118. case 29: SetPlayerAttachedObject(playerid, 1, pLaser[playerid][Type], 6, 0.06, 0.022, 0.196, 1.0, -8.0, -6.0, 1, 1, 1);
  119. case 30: SetPlayerAttachedObject(playerid, 1, pLaser[playerid][Type], 6, 0.1, 0.015, 0.147, 1.0, -1.7, -5.0, 1, 1, 1);
  120. case 31: SetPlayerAttachedObject(playerid, 1, pLaser[playerid][Type], 6, 0.13, 0.013, 0.13, 1.0, -1.7, -5.0, 1, 1, 1);
  121. case 33: SetPlayerAttachedObject(playerid, 1, pLaser[playerid][Type], 6, 0.13, 0.013, 0.12, 1.0, -8.3, -5.5, 1, 1, 1);
  122. case 34: SetPlayerAttachedObject(playerid, 1, pLaser[playerid][Type], 6, 0.07, 0.03, 0.116, 1.0, -6.0, -5.5, 1, 1, 1);
  123. default:
  124. {
  125. RemovePlayerAttachedObject(playerid, 1);
  126. SetObjectPos(pLaser[playerid][Object], 0.0, 0.0, 0.0);
  127. }
  128. }
  129. }
  130. return 1;
  131. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×