Advertisement
Guest User

Untitled

a guest
Dec 20th, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 13.26 KB | None | 0 0
  1. /*
  2. Postado pela equipe Play Evolution SA-MP
  3. Creditos reservados ao criador: Psycho Faus
  4.  
  5. Site: www.PlayEvolutionSamp.net
  6.  
  7. ---------------------------------------------------------------------------------------------
  8. -            Play EvolutioN ™ - Tudo que você quiser para seu servidor SA-MP!               -
  9. ---------------------------------------------------------------------------------------------
  10. -                           ******** **       ******** **    **                             -
  11. -                           **    ** **       **    **  **  **                              -
  12. -                           *******  **       ********   * *                                -
  13. -                           **       **       **    **   ***                                -
  14. -                           **       ******** **    **   ***                                -
  15. ---------------------------------------------------------------------------------------------
  16. - ******** **        **   *******   **        **    **  *********  **   *******   **    *** -
  17. - **        **      **   **     **  **        **    **      *      **  **     **  **   * ** -
  18. - *******    **    **    **     **  **        **    **      *      **  **     **  **  *  ** -
  19. - **          **  **     **     **  **        **    **      *      **  **     **  ** *   ** -
  20. - ********     ****       *******   ********   ******       *      **   *******   ***    ** -
  21. ---------------------------------------------------------------------------------------------
  22. */
  23. #include <a_samp>
  24.  
  25. #define SENSETIVE 0.42
  26. #define MP 100
  27.  
  28. #define HOLDING(%0) \
  29.     ((newkeys & (%0)) == (%0))
  30.  
  31. new Text: ___[MP];
  32. new Text: __[MP];
  33. new Float:OH[MP];
  34. new Float:NH[MP];
  35. new Float:OP[MP];
  36. new Float:NP[MP];
  37. new timer[MP];
  38.  
  39. //------------------------------------------------------------------------------------------------------
  40. new aNames[][] =
  41. {
  42.     "Desarmado", "Soqueira", "Taco de Golf", "Cacetete",
  43.     "Faca", "Taco de Base-Ball", "Pá de pedreiro", "Cano", "Espada", "Motoserra", "Vibrador", "Vibrador", "Vibrador", "Vibrador",
  44.     "Flores", "Pé de cabra", "Granada", "Bomba de Gás", "Coquetel-Molotov", "Desconhecido 19", "Desconhecido 20", "Pistola 9mm", "Pistola 9mm com Silenciador",
  45.     "Desert Eagle", "Shotgun", "Escopeta do cano serrado", "Escopeta de combate", "Micro Uzi", "MP5", "Ak-47", "M4", "Tec9", "Rifle", "Rifle-Sniper",
  46.     "Lança Missil", "Lança Missil RPG", "Lança Chamas", "Minigun", "Explosivo Remoto", "Detonador", "Spray", "Extintor", "Camera", "Òculos de Visão noturna", "Òculos Infra Vermelho",
  47.     "Paraquedas", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido"
  48. };
  49.  
  50. public OnFilterScriptInit()
  51. {
  52. print("Sniper Privilege 0.3 by Faus aka Psycho loaded.");
  53. for(new i = 0; i < GetMaxPlayers(); i++)
  54. {
  55. if(IsPlayerConnected(i))
  56. {
  57. __[i] = TextDrawCreate(340,355,"-");
  58. TextDrawAlignment(__[i],0);
  59. TextDrawBackgroundColor(__[i],0x000000ff);
  60. TextDrawFont(__[i],2);
  61. TextDrawLetterSize(__[i],0.3,1.100000);
  62. TextDrawColor(__[i],0xffffffff);
  63. TextDrawSetOutline(__[i],1);
  64. TextDrawSetProportional(__[i],1);
  65. TextDrawSetShadow(__[i],1);
  66. ___[i] = TextDrawCreate(330,205,"-");
  67. TextDrawAlignment(___[i],0);
  68. TextDrawBackgroundColor(___[i],0x000000ff);
  69. TextDrawFont(___[i],2);
  70. TextDrawLetterSize(___[i],0.2,0.85);
  71. TextDrawColor(___[i],0xffffffff);
  72. TextDrawSetOutline(___[i],1);
  73. TextDrawSetProportional(___[i],1);
  74. TextDrawSetShadow(___[i],1);
  75. }
  76. }
  77. return 1;
  78. }
  79.  
  80. //------------------------------------------------------------------------------------------------------
  81.  
  82. public OnFilterScriptExit()
  83. {
  84. print("Sniper Privilege 0.3 by Faus aka Psycho unloaded.");
  85. for(new i = 0; i < GetMaxPlayers(); i++)
  86. {
  87. if(IsPlayerConnected(i))
  88. {
  89. TextDrawHideForPlayer(i,__[i]);
  90. TextDrawDestroy(__[i]);
  91. TextDrawHideForPlayer(i,___[i]);
  92. TextDrawDestroy(___[i]);
  93. KillTimer(timer[i]);
  94. }
  95. }
  96. return 1;
  97. }
  98.  
  99. //------------------------------------------------------------------------------------------------------
  100.  
  101. public OnPlayerConnect(playerid)
  102. {
  103. __[playerid] = TextDrawCreate(340,355,"-");
  104. TextDrawAlignment(__[playerid],0);
  105. TextDrawBackgroundColor(__[playerid],0x000000ff);
  106. TextDrawFont(__[playerid],2);
  107. TextDrawLetterSize(__[playerid],0.3,1.100000);
  108. TextDrawColor(__[playerid],0xffffffff);
  109. TextDrawSetOutline(__[playerid],1);
  110. TextDrawSetProportional(__[playerid],1);
  111. TextDrawSetShadow(__[playerid],1);
  112. ___[playerid] = TextDrawCreate(330,205,"-");
  113. TextDrawAlignment(___[playerid],0);
  114. TextDrawBackgroundColor(___[playerid],0x000000ff);
  115. TextDrawFont(___[playerid],2);
  116. TextDrawLetterSize(___[playerid],0.2,0.85);
  117. TextDrawColor(___[playerid],0xffffffff);
  118. TextDrawSetOutline(___[playerid],1);
  119. TextDrawSetProportional(___[playerid],1);
  120. TextDrawSetShadow(___[playerid],1);
  121. return 1;
  122. }
  123.  
  124. //------------------------------------------------------------------------------------------------------
  125.  
  126. public OnPlayerDisconnect(playerid,reason)
  127. {
  128. TextDrawHideForPlayer(playerid,__[playerid]);
  129. TextDrawDestroy(__[playerid]);
  130. TextDrawHideForPlayer(playerid,___[playerid]);
  131. TextDrawDestroy(___[playerid]);
  132. KillTimer(timer[playerid]);
  133. return 1;
  134. }
  135.  
  136. //------------------------------------------------------------------------------------------------------
  137.  
  138. public OnPlayerUpdate(playerid)
  139. {
  140. if(IsPlayerConnected(playerid))
  141. {
  142. GetPlayerHealth(playerid, NH[playerid]);
  143. if(NH[playerid] != OH[playerid])
  144. {
  145. OnPlayerHealthChange(playerid, NH[playerid], OH[playerid]);
  146. OH[playerid] = NH[playerid];
  147. }
  148. GetPlayerArmour(playerid, NP[playerid]);
  149. if(NP[playerid] != OP[playerid]){
  150. OnPlayerArmourChange(playerid, NP[playerid], OP[playerid]);
  151. OP[playerid] = NP[playerid];
  152. }
  153. }
  154. return 1;
  155. }
  156.  
  157. //------------------------------------------------------------------------------------------------------
  158.  
  159. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  160. {
  161. new string[256];
  162. new Float: HP, Float:AP;
  163. new weapons[13][2];
  164. if (HOLDING(128))
  165. {
  166. new Float:x,Float:y,Float:z;
  167. for(new i = 0; i < GetMaxPlayers(); i++)
  168. {
  169. if(IsPlayerConnected(i) && IsPlayerAiming(playerid,i) && GetPlayerWeapon(playerid) == 34 && i != playerid)
  170. {
  171. GetPlayerPos(i,x,y,z);
  172. GetPlayerHealth(i,HP);
  173. GetPlayerArmour(i,AP);
  174. GetPlayerWeaponData(playerid, 2, weapons[2][0], weapons[2][1]);
  175. format(string,256,"~g~%s Distancia: %~r~%d m.~n~~g~Ping: ~r~%dms ~g~HP: ~r~%d.0 ~g~AP: ~r~%d.0 ~g~AMSL: ~r~%d m.~n~~g~Arma: ~r~%s(%d) ~g~Aiming: ~r~%s",BadSymbols(GetName(i)),floatround(GetDistanceBetweenPlayers(i,playerid)),GetPlayerPing(i),floatround(HP),floatround(AP),floatround(z),aNames[weapons[2][0]],GetPlayerAmmo(i),IsPlayerAimingNew(i,playerid));
  176. TextDrawSetString(__[playerid],string);
  177. TextDrawShowForPlayer(playerid,__[playerid]);
  178. NormalPlaySound(i,1056);
  179. break;
  180. }
  181. }
  182. }
  183. if(!HOLDING(128))
  184. {
  185. TextDrawHideForPlayer(playerid,__[playerid]);
  186. }
  187. return 1;
  188. }
  189.  
  190. //------------------------------------------------------------------------------------------------------
  191.  
  192. forward OnPlayerHealthChange(playerid, Float:newhealth, Float:oldhealth);
  193. public OnPlayerHealthChange(playerid, Float:newhealth, Float:oldhealth)
  194. {
  195. new string[128];
  196. if(oldhealth > newhealth)
  197. {
  198. new Float:minus = oldhealth - newhealth;
  199. for(new i = 0; i < GetMaxPlayers(); i++)
  200. {
  201. if(IsPlayerConnected(i) && IsPlayerAiming(i,playerid) && GetDistanceBetweenPlayers(i,playerid) < 350 && i != playerid)
  202. {
  203. format(string,128,"~g~%s(%d)  ~p~(%s) ~r~-%dhp",BadSymbols(GetName(i)),i,ReturnWeaponName(GetPlayerWeapon(i)),floatround(minus));
  204. TextDrawSetString(___[playerid],string);
  205. TextDrawShowForPlayer(playerid,___[playerid]);
  206. format(string,128,"~g~%s(%d)  ~p~(%s) ~r~-%dhp",BadSymbols(GetName(playerid)),playerid,ReturnWeaponName(GetPlayerWeapon(playerid)),floatround(minus));
  207. TextDrawSetString(___[i],string);
  208. TextDrawShowForPlayer(i,___[i]);
  209. KillTimer(timer[playerid]);
  210. timer[playerid] = SetTimerEx("HideDamageTextDraw", 2500, 0, "d", playerid);
  211. KillTimer(timer[i]);
  212. timer[playerid] = SetTimerEx("HideDamageTextDraw", 2500, 0, "d", i);
  213. NormalPlaySound(i,1056);
  214. break;
  215. }
  216. }
  217. }
  218. return 1;
  219. }
  220.  
  221. //-----------------------------------------------------------------------------------------------------
  222.  
  223. forward OnPlayerArmourChange(playerid, Float:newarmour, Float:oldarmour);
  224. public OnPlayerArmourChange(playerid, Float:newarmour, Float:oldarmour)
  225. {
  226. new string[128];
  227. if(oldarmour > newarmour)
  228. {
  229. new Float:minus = oldarmour - newarmour;
  230. for(new i = 0; i < GetMaxPlayers(); i++)
  231. {
  232. if(IsPlayerConnected(i) && IsPlayerAiming(i,playerid) && GetDistanceBetweenPlayers(i,playerid) < 350 && i != playerid)
  233. {
  234. format(string,128,"~g~%s(%d)  ~p~(%s) ~r~-%dap",BadSymbols(GetName(i)),i,ReturnWeaponName(GetPlayerWeapon(i)),floatround(minus));
  235. TextDrawSetString(___[playerid],string);
  236. TextDrawShowForPlayer(playerid,___[playerid]);
  237. format(string,128,"~g~%s(%d)  ~p~(%s) ~r~-%dap",BadSymbols(GetName(playerid)),playerid,ReturnWeaponName(GetPlayerWeapon(playerid)),floatround(minus));
  238. TextDrawSetString(___[i],string);
  239. TextDrawShowForPlayer(i,___[i]);
  240. KillTimer(timer[playerid]);
  241. timer[playerid] = SetTimerEx("HideDamageTextDraw", 2500, 0, "d", playerid);
  242. KillTimer(timer[i]);
  243. timer[playerid] = SetTimerEx("HideDamageTextDraw", 2500, 0, "d", i);
  244. break;
  245. }
  246. }
  247. }
  248. return 1;
  249. }
  250.  
  251. //------------------------------------------------------------------------------------------------------
  252.  
  253. stock ReturnWeaponName(weaponid)
  254. {
  255. new weaponname[32];
  256. GetWeaponName(weaponid,weaponname,32);
  257. return weaponname;
  258. }
  259.  
  260. //------------------------------------------------------------------------------------------------------
  261.  
  262. stock BadSymbols(string[])
  263. {
  264. new result[256];
  265. for (new i; i < strlen(string); i++)
  266. {
  267. switch(string[i]) {
  268. case '[':result[i] = '(';
  269. case ']':result[i] = ')';
  270. default:result[i]=string[i];
  271. }
  272. }
  273. return result;
  274. }
  275.  
  276. //------------------------------------------------------------------------------------------------------
  277.  
  278. stock GetName(playerid){
  279. new Name[256];
  280. GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
  281. return Name;
  282. }
  283.  
  284. //------------------------------------------------------------------------------------------------------
  285.  
  286. stock IsPlayerAiming(playerid, aimid)
  287. {
  288. new Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2;
  289. GetPlayerPos(playerid, X1, Y1, Z1);
  290. GetPlayerPos(aimid, X2, Y2, Z2);
  291. new Float:Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
  292. if(Distance < 350){
  293. new Float:A;
  294. GetPlayerFacingAngle(playerid, A);
  295. X1 += (Distance * floatsin(-A, degrees));
  296. Y1 += (Distance * floatcos(-A, degrees));
  297. Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
  298. if(Distance < SENSETIVE){
  299. return true;
  300. }
  301. }
  302. return false;
  303. }
  304.  
  305. //------------------------------------------------------------------------------------------------------
  306.  
  307. stock IsPlayerAimingNew(playerid, aimid)
  308. {
  309. new Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2;
  310. new string[32];
  311. GetPlayerPos(playerid, X1, Y1, Z1);
  312. GetPlayerPos(aimid, X2, Y2, Z2);
  313. new Float:Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
  314. if(Distance < 350 && GetPlayerWeapon(aimid) != 0){
  315. new Float:A;
  316. GetPlayerFacingAngle(playerid, A);
  317. X1 += (Distance * floatsin(-A, degrees));
  318. Y1 += (Distance * floatcos(-A, degrees));
  319. Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
  320. if(Distance < SENSETIVE){
  321. format(string,32,"Yes");
  322. return string;
  323. }
  324. }
  325. format(string,32,"No");
  326. return string;
  327. }
  328.  
  329. //------------------------------------------------------------------------------------------------------
  330.  
  331. stock IsPlayerAimingNew2(playerid, aimid)
  332. {
  333. new Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2;
  334. GetPlayerPos(playerid, X1, Y1, Z1);
  335. GetPlayerPos(aimid, X2, Y2, Z2);
  336. new Float:Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
  337. if(Distance < 350){
  338. new Float:A;
  339. GetPlayerFacingAngle(playerid, A);
  340. X1 += (Distance * floatsin(-A, degrees));
  341. Y1 += (Distance * floatcos(-A, degrees));
  342. Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
  343. if(Distance < 1.5){
  344. return true;
  345. }
  346. }
  347. return false;
  348. }
  349.  
  350. //------------------------------------------------------------------------------------------------------
  351.  
  352. forward Float:GetDistanceBetweenPlayers(p1,p2);
  353. stock Float:GetDistanceBetweenPlayers(p1,p2)
  354. {
  355. new Float:x11,Float:y11,Float:z11,Float:x3,Float:y3,Float:z3;
  356. if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
  357. {
  358. return -1.00;
  359. }
  360. GetPlayerPos(p1,x11,y11,z11);
  361. GetPlayerPos(p2,x3,y3,z3);
  362. return floatsqroot(floatpower(floatabs(floatsub(x3,x11)),2)+floatpower(floatabs(floatsub(y3,y11)),2)+floatpower(floatabs(floatsub(z3,z11)),2));
  363. }
  364.  
  365. //------------------------------------------------------------------------------------------------------
  366.  
  367. forward HideDamageTextDraw(playerid);
  368. public HideDamageTextDraw(playerid)
  369. {
  370. TextDrawHideForPlayer(playerid,___[playerid]);
  371. return 1;
  372. }
  373.  
  374. //------------------------------------------------------------------------------------------------------
  375.  
  376. forward NormalPlaySound(playerid,sid);
  377. public NormalPlaySound(playerid,sid)
  378. {
  379. new Float:x,Float:y,Float:z;
  380. GetPlayerPos(playerid,x,y,z);
  381. PlayerPlaySound(playerid,sid,x,y,z);
  382. return 1;
  383. }
  384.  
  385. //------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement