Guest User

Untitled

a guest
Feb 25th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.13 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4. #include <a_samp>
  5. #include <a_mysql>
  6. #include <YSI\y_ini>
  7. #if defined H_INPUT_INCLUDED
  8. #endinput
  9. #else
  10. #define H_INPUT_INCLUDED
  11. #endif
  12. #pragma deprecated
  13. native InputInit();
  14.  
  15. #define HID_INPUT_PLAYLIST 1
  16. #define HID_INPUT_KEYPAD 2
  17. #define HID_INPUT_VEHCOL 3
  18. #define HID_INPUT_KEYBOARD 4
  19. #undef MAX_PLAYERS
  20. #define MAX_PLAYERS 32 //Slot
  21. new Menu:menu;
  22. #define COLOR_BLACK 0x2C2727AA
  23. #define COLOR_GREEN 0x33AA33AA
  24. #define COLOR_PINK 0xFF66FFAA
  25. #define COLOR_BLUE 0x0000BBAA
  26. #define COLOR_WHITE 0xFFFFFFAA
  27. #define COLOR_LIGHTYELLOW 0x99FF9900
  28. #define COLOR_GREY 0xAFAFAFAA
  29. #define COLOR_GREEN 0x33AA33AA
  30. #define COLOR_RED 0xAA3333AA
  31. #define COLOR_YELLOW 0xFFFF00AA
  32. #define COLOR_PINK 0xFF66FFAA
  33. #define COLOR_BLUE 0x0000BBAA
  34. #define COLOR_ORANGE 0xFF9900AA
  35. #define COLOR_PURPLE 0x990099AA
  36. #define COLOR_BROWN 0x663300AA
  37. #define COLOR_LIGHTBLUE 0x33CCFFAA
  38. #define COLOR_DARKRED 0x660000AA
  39. #define COLOR_DARKBLUE 0x000066AA
  40. #define KEYPAD_BLASTDOOR 1 // The ID for the Keypad we will use
  41. #define COL_WHITE "{FFFFFF}"
  42. #define COL_RED "{F81414}"
  43. #define COL_GREEN "{00FF22}"
  44. #define COL_LIGHTBLUE "{00CED1}"
  45. #if defined FILTERSCRIPT
  46. forward OnPlayerSelectPlayer(playerid, targetid, event);
  47. forward OnPlayerKeypadInput(playerid, input[], event);
  48.  
  49. /* native time
  50. native InputFromPlayerList(playerid, event, bool:allowcancel);
  51. native InputFromKeypad(playerid, event, len, bool:allowcancel);
  52. native CancelInput(playerid);
  53. */
  54. stock InputFromPlayerList(playerid, event, bool:allowcancel)
  55. {
  56. //process init
  57. SetPVarInt(playerid, "hid_input_event", event);
  58. switch(GetPVarInt(playerid, "hid_input_active"))
  59. {
  60. case HID_INPUT_PLAYLIST:
  61. {
  62. DeletePVar(playerid, "hid_input_playlist_list");
  63. Hid_Input_SetUpList(playerid);
  64. return;
  65. }
  66. case HID_INPUT_KEYPAD:
  67. {
  68.  
  69. }
  70. }
  71. SetPVarInt(playerid, "hid_input_active", HID_INPUT_PLAYLIST);
  72.  
  73. //actual init
  74. new PlayerText:td;
  75. new str[30];
  76.  
  77. td = CreatePlayerTextDraw(playerid, 320.000000, 90.000000, "~n~Player List~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~");
  78. PlayerTextDrawAlignment(playerid, td, 2);
  79. PlayerTextDrawBackgroundColor(playerid, td, 0xFF);
  80. PlayerTextDrawFont(playerid, td, 2);
  81. PlayerTextDrawLetterSize(playerid, td, 0.500000, 1.000000);
  82. PlayerTextDrawColor(playerid, td, -1);
  83. PlayerTextDrawSetOutline(playerid, td, 0);
  84. PlayerTextDrawSetProportional(playerid, td, 1);
  85. PlayerTextDrawSetShadow(playerid, td, 1);
  86. PlayerTextDrawUseBox(playerid, td, true);
  87. PlayerTextDrawBoxColor(playerid, td, 150);
  88. PlayerTextDrawTextSize(playerid, td, 10.000000, 250.000000);
  89. PlayerTextDrawShow(playerid, td);
  90. SetPVarInt(playerid, "hid_input_playlist_td_box", _:td);
  91.  
  92. for(new b; b != 20; b++)
  93. {
  94. td = CreatePlayerTextDraw(playerid, 220.0, 120.0 + b * 10.0, "");
  95. PlayerTextDrawBackgroundColor(playerid, td, 0xFF);
  96. PlayerTextDrawFont(playerid, td, 2);
  97. PlayerTextDrawLetterSize(playerid, td, 0.239999, 1.000000);
  98. PlayerTextDrawSetOutline(playerid, td, 0);
  99. PlayerTextDrawSetProportional(playerid, td, 1);
  100. PlayerTextDrawSetShadow(playerid, td, 1);
  101. PlayerTextDrawTextSize(playerid, td, 420.000000, 11.00000);
  102. format(str, sizeof str, "hid_input_playlist_td_%i", b);
  103. SetPVarInt(playerid, str, _:td);
  104. }
  105.  
  106. td = CreatePlayerTextDraw(playerid, 320.000000, 330.000000, "_");
  107. PlayerTextDrawAlignment(playerid, td, 2);
  108. PlayerTextDrawBackgroundColor(playerid, td, 0xFF);
  109. PlayerTextDrawFont(playerid, td, 2);
  110. PlayerTextDrawLetterSize(playerid, td, 0.500000, 1.000000);
  111. PlayerTextDrawColor(playerid, td, -1);
  112. PlayerTextDrawSetOutline(playerid, td, 0);
  113. PlayerTextDrawSetProportional(playerid, td, 1);
  114. PlayerTextDrawSetShadow(playerid, td, 1);
  115. PlayerTextDrawShow(playerid, td);
  116. SetPVarInt(playerid, "hid_input_playlist_td_mid", _:td);
  117.  
  118. td = CreatePlayerTextDraw(playerid, 240.000000, 330.000000, "Previous 20");
  119. PlayerTextDrawAlignment(playerid, td, 2);
  120. PlayerTextDrawBackgroundColor(playerid, td, 0xFF);
  121. PlayerTextDrawFont(playerid, td, 2);
  122. PlayerTextDrawLetterSize(playerid, td, 0.200000, 1.000000);
  123. PlayerTextDrawSetOutline(playerid, td, 0);
  124. PlayerTextDrawSetProportional(playerid, td, 1);
  125. PlayerTextDrawSetShadow(playerid, td, 1);
  126. PlayerTextDrawTextSize(playerid, td, 18.0, 100.0);
  127. PlayerTextDrawShow(playerid, td);
  128. SetPVarInt(playerid, "hid_input_playlist_td_prev", _:td);
  129.  
  130. td = CreatePlayerTextDraw(playerid, 400.000000, 330.000000, "Next 20");
  131. PlayerTextDrawAlignment(playerid, td, 2);
  132. PlayerTextDrawBackgroundColor(playerid, td, 0xFF);
  133. PlayerTextDrawFont(playerid, td, 2);
  134. PlayerTextDrawLetterSize(playerid, td, 0.200000, 1.000000);
  135. PlayerTextDrawSetOutline(playerid, td, 0);
  136. PlayerTextDrawSetProportional(playerid, td, 1);
  137. PlayerTextDrawSetShadow(playerid, td, 1);
  138. PlayerTextDrawTextSize(playerid, td, 18.0, 55.0);
  139. PlayerTextDrawShow(playerid, td);
  140. SetPVarInt(playerid, "hid_input_playlist_td_next", _:td);
  141.  
  142. if(allowcancel == true)
  143. {
  144. td = CreatePlayerTextDraw(playerid, 435.000000, 93.000000, "X");
  145. PlayerTextDrawAlignment(playerid, td, 2);
  146. PlayerTextDrawBackgroundColor(playerid, td, 255);
  147. PlayerTextDrawFont(playerid, td, 2);
  148. PlayerTextDrawLetterSize(playerid, td, 0.500000, 1.000000);
  149. PlayerTextDrawColor(playerid, td, 0x707070FF);
  150. PlayerTextDrawSetOutline(playerid, td, 0);
  151. PlayerTextDrawSetProportional(playerid, td, 1);
  152. PlayerTextDrawSetShadow(playerid, td, 0);
  153. PlayerTextDrawUseBox(playerid, td, 1);
  154. PlayerTextDrawBoxColor(playerid, td, 842150655);
  155. PlayerTextDrawTextSize(playerid, td, 11.000000, 11.000000);
  156. PlayerTextDrawSetSelectable(playerid, td, true);
  157. PlayerTextDrawShow(playerid, td);
  158. SetPVarInt(playerid, "hid_input_td_close", _:td);
  159. }
  160.  
  161. SelectTextDraw(playerid, 0xFFFFFFFF);
  162. Hid_Input_SetUpList(playerid);
  163. }
  164.  
  165. stock InputFromKeypad(playerid, event, minlen, maxlen, bool:allowcancel)
  166. {
  167. //process init
  168. SetPVarInt(playerid, "hid_input_event", event);
  169. if(minlen > maxlen)
  170. {
  171. new temp = minlen;
  172. minlen = maxlen;
  173. maxlen = temp;
  174. }
  175. if(minlen <= 0 || maxlen > 16) minlen = 1;
  176. if(maxlen > 0 && maxlen <= 16) SetPVarInt(playerid, "hid_input_keypad_maxlen", maxlen);
  177. else SetPVarInt(playerid, "hid_input_keypad_maxlen", 16);
  178. SetPVarInt(playerid, "hid_input_keypad_minlen", minlen);
  179. new PlayerText:td;
  180. new str[30];
  181. switch(GetPVarInt(playerid, "hid_input_active"))
  182. {
  183. case HID_INPUT_PLAYLIST:
  184. {
  185. CancelInput(playerid);
  186.  
  187. }
  188. case HID_INPUT_KEYPAD:
  189. {
  190. DeletePVar(playerid, "hid_input_keypad_input");
  191. PlayerTextDrawSetString(playerid, PlayerText:GetPVarInt(playerid, "hid_input_keypad_td_input"), "-");
  192. return;
  193. }
  194. }
  195.  
  196. //actual init
  197. SetPVarInt(playerid, "hid_input_active", HID_INPUT_KEYPAD);
  198.  
  199. td = CreatePlayerTextDraw(playerid, 320.000000, 90.000000, "~n~Keypad~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~");
  200. PlayerTextDrawAlignment(playerid, td, 2);
  201. PlayerTextDrawBackgroundColor(playerid, td, 255);
  202. PlayerTextDrawFont(playerid, td, 2);
  203. PlayerTextDrawLetterSize(playerid, td, 0.500000, 1.000000);
  204. PlayerTextDrawColor(playerid, td, -1);
  205. PlayerTextDrawSetOutline(playerid, td, 0);
  206. PlayerTextDrawSetProportional(playerid, td, 1);
  207. PlayerTextDrawSetShadow(playerid, td, 1);
  208. PlayerTextDrawUseBox(playerid, td, 1);
  209. PlayerTextDrawBoxColor(playerid, td, 150);
  210. PlayerTextDrawTextSize(playerid, td, 10.000000, 250.000000);
  211. PlayerTextDrawShow(playerid, td);
  212. SetPVarInt(playerid, "hid_input_keypad_td_box", _:td);
  213.  
  214. for(new b = 0; b != 10; b++)
  215. {
  216. switch(b)
  217. {
  218. case 0: td = CreatePlayerTextDraw(playerid, 250.000000, 235.000000, "0");
  219. case 1: td = CreatePlayerTextDraw(playerid, 250.000000, 205.000000, "1");
  220. case 2: td = CreatePlayerTextDraw(playerid, 295.000000, 205.000000, "2");
  221. case 3: td = CreatePlayerTextDraw(playerid, 340.000000, 205.000000, "3");
  222. case 4: td = CreatePlayerTextDraw(playerid, 250.000000, 175.000000, "4");
  223. case 5: td = CreatePlayerTextDraw(playerid, 295.000000, 175.000000, "5");
  224. case 6: td = CreatePlayerTextDraw(playerid, 340.000000, 175.000000, "6");
  225. case 7: td = CreatePlayerTextDraw(playerid, 250.000000, 145.000000, "7");
  226. case 8: td = CreatePlayerTextDraw(playerid, 295.000000, 145.000000, "8");
  227. case 9: td = CreatePlayerTextDraw(playerid, 340.000000, 145.000000, "9");
  228. }
  229. PlayerTextDrawAlignment(playerid, td, 2);
  230. PlayerTextDrawBackgroundColor(playerid, td, 255);
  231. PlayerTextDrawFont(playerid, td, 2);
  232. PlayerTextDrawLetterSize(playerid, td, 0.659999, 2.599999);
  233. PlayerTextDrawColor(playerid, td, 0x808080FF);
  234. PlayerTextDrawSetOutline(playerid, td, 0);
  235. PlayerTextDrawSetProportional(playerid, td, 1);
  236. PlayerTextDrawSetShadow(playerid, td, 1);
  237. PlayerTextDrawUseBox(playerid, td, 1);
  238. PlayerTextDrawBoxColor(playerid, td, 255);
  239. PlayerTextDrawTextSize(playerid, td, 34.000000, 34.000000);
  240. PlayerTextDrawSetSelectable(playerid, td, true);
  241. PlayerTextDrawShow(playerid, td);
  242. format(str, sizeof str, "hid_input_keypad_td_%i", b);
  243. SetPVarInt(playerid, str, _:td);
  244. }
  245.  
  246. td = CreatePlayerTextDraw(playerid, 405.000000, 165.000000, "C");
  247. PlayerTextDrawAlignment(playerid, td, 2);
  248. PlayerTextDrawBackgroundColor(playerid, td, 255);
  249. PlayerTextDrawFont(playerid, td, 2);
  250. PlayerTextDrawLetterSize(playerid, td, 1.059999, 2.599999);
  251. PlayerTextDrawColor(playerid, td, -16776961);
  252. PlayerTextDrawSetOutline(playerid, td, 0);
  253. PlayerTextDrawSetProportional(playerid, td, 1);
  254. PlayerTextDrawSetShadow(playerid, td, 1);
  255. PlayerTextDrawUseBox(playerid, td, 1);
  256. PlayerTextDrawBoxColor(playerid, td, 255);
  257. PlayerTextDrawTextSize(playerid, td, 34.000000, 34.000000);
  258. PlayerTextDrawSetSelectable(playerid, td, true);
  259. PlayerTextDrawShow(playerid, td);
  260. SetPVarInt(playerid, "hid_input_keypad_td_clear", _:td);
  261.  
  262. td = CreatePlayerTextDraw(playerid, 405.000000, 214.000000, "Ok");
  263. PlayerTextDrawAlignment(playerid, td, 2);
  264. PlayerTextDrawBackgroundColor(playerid, td, 255);
  265. PlayerTextDrawFont(playerid, td, 2);
  266. PlayerTextDrawLetterSize(playerid, td, 0.570000, 2.899999);
  267. PlayerTextDrawColor(playerid, td, 16711935);
  268. PlayerTextDrawSetOutline(playerid, td, 0);
  269. PlayerTextDrawSetProportional(playerid, td, 1);
  270. PlayerTextDrawSetShadow(playerid, td, 1);
  271. PlayerTextDrawUseBox(playerid, td, 1);
  272. PlayerTextDrawBoxColor(playerid, td, 255);
  273. PlayerTextDrawTextSize(playerid, td, 34.000000, 34.000000);
  274. PlayerTextDrawSetSelectable(playerid, td, true);
  275. PlayerTextDrawShow(playerid, td);
  276. SetPVarInt(playerid, "hid_input_keypad_td_confirm", _:td);
  277.  
  278. td = CreatePlayerTextDraw(playerid, 320.000000, 120.000000, "-");
  279. PlayerTextDrawAlignment(playerid, td, 2);
  280. PlayerTextDrawBackgroundColor(playerid, td, 255);
  281. PlayerTextDrawFont(playerid, td, 2);
  282. PlayerTextDrawLetterSize(playerid, td, 0.450000, 1.800000);
  283. PlayerTextDrawColor(playerid, td, -1);
  284. PlayerTextDrawSetOutline(playerid, td, 0);
  285. PlayerTextDrawSetProportional(playerid, td, 1);
  286. PlayerTextDrawSetShadow(playerid, td, 1);
  287. PlayerTextDrawUseBox(playerid, td, 1);
  288. PlayerTextDrawBoxColor(playerid, td, 255);
  289. PlayerTextDrawTextSize(playerid, td, 420.000000, 230.000000);
  290. PlayerTextDrawShow(playerid, td);
  291. SetPVarInt(playerid, "hid_input_keypad_td_input", _:td);
  292.  
  293. if(allowcancel == true)
  294. {
  295. td = CreatePlayerTextDraw(playerid, 435.000000, 93.000000, "X");
  296. PlayerTextDrawAlignment(playerid, td, 2);
  297. PlayerTextDrawBackgroundColor(playerid, td, 255);
  298. PlayerTextDrawFont(playerid, td, 2);
  299. PlayerTextDrawLetterSize(playerid, td, 0.500000, 1.000000);
  300. PlayerTextDrawColor(playerid, td, 0x707070FF);
  301. PlayerTextDrawSetOutline(playerid, td, 0);
  302. PlayerTextDrawSetProportional(playerid, td, 1);
  303. PlayerTextDrawSetShadow(playerid, td, 0);
  304. PlayerTextDrawUseBox(playerid, td, 1);
  305. PlayerTextDrawBoxColor(playerid, td, 842150655);
  306. PlayerTextDrawTextSize(playerid, td, 11.000000, 11.000000);
  307. PlayerTextDrawSetSelectable(playerid, td, true);
  308. PlayerTextDrawShow(playerid, td);
  309. SetPVarInt(playerid, "hid_input_td_close", _:td);
  310. }
  311. SelectTextDraw(playerid, 0xFFFFFFFF);
  312. GetPVarString(playerid, "hid_input_keypad_input", str, 16);
  313.  
  314. }
  315.  
  316. stock Hid_Input_SetUpList(playerid)
  317. {
  318. new list = GetPVarInt(playerid, "hid_input_playlist_list");
  319. new str[30];
  320. new PlayerText:td;
  321. for(new b = list; b != list + 20; b++)
  322. {
  323. format(str, sizeof str, "hid_input_playlist_td_%i", b % 20);
  324. td = PlayerText:GetPVarInt(playerid, str);
  325. if(b >= MAX_PLAYERS)
  326. {
  327. PlayerTextDrawHide(playerid, td);
  328. continue;
  329. }
  330. if(IsPlayerConnected(b))
  331. {
  332. GetPlayerName(b, str, MAX_PLAYER_NAME);
  333. format(str, sizeof str, "%i. %s", b, str);
  334. PlayerTextDrawSetString(playerid, td, str);
  335. PlayerTextDrawColor(playerid, td, 0xA3B4C5FF);
  336. PlayerTextDrawSetSelectable(playerid, td, true);
  337. }
  338. else
  339. {
  340. format(str, sizeof str, "%i. Not connected", b);
  341. PlayerTextDrawSetString(playerid, td, str);
  342. PlayerTextDrawColor(playerid, td, 0x505050FF);
  343. PlayerTextDrawSetSelectable(playerid, td, false);
  344. }
  345. PlayerTextDrawShow(playerid, td);
  346. }
  347. //navback
  348. td = PlayerText:GetPVarInt(playerid, "hid_input_playlist_td_prev");
  349. if(list != 0)
  350. {
  351. PlayerTextDrawSetSelectable(playerid, td, true);
  352. PlayerTextDrawColor(playerid, td, 0xA3B4C5FF);
  353. PlayerTextDrawShow(playerid, td);
  354. }
  355. else
  356. {
  357. PlayerTextDrawSetSelectable(playerid, td, false);
  358. PlayerTextDrawColor(playerid, td, 0x505050FF);
  359. PlayerTextDrawShow(playerid, td);
  360. }
  361. //navfront
  362. td = PlayerText:GetPVarInt(playerid, "hid_input_playlist_td_next");
  363. if((list + 20) < MAX_PLAYERS)
  364. {
  365. PlayerTextDrawSetSelectable(playerid, td, true);
  366. PlayerTextDrawColor(playerid, td, 0xA3B4C5FF);
  367. PlayerTextDrawShow(playerid, td);
  368. }
  369. else
  370. {
  371. PlayerTextDrawSetSelectable(playerid, td, false);
  372. PlayerTextDrawColor(playerid, td, 0x505050FF);
  373. PlayerTextDrawShow(playerid, td);
  374. }
  375. // mid (0-19)
  376. td = PlayerText:GetPVarInt(playerid, "hid_input_playlist_td_mid");
  377. format(str, sizeof str, "%i-%i", list, list + 19);
  378. PlayerTextDrawSetString(playerid, td, str);
  379. PlayerTextDrawShow(playerid, td);
  380. }
  381.  
  382. stock CancelInput(playerid)
  383. {
  384. switch(GetPVarInt(playerid, "hid_input_active"))
  385. {
  386. case 0: return;
  387. case HID_INPUT_PLAYLIST:
  388. {
  389. new str[30], PlayerText:td;
  390. td = PlayerText:GetPVarInt(playerid, "hid_input_td_close");
  391. if(_:td != 0)
  392. {
  393. PlayerTextDrawDestroy(playerid, td);
  394. DeletePVar(playerid, "hid_input_td_close");
  395. }
  396. for(new c; c != 20; c++)
  397. {
  398. format(str, sizeof str, "hid_input_playlist_td_%i", c);
  399. td = PlayerText:GetPVarInt(playerid, str);
  400. PlayerTextDrawDestroy(playerid, td);
  401. DeletePVar(playerid, str);
  402. }
  403. td = PlayerText:GetPVarInt(playerid, "hid_input_playlist_td_next");
  404. PlayerTextDrawDestroy(playerid, td);
  405. DeletePVar(playerid, "hid_input_playlist_td_next");
  406. td = PlayerText:GetPVarInt(playerid, "hid_input_playlist_td_prev");
  407. PlayerTextDrawDestroy(playerid, td);
  408. DeletePVar(playerid, "hid_input_playlist_td_prev");
  409. td = PlayerText:GetPVarInt(playerid, "hid_input_playlist_td_right");
  410. PlayerTextDrawDestroy(playerid, td);
  411. DeletePVar(playerid, "hid_input_playlist_td_right");
  412. td = PlayerText:GetPVarInt(playerid, "hid_input_playlist_td_mid");
  413. PlayerTextDrawDestroy(playerid, td);
  414. DeletePVar(playerid, "hid_input_playlist_td_mid");
  415. td = PlayerText:GetPVarInt(playerid, "hid_input_playlist_td_box");
  416. PlayerTextDrawDestroy(playerid, td);
  417. DeletePVar(playerid, "hid_input_playlist_td_box");
  418. DeletePVar(playerid, "hid_input_playlist_list");
  419. DeletePVar(playerid, "hid_input_event");
  420. DeletePVar(playerid, "hid_input_active");
  421. CancelSelectTextDraw(playerid);
  422. }
  423. case HID_INPUT_KEYPAD:
  424. {
  425. new str[30], PlayerText:td;
  426. td = PlayerText:GetPVarInt(playerid, "hid_input_td_close");
  427. if(_:td != 0)
  428. {
  429. PlayerTextDrawDestroy(playerid, td);
  430. DeletePVar(playerid, "hid_input_td_close");
  431. }
  432. for(new c; c != 10; c++)
  433. {
  434. format(str, sizeof str, "hid_input_keypad_td_%i", c);
  435. td = PlayerText:GetPVarInt(playerid, str);
  436. PlayerTextDrawDestroy(playerid, td);
  437. DeletePVar(playerid, str);
  438. }
  439. td = PlayerText:GetPVarInt(playerid, "hid_input_keypad_td_box");
  440. PlayerTextDrawDestroy(playerid, td);
  441. DeletePVar(playerid, "hid_input_keypad_td_box");
  442. td = PlayerText:GetPVarInt(playerid, "hid_input_keypad_td_clear");
  443. PlayerTextDrawDestroy(playerid, td);
  444. DeletePVar(playerid, "hid_input_keypad_td_clear");
  445. td = PlayerText:GetPVarInt(playerid, "hid_input_keypad_td_confirm");
  446. PlayerTextDrawDestroy(playerid, td);
  447. DeletePVar(playerid, "hid_input_keypad_td_confirm");
  448. td = PlayerText:GetPVarInt(playerid, "hid_input_keypad_td_input");
  449. PlayerTextDrawDestroy(playerid, td);
  450. DeletePVar(playerid, "hid_input_keypad_input");
  451. DeletePVar(playerid, "hid_input_keypad_maxlen");
  452. DeletePVar(playerid, "hid_input_keypad_minlen");
  453. DeletePVar(playerid, "hid_input_event");
  454. DeletePVar(playerid, "hid_input_active");
  455. CancelSelectTextDraw(playerid);
  456. }
  457. }
  458. }
  459.  
  460. public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
  461. {
  462. switch(GetPVarInt(playerid, "hid_input_active"))
  463. {
  464. case HID_INPUT_PLAYLIST:
  465. {
  466. if(PlayerText:GetPVarInt(playerid, "hid_input_playlist_td_prev") == playertextid)
  467. {
  468. new list = GetPVarInt(playerid, "hid_input_playlist_list");
  469. if(list != 0) list -= 20;
  470. SetPVarInt(playerid, "hid_input_playlist_list", list);
  471. Hid_Input_SetUpList(playerid);
  472. return 1;
  473. }
  474. else if(PlayerText:GetPVarInt(playerid, "hid_input_playlist_td_next") == playertextid)
  475. {
  476. new list = GetPVarInt(playerid, "hid_input_playlist_list");
  477. if((list + 20) < MAX_PLAYERS) list += 20;
  478. SetPVarInt(playerid, "hid_input_playlist_list", list);
  479. Hid_Input_SetUpList(playerid);
  480. return 1;
  481. }
  482. else if(PlayerText:GetPVarInt(playerid, "hid_input_td_close") == playertextid)
  483. {
  484. CallRemoteFunction("OnPlayerSelectPlayer", "iii", playerid, INVALID_PLAYER_ID, GetPVarInt(playerid, "hid_input_event"));
  485. CancelInput(playerid);
  486. return 1;
  487. }
  488. else
  489. {
  490. new str[30], PlayerText:td;
  491. for(new b; b != 20; b++)
  492. {
  493. format(str, sizeof str, "hid_input_playlist_td_%i", b);
  494. td = PlayerText:GetPVarInt(playerid, str);
  495. if(td == playertextid)
  496. {
  497. CallRemoteFunction("OnPlayerSelectPlayer", "iii", playerid, b + GetPVarInt(playerid, "hid_input_playlist_list"), GetPVarInt(playerid, "hid_input_event"));
  498. CancelInput(playerid);
  499. return 1;
  500. }
  501. }
  502. }
  503.  
  504. }
  505. case HID_INPUT_KEYPAD:
  506. {
  507. if(PlayerText:GetPVarInt(playerid, "hid_input_keypad_td_confirm") == playertextid)
  508. {
  509. new str[16];
  510. GetPVarString(playerid, "hid_input_keypad_input", str, 16);
  511. if(strlen(str) < GetPVarInt(playerid, "hid_input_keypad_minlen")) return 1;
  512. CallRemoteFunction("OnPlayerKeypadInput", "isi", playerid, str, GetPVarInt(playerid, "hid_input_event"));
  513. CancelInput(playerid);
  514. return 1;
  515. }
  516. else if(PlayerText:GetPVarInt(playerid, "hid_input_keypad_td_clear") == playertextid)
  517. {
  518. DeletePVar(playerid, "hid_input_keypad_input");
  519. PlayerTextDrawSetString(playerid, PlayerText:GetPVarInt(playerid, "hid_input_keypad_td_input"), "-");
  520. return 1;
  521. }
  522. else if(PlayerText:GetPVarInt(playerid, "hid_input_td_close") == playertextid)
  523. {
  524. CallRemoteFunction("OnPlayerKeypadInput", "iii", playerid, -1, GetPVarInt(playerid, "hid_input_event"));
  525. CancelInput(playerid);
  526. return 1;
  527. }
  528. else
  529. {
  530. new str[30], PlayerText:td;
  531. for(new b; b != 10; b++)
  532. {
  533. format(str, sizeof str, "hid_input_keypad_td_%i", b);
  534. td = PlayerText:GetPVarInt(playerid, str);
  535. if(td == playertextid)
  536. {
  537. for(new i; i != 30; i++) str[i] = '\0';
  538. GetPVarString(playerid, "hid_input_keypad_input", str, 16);
  539. if(strlen(str) >= GetPVarInt(playerid, "hid_input_keypad_maxlen")) return 1;
  540. str[strlen(str)] = b + 48;
  541. SetPVarString(playerid, "hid_input_keypad_input", str);
  542. td = PlayerText:GetPVarInt(playerid, "hid_input_keypad_td_input");
  543. PlayerTextDrawSetString(playerid, td, str);
  544. PlayerTextDrawShow(playerid, td);
  545. return 1;
  546. }
  547. }
  548. }
  549.  
  550. }
  551. default: return CallLocalFunction("S@@_OnPlayerClickPlayerTextDraw", "ii", playerid, _:playertextid);
  552. }
  553. return CallLocalFunction("S@@_OnPlayerClickPlayerTextDraw", "ii", playerid, _:playertextid);
  554. }
  555.  
  556. #if defined ALS_OnPlayerClickPlayerTextDraw
  557. #undef OnPlayerClickPlayerTextDraw
  558. #else
  559. #define ALS_OnPlayerClickPlayerTextDraw
  560. #endif
  561. #define OnPlayerClickPlayerTextDraw S@@_OnPlayerClickPlayerTextDraw
  562. forward OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid);
  563.  
  564. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  565. {
  566. if(_:clickedid == 65535 && GetPVarInt(playerid, "hid_input_active") != 0)
  567. {
  568. if(GetPVarInt(playerid, "hid_input_td_close") != 0) CancelInput(playerid);
  569. else SelectTextDraw(playerid, 0xFFFFFFFF);
  570. return 1;
  571. }
  572. return CallLocalFunction("S@@_OnPlayerClickTextDraw", "ii", playerid, _:clickedid);
  573. }
  574.  
  575. #if defined ALS_OnPlayerClickTextDraw
  576. #undef OnPlayerClickTextDraw
  577. #else
  578. #define ALS_OnPlayerClickTextDraw
  579. #endif
  580. #define OnPlayerClickTextDraw S@@_OnPlayerClickTextDraw
  581. forward OnPlayerClickTextDraw(playerid, Text:clickedid);
  582.  
  583. public OnFilterScriptInit()
  584. {
  585. print("\n--------------------------------------");
  586. print(" DeathMatch v1.0");
  587. print("--------------------------------------\n");
  588. return 1;
  589. }
  590.  
  591. public OnFilterScriptExit()
  592. {
  593. return 1;
  594. }
  595.  
  596. #else
  597.  
  598. main()
  599. {
  600. print("\n----------------------------------");
  601. print(" DeatMatch v1.0");
  602. print("----------------------------------\n");
  603. }
  604.  
  605. #endif
  606.  
  607. public OnGameModeInit()
  608. {
  609. // Don't use these lines if it's a filterscript
  610. SetGameModeText("Deathmatch");
  611. AddPlayerClass(0,1128.9982,-1485.5696,22.7690,358.9876,0,0,0,0,0,0); //
  612. return 1;
  613. }
  614. public OnGameModeExit()
  615. {
  616. return 1;
  617. }
  618.  
  619. public OnPlayerRequestClass(playerid, classid)
  620. {
  621. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  622. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  623. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  624. return 1;
  625. }
  626. public OnPlayerConnect(playerid)
  627. {
  628. new name[24];
  629. new string[256];
  630. GetPlayerName(playerid,name,sizeof(name));
  631. format(string,sizeof(string), "%s (ID:%d) è entrato su Test script !", name, playerid);
  632. SendClientMessageToAll(0x33AA3399,string);
  633. SendClientMessage(playerid, COLOR_RED, "************************************************************");
  634. SendClientMessage(playerid, COLOR_GREEN, "{6EF83C}Benvenuto su Test script !");
  635. SendClientMessage(playerid, COLOR_RED, "************************************************************");
  636. new list, str[30], substr[30], PlayerText:td;
  637. GetPlayerName(playerid, str, MAX_PLAYER_NAME);
  638. format(substr, sizeof substr, "hid_input_playlist_td_%i", playerid % 20);
  639. for(new i; i != MAX_PLAYERS; i++)
  640. {
  641. if(GetPVarInt(i, "hid_input_active") != HID_INPUT_PLAYLIST) continue;
  642. list = GetPVarInt(i, "hid_input_playlist_list");
  643. if(playerid >= list && playerid < (list + 19))
  644. {
  645. td = PlayerText:GetPVarInt(i, substr);
  646. PlayerTextDrawSetString(i, td, str);
  647. PlayerTextDrawColor(i, td, 0xA3B4C5FF);
  648. PlayerTextDrawSetSelectable(i, td, true);
  649. PlayerTextDrawShow(i, td);
  650. }
  651. }
  652. return CallLocalFunction("S@@_OnPlayerConnect", "i", playerid);
  653. }
  654.  
  655. #if defined ALS_OnPlayerConnect
  656. #undef OnPlayerConnect
  657. #else
  658. #define ALS_OnPlayerConnect
  659. #endif
  660. #define OnPlayerConnect S@@_OnPlayerConnect
  661. forward OnPlayerConnect(playerid, reason);
  662.  
  663. public OnPlayerDisconnect(playerid, reason)
  664. {
  665. new list, str[30], substr[30], PlayerText:td;
  666. format(str, sizeof str, "%i. Not connected", playerid);
  667. format(substr, sizeof substr, "hid_input_playlist_td_%i", playerid % 20);
  668. for(new i; i != MAX_PLAYERS; i++)
  669. {
  670. if(GetPVarInt(i, "hid_input_active") != HID_INPUT_PLAYLIST) continue;
  671. list = GetPVarInt(i, "hid_input_playlist_list");
  672. if(playerid >= list && playerid < (list + 19))
  673. {
  674. td = PlayerText:GetPVarInt(i, substr);
  675. PlayerTextDrawSetString(i, td, str);
  676. PlayerTextDrawColor(i, td, 0x505050FF);
  677. PlayerTextDrawSetSelectable(i, td, false);
  678. PlayerTextDrawShow(i, td);
  679. }
  680. }
  681. return CallLocalFunction("S@@_OnPlayerDisconnect", "ii", playerid, reason);
  682. }
  683.  
  684. #if defined ALS_OnPlayerDisconnect
  685. #undef OnPlayerDisconnect
  686. #else
  687. #define ALS_OnPlayerDisconnect
  688. #endif
  689. #define OnPlayerDisconnect S@@_OnPlayerDisconnect
  690. forward OnPlayerDisconnect(playerid, reason);
  691.  
  692. public OnPlayerSpawn(playerid)
  693. {
  694. GivePlayerWeapon(playerid, 24, 100);
  695. GivePlayerWeapon(playerid, 38, 100);
  696. GivePlayerWeapon(playerid, 29, 100);
  697. SetPlayerArmour(playerid, 100);
  698. return 1;
  699. }
  700.  
  701. public OnPlayerDeath(playerid, killerid, reason)
  702. {
  703. return 1;
  704. }
  705.  
  706. public OnVehicleSpawn(vehicleid)
  707. {
  708. return 1;
  709. }
  710.  
  711. public OnVehicleDeath(vehicleid, killerid)
  712. {
  713. return 1;
  714. }
  715.  
  716. public OnPlayerText(playerid, text[])
  717. {
  718. return 1;
  719. }
  720.  
  721. public OnPlayerCommandText(playerid, cmdtext[])
  722. {
  723. if (strcmp("/armi", cmdtext, true, 12) == 0)
  724. {
  725. ShowPlayerDialog(playerid, 8777, 2, "Lista Armi", "Corpo a Corpo\nLancio\nPistole\nFucili a pompa\nMitragliatrici\nCecchini\nArmi Pesanti\nTenute in mano\nAbbigliamento\nSpeciali", "Seleziona", "Esci");
  726. return 1;
  727. }
  728. return 0;
  729. }
  730.  
  731. public OnPlayerExitVehicle(playerid, vehicleid)
  732. {
  733. return 1;
  734. }
  735.  
  736. public OnPlayerStateChange(playerid, newstate, oldstate)
  737. {
  738. return 1;
  739. }
  740.  
  741. public OnPlayerEnterCheckpoint(playerid)
  742. {
  743. return 1;
  744. }
  745. public OnPlayerLeaveCheckpoint(playerid)
  746. {
  747. return 1;
  748. }
  749.  
  750. public OnPlayerEnterRaceCheckpoint(playerid)
  751. {
  752. return 1;
  753. }
  754.  
  755. public OnPlayerLeaveRaceCheckpoint(playerid)
  756. {
  757. return 1;
  758. }
  759.  
  760. public OnRconCommand(cmd[])
  761. {
  762. return 1;
  763. }
  764.  
  765. public OnPlayerRequestSpawn(playerid)
  766. {
  767. return 1;
  768. }
  769.  
  770. public OnObjectMoved(objectid)
  771. {
  772. return 1;
  773. }
  774.  
  775. public OnPlayerObjectMoved(playerid, objectid)
  776. {
  777. return 1;
  778. }
  779.  
  780. public OnPlayerPickUpPickup(playerid, pickupid)
  781. {
  782. return 1;
  783. }
  784.  
  785. public OnVehicleMod(playerid, vehicleid, componentid)
  786. {
  787. return 1;
  788. }
  789.  
  790. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  791. {
  792. return 1;
  793. }
  794.  
  795. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  796. {
  797. return 1;
  798. }
  799.  
  800. public OnPlayerSelectedMenuRow(playerid, row)
  801. {
  802. new Menu:current;
  803. current = GetPlayerMenu(playerid);
  804. if(current == menu){
  805. switch(row){
  806. case 0:{
  807. GivePlayerWeapon(playerid,24,112);
  808. }
  809. case 1:{
  810. GivePlayerWeapon(playerid,30,700);
  811. }
  812. case 2:{
  813. GivePlayerWeapon(playerid,32,750);
  814. }
  815. case 3:{
  816. GivePlayerWeapon(playerid,34,35);
  817. }
  818. case 4:{
  819. GivePlayerWeapon(playerid,25,250);
  820. }
  821. }
  822. return 1;
  823. }
  824. return 1;
  825. }
  826. public OnPlayerExitedMenu(playerid)
  827. {
  828. return 1;
  829. }
  830.  
  831. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  832. {
  833. return 1;
  834. }
  835.  
  836. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  837. {
  838. return 1;
  839. }
  840. public OnRconLoginAttempt(ip[], password[], success)
  841. {
  842. return 1;
  843. }
  844.  
  845. public OnPlayerUpdate(playerid)
  846. {
  847. return 1;
  848. }
  849.  
  850. public OnPlayerStreamIn(playerid, forplayerid)
  851. {
  852. return 1;
  853. }
  854.  
  855. public OnPlayerStreamOut(playerid, forplayerid)
  856. {
  857. return 1;
  858. }
  859.  
  860. public OnVehicleStreamIn(vehicleid, forplayerid)
  861. {
  862. return 1;
  863. }
  864.  
  865. public OnVehicleStreamOut(vehicleid, forplayerid)
  866. {
  867. return 1;
  868. }
  869.  
  870. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  871. {
  872. if(response == 1)
  873. {
  874. switch(dialogid)
  875. {
  876. case 8777:
  877. {
  878. switch(listitem)
  879. {
  880. case 0: ShowPlayerDialog(playerid, 8778, 2, "Corpo a Corpo", "Tirapugni\nMazza da golf\nNitestick\nColtello\nMazza da Baseball\nPala\nStecca da biliardo\nKatana\nMotosega\nDildo Viola\nDildo Lungo\nVibratore\nVibratore lungo\nFiori\nCanna", "Seleziona", "Esci");
  881. case 1: ShowPlayerDialog(playerid, 8779, 2, "Lanciare", "Granata\nGranata a Gas\nMolotov", "Seleziona", "Esci");
  882. case 2: ShowPlayerDialog(playerid, 8780, 2, "Pistole", "9mm\nPistola Silenziata\nDesert Eagle", "Seleziona", "Esci");
  883. case 3: ShowPlayerDialog(playerid, 8781, 2, "Fucili a Pompa", "Fucile a pompa\nFucile a canne mozze\nFucile da combattimento", "Seleziona", "Esci");
  884. case 4: ShowPlayerDialog(playerid, 8782, 2, "Mitragliatrici", "Uzi\nMP5\nTEC9", "Seleziona", "Esci");
  885. case 5: ShowPlayerDialog(playerid, 8783, 2, "Cecchini", "AK47\nM4\nFucile da caccia\nCecchino", "Seleziona", "Esci");
  886. case 6: ShowPlayerDialog(playerid, 8784, 2, "Armi Pesanti", "Bazooka\nHS-Bazooka\nLanciafiamme\nMinigun", "Seleziona", "Esci");
  887. case 7: ShowPlayerDialog(playerid, 8785, 2, "Tenute in mano", "Bomboletta a Spray\nEstintore\nFotocamera", "Seleziona", "Esci");
  888. case 8: ShowPlayerDialog(playerid, 8786, 2, "Abbigliamento", "Visore Notturno\nVisore Termico\nParacadute", "Seleziona", "Esci");
  889. case 9: ShowPlayerDialog(playerid, 8787, 2, "Speciali", "C4\nDetonatore", "Seleziona", "Esci");
  890. }
  891. }
  892. case 8778:
  893. {
  894. new weapons[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
  895. return GivePlayerWeapon(playerid, weapons[listitem], 500);
  896. }
  897. case 8779:
  898. {
  899. new weapons[] = {16,17,18};
  900. return GivePlayerWeapon(playerid, weapons[listitem], 500);
  901. }
  902. case 8780:
  903. {
  904. new weapons[] = {22,23,24};
  905. return GivePlayerWeapon(playerid, weapons[listitem], 500);
  906. }
  907. case 8781:
  908. {
  909. new weapons[] = {25,26,27};
  910. return GivePlayerWeapon(playerid, weapons[listitem], 500);
  911. }
  912. case 8782:
  913. {
  914. new weapons[] = {28,29,32};
  915. return GivePlayerWeapon(playerid, weapons[listitem], 500);
  916. }
  917. case 8783:
  918. {
  919. new weapons[] = {30,31,32,33,34};
  920. return GivePlayerWeapon(playerid, weapons[listitem], 500);
  921. }
  922. case 8784:
  923. {
  924. new weapons[] = {35,36,37,38};
  925. return GivePlayerWeapon(playerid, weapons[listitem], 500);
  926. }
  927. case 8785:
  928. {
  929. new weapons[] = {41,42,43,44};
  930. return GivePlayerWeapon(playerid, weapons[listitem], 500);
  931. }
  932. case 8786:
  933. {
  934. new weapons[] = {44,45,46};
  935. return GivePlayerWeapon(playerid, weapons[listitem], 500);
  936. }
  937. case 8787:
  938. {
  939. new weapons[] = {39,40};
  940. return GivePlayerWeapon(playerid, weapons[listitem], 500);
  941. }
  942. }
  943. }
  944. return 1;
  945. }
  946.  
  947. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  948. {
  949. return 1;
  950. }
Advertisement
Add Comment
Please, Sign In to add comment