Advertisement
Guest User

Untitled

a guest
Apr 17th, 2015
1,180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.68 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. //----------------------------------------------------------------------------//
  4.  
  5. public OnFilterScriptInit() {
  6. print("\n-- Laser Pointer by Skiaffo --\n");
  7. new p = GetMaxPlayers();
  8. for (new i=0; i < p; i++) {
  9. SetPVarInt(i, "laser", 0);
  10. SetPVarInt(i, "color", 18643);
  11. }
  12. return 1;
  13. }
  14.  
  15. public OnFilterScriptExit() {
  16. new p = GetMaxPlayers();
  17. for (new i=0; i < p; i++) {
  18. SetPVarInt(i, "laser", 0);
  19. RemovePlayerAttachedObject(i, 0);
  20. }
  21. return 1;
  22. }
  23.  
  24. //----------------------------------------------------------------------------//
  25.  
  26. public OnPlayerSpawn(playerid) {
  27. if (!GetPVarInt(playerid, "color")) SetPVarInt(playerid, "color", 18643);
  28. }
  29.  
  30. public OnPlayerDisconnect(playerid) {
  31. SetPVarInt(playerid, "laser", 0);
  32. RemovePlayerAttachedObject(playerid, 0);
  33. return 1;
  34. }
  35.  
  36. //----------------------------------------------------------------------------//
  37.  
  38. public OnPlayerCommandText(playerid, cmdtext[]) {
  39.  
  40. new cmd[256];
  41. new idx;
  42. cmd = strtok(cmdtext, idx);
  43.  
  44. if (!strcmp("/laseron", cmdtext, true)) {
  45. SetPVarInt(playerid, "laser", 1);
  46. SetPVarInt(playerid, "color", GetPVarInt(playerid, "color"));
  47. return 1;
  48. }
  49.  
  50. if (!strcmp("/laseroff", cmdtext, true)) {
  51. SetPVarInt(playerid, "laser", 0);
  52. RemovePlayerAttachedObject(playerid, 0);
  53. return 1;
  54. }
  55.  
  56. if (!strcmp("/lasercol", cmd, true)) {
  57. new tmp[256];
  58. tmp = strtok(cmdtext, idx);
  59. if (!strlen(tmp)) {
  60. SendClientMessage(playerid, 0x00E800FF, "Usage: /lasercol [color]");
  61. return 1;
  62. }
  63. if (!strcmp(tmp, "red", true)) SetPVarInt(playerid, "color", 18643);
  64. else if (!strcmp(tmp, "blue", true)) SetPVarInt(playerid, "color", 19080);
  65. else if (!strcmp(tmp, "pink", true)) SetPVarInt(playerid, "color", 19081);
  66. else if (!strcmp(tmp, "orange", true)) SetPVarInt(playerid, "color", 19082);
  67. else if (!strcmp(tmp, "green", true)) SetPVarInt(playerid, "color", 19083);
  68. else if (!strcmp(tmp, "yellow", true)) SetPVarInt(playerid, "color", 19084);
  69. else SendClientMessage(playerid, 0x00E800FF, "Colour not available!");
  70. return 1;
  71. }
  72.  
  73. return 0;
  74. }
  75.  
  76. public OnPlayerUpdate(playerid) {
  77. if (GetPVarInt(playerid, "laser")) {
  78. RemovePlayerAttachedObject(playerid, 0);
  79. if ((IsPlayerInAnyVehicle(playerid)) || (IsPlayerInWater(playerid))) return 1;
  80. switch (GetPlayerWeapon(playerid)) {
  81. case 23: {
  82. if (IsPlayerAiming(playerid)) {
  83. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  84. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing aiming
  85. 0.108249, 0.030232, 0.118051, 1.468254, 350.512573, 364.284240);
  86. } else {
  87. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched aiming
  88. 0.108249, 0.030232, 0.118051, 1.468254, 349.862579, 364.784240);
  89. }
  90. } else {
  91. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  92. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing not aiming
  93. 0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
  94. } else {
  95. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched not aiming
  96. 0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
  97. } } }
  98. case 27: {
  99. if (IsPlayerAiming(playerid)) {
  100. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  101. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing aiming
  102. 0.588246, -0.022766, 0.138052, -11.531745, 347.712585, 352.784271);
  103. } else {
  104. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched aiming
  105. 0.588246, -0.022766, 0.138052, 1.468254, 350.712585, 352.784271);
  106. }
  107. } else {
  108. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  109. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing not aiming
  110. 0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
  111. } else {
  112. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched not aiming
  113. 0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
  114. } } }
  115. case 30: {
  116. if (IsPlayerAiming(playerid)) {
  117. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  118. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing aiming
  119. 0.628249, -0.027766, 0.078052, -6.621746, 352.552642, 355.084289);
  120. } else {
  121. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched aiming
  122. 0.628249, -0.027766, 0.078052, -1.621746, 356.202667, 355.084289);
  123. }
  124. } else {
  125. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  126. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing not aiming
  127. 0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
  128. } else {
  129. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched not aiming
  130. 0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
  131. } } }
  132. case 31: {
  133. if (IsPlayerAiming(playerid)) {
  134. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  135. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing aiming
  136. 0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
  137. } else {
  138. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched aiming
  139. 0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
  140. }
  141. } else {
  142. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  143. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing not aiming
  144. 0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
  145. } else {
  146. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched not aiming
  147. 0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
  148. } } }
  149. case 34: {
  150. if (IsPlayerAiming(playerid)) {
  151. /*if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  152. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing aiming
  153. 0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
  154. } else {
  155. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched aiming
  156. 0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
  157. }*/
  158. return 1;
  159. } else {
  160. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  161. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing not aiming
  162. 0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
  163. } else {
  164. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched not aiming
  165. 0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
  166. } } }
  167. case 29: {
  168. if (IsPlayerAiming(playerid)) {
  169. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  170. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing aiming
  171. 0.298249, -0.02776, 0.158052, -11.631746, 359.302673, 357.584259);
  172. } else {
  173. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched aiming
  174. 0.298249, -0.02776, 0.158052, 8.368253, 358.302673, 352.584259);
  175. }
  176. } else {
  177. if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
  178. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing not aiming
  179. 0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
  180. } else {
  181. SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched not aiming
  182. 0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
  183. } } } } }
  184. return 1;
  185. }
  186.  
  187. stock IsPlayerInWater(playerid) {
  188. new anim = GetPlayerAnimationIndex(playerid);
  189. if (((anim >= 1538) && (anim <= 1542)) || (anim == 1544) || (anim == 1250) || (anim == 1062)) return 1;
  190. return 0;
  191. }
  192.  
  193. stock IsPlayerAiming(playerid) {
  194. new anim = GetPlayerAnimationIndex(playerid);
  195. if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) ||
  196. (anim == 1643) || (anim == 1453) || (anim == 220)) return 1;
  197. return 0;
  198. }
  199.  
  200. //----------------------------------------------------------------------------//
  201.  
  202. strtok(const string[], &index)
  203. {
  204. new length = strlen(string);
  205. while ((index < length) && (string[index] <= ' '))
  206. {
  207. index++;
  208. }
  209.  
  210. new offset = index;
  211. new result[20];
  212. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  213. {
  214. result[index - offset] = string[index];
  215. index++;
  216. }
  217. result[index - offset] = EOS;
  218. return result;
  219. }
  220.  
  221. //----------------------------------------------------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement