Advertisement
UserUnkn0wn

FS Laser com Cores | Editado

May 24th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.53 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. #define DIALOG_CORES_LASER 10000 // DIALOG DO CMD:CoresLaser
  5.  
  6. #define LASER_VERMELHO 18643 // COR VERMELHA
  7. #define LASER_AZUL 19080 // COR AZUL
  8. #define LASER_VERDE 19083 // COR VERDE
  9. #define LASER_ROSA 19081 // COR ROSA
  10. #define LASER_LARANJA 19082 //COR LARANJA
  11. #define LASER_AMARELO 19084 // COR AMARELO
  12.  
  13. public OnFilterScriptInit() {
  14. // print("\n-- Laser Pointer by Skiaffo --\n");
  15. new p = GetMaxPlayers();
  16. for (new i=0; i < p; i++) {
  17. SetPVarInt(i, "laser", 0);
  18. SetPVarInt(i, "color", LASER_VERMELHO); //COR PADRÃO: VERMELHA.
  19. }
  20. return 1;
  21. }
  22.  
  23. public OnFilterScriptExit() {
  24. new p = GetMaxPlayers();
  25. for (new i=0; i < p; i++) {
  26. SetPVarInt(i, "laser", 0);
  27. RemovePlayerAttachedObject(i, 0);
  28. }
  29. return 1;
  30. }
  31. public OnPlayerSpawn(playerid) {
  32. if (!GetPVarInt(playerid, "color")) SetPVarInt(playerid, "color", 18643);
  33. }
  34. public OnPlayerDisconnect(playerid) {
  35. SetPVarInt(playerid, "laser", 0);
  36. RemovePlayerAttachedObject(playerid, 0);
  37. return 1;
  38. }
  39. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  40. {
  41. if(dialogid == DIALOG_CORES_LASER){
  42. if(response){
  43. switch(listitem){
  44. case 0:{
  45. SetPVarInt(playerid, "color", LASER_VERMELHO); // VERMELHO
  46. SendClientMessage(playerid, 0xFFFFFFFF, "* Cor do Laser alterada para {FF0000}Vermelho{FFFFFF}!");
  47. }
  48. case 1:{
  49. SetPVarInt(playerid, "color", LASER_AZUL); // AZUL
  50. SendClientMessage(playerid, 0xFFFFFFFF, "* Cor do Laser alterada para {008DF9}Azul{FFFFFF}!");
  51. }
  52. case 2:{
  53. SetPVarInt(playerid, "color", LASER_VERDE);
  54. SendClientMessage(playerid, 0xFFFFFFFF, "* Cor do Laser alterada para {3ED407}Verde{FFFFFF}!");
  55. }
  56. case 3:{
  57. SetPVarInt(playerid, "color", LASER_ROSA);
  58. SendClientMessage(playerid, 0xFFFFFFFF, "* Cor do Laser alterada para {FF00E6}Rosa{FFFFFF}!");
  59. }
  60. case 4:{
  61. SetPVarInt(playerid, "color", LASER_LARANJA);
  62. SendClientMessage(playerid, 0xFFFFFFFF, "* Cor do Laser alterada para {FFB700}Laranja{FFFFFF}!");
  63. }
  64. case 5:{
  65. SetPVarInt(playerid, "color", LASER_AMARELO);
  66. SendClientMessage(playerid, 0xFFFFFFFF, "* Cor do Laser alterada para {FFFC00}Amarelo{FFFFFF}!");
  67. }
  68. }
  69. }
  70. return 1;
  71. }
  72. return 1;
  73. }
  74.  
  75. CMD:arma(playerid,params[]){
  76. if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFFF, "/Arma [ArmaID]");
  77. return GivePlayerWeapon(playerid,strval(params),300);
  78. }
  79. CMD:laseron(playerid, params[]) {
  80. SetPVarInt(playerid, "laser", 1);
  81. SetPVarInt(playerid, "color", GetPVarInt(playerid, "color"));
  82. SendClientMessage(playerid, 0xFFFFFFFF, "* Laser ativado! Para desativar use: {FF0000}/LaserOff{FFFFFF}");
  83. return 1;
  84. }
  85. CMD:laseroff(playerid, params[]) {
  86. SetPVarInt(playerid, "laser", 0);
  87. RemovePlayerAttachedObject(playerid, 0);
  88. SendClientMessage(playerid, 0xFFFFFFFF, "* Laser {FF0000}Desativado{FFFFFF}!");
  89. return 1;
  90. }
  91. CMD:coreslaser(playerid){
  92. if(!GetPVarInt(playerid, "laser")) return SendClientMessage(playerid, 0xFFFFFFFF, "* Você não ativou o Laser, use: {FF0000}/LaserOn{FFFFFF}");
  93. ShowPlayerDialog(playerid, DIALOG_CORES_LASER, DIALOG_STYLE_LIST, "Laser - Cores",
  94. "{FF0000}Vermelho\n\
  95. {008DF9}Azul\n\
  96. {3ED407}Verde\n\
  97. {FF00E6}Rosa\n\
  98. {FFB700}Laranja\n\
  99. {FFFC00}Amarelo\n",
  100. "Escolher", "Cancelar");
  101. return 1;
  102. }
  103.  
  104. public OnPlayerUpdate(playerid) {
  105. if (GetPVarInt(playerid, "laser")) {
  106. RemovePlayerAttachedObject(playerid, 0);
  107. if ((IsPlayerInAnyVehicle(playerid)) || (IsPlayerInWater(playerid))) return 1;
  108. switch (GetPlayerWeapon(playerid)) {
  109. case 23: {
  110. if (IsPlayerAiming(playerid)) {
  111. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  112. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing aiming
  113. 0.108249, 0.030232, 0.118051, 1.468254, 350.512573, 364.284240);
  114. } else {
  115. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched aiming
  116. 0.108249, 0.030232, 0.118051, 1.468254, 349.862579, 364.784240);
  117. }
  118. } else {
  119. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  120. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing not aiming
  121. 0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
  122. } else {
  123. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched not aiming
  124. 0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
  125. } } }
  126. case 27: {
  127. if (IsPlayerAiming(playerid)) {
  128. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  129. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing aiming
  130. 0.588246, -0.022766, 0.138052, -11.531745, 347.712585, 352.784271);
  131. } else {
  132. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched aiming
  133. 0.588246, -0.022766, 0.138052, 1.468254, 350.712585, 352.784271);
  134. }
  135. } else {
  136. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  137. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing not aiming
  138. 0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
  139. } else {
  140. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched not aiming
  141. 0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
  142. } } }
  143. case 30: {
  144. if (IsPlayerAiming(playerid)) {
  145. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  146. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing aiming
  147. 0.628249, -0.027766, 0.078052, -6.621746, 352.552642, 355.084289);
  148. } else {
  149. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched aiming
  150. 0.628249, -0.027766, 0.078052, -1.621746, 356.202667, 355.084289);
  151. }
  152. } else {
  153. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  154. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing not aiming
  155. 0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
  156. } else {
  157. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched not aiming
  158. 0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
  159. } } }
  160. case 31: {
  161. if (IsPlayerAiming(playerid)) {
  162. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  163. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing aiming
  164. 0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
  165. } else {
  166. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched aiming
  167. 0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
  168. }
  169. } else {
  170. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  171. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing not aiming
  172. 0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
  173. } else {
  174. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched not aiming
  175. 0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
  176. } } }
  177. case 34: {
  178. if (IsPlayerAiming(playerid)) {
  179. return 1;
  180. } else {
  181. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  182. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing not aiming
  183. 0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
  184. } else {
  185. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched not aiming
  186. 0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
  187. } } }
  188. case 29: {
  189. if (IsPlayerAiming(playerid)) {
  190. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  191. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing aiming
  192. 0.298249, -0.02776, 0.158052, -11.631746, 359.302673, 357.584259);
  193. } else {
  194. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched aiming
  195. 0.298249, -0.02776, 0.158052, 8.368253, 358.302673, 352.584259);
  196. }
  197. } else {
  198. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  199. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing not aiming
  200. 0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
  201. } else {
  202. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched not aiming
  203. 0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
  204. } } } } }
  205. return 1;
  206. }
  207.  
  208. stock IsPlayerInWater(playerid) {
  209. new anim = GetPlayerAnimationIndex(playerid);
  210. if (((anim >= 1538) && (anim <= 1542)) || (anim == 1544) || (anim == 1250) || (anim == 1062)) return 1;
  211. return 0;
  212. }
  213. stock IsPlayerAiming(playerid) {
  214. new anim = GetPlayerAnimationIndex(playerid);
  215. if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) ||
  216. (anim == 1643) || (anim == 1453) || (anim == 220)) return 1;
  217. return 0;
  218. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement