osearch.pwn 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. #define MAX_SEARCH_OBJECT 200
  2. #define MAX_OS_PAGE 20
  3. #define OS_MIN_ZOOM_CONSTRAINT 2.0
  4. #define OS_MAX_ZOOM_CONSTRAINT 0.5
  5. static Text:RotXLeft;
  6. static Text:RotYLeft;
  7. static Text:RotZLeft;
  8. static Text:ZoomLeft;
  9. static Text:RotXRight;
  10. static Text:RotYRight;
  11. static Text:RotZRight;
  12. static Text:ZoomRight;
  13. static Text:PageLeft;
  14. static Text:PageRight;
  15. static Text:Click_OS_Create;
  16. static Text:OS_Background_0;
  17. static Text:OS_Background_1;
  18. static Text:OS_Background_2;
  19. static Text:OS_Background_3;
  20. static Text:OSearch_HighLight[MAX_OS_PAGE];
  21. static PlayerText:SearchDisplayModel[MAX_PLAYERS];
  22. static PlayerText:OSearchIndex[MAX_PLAYERS][MAX_OS_PAGE];
  23. enum SEARCHINFO
  24. {
  25. SearchModel,
  26. SearchName[50],
  27. }
  28. static SearchObjects[MAX_PLAYERS][MAX_SEARCH_OBJECT][SEARCHINFO];
  29. static TotalObjectFound[MAX_PLAYERS];
  30. static CurrObjectPage[MAX_PLAYERS];
  31. static CurrOSHighlight[MAX_PLAYERS];
  32. static Float:CurrOSXRot[MAX_PLAYERS] = { -20.0, ... };
  33. static Float:CurrOSYRot[MAX_PLAYERS] = { 0.0, ... };
  34. static Float:CurrOSZRot[MAX_PLAYERS] = { -50.0, ... };
  35. static Float:CurrOSZoom[MAX_PLAYERS] = { 1.0, ... };
  36. enum {
  37. //==, !=, >, <, >=, <=
  38. OPER_EQUAL,
  39. OPER_NOT_EQUAL,
  40. OPER_MORE,
  41. OPER_LESS,
  42. OPER_MORE_EQUAL,
  43. OPER_LESS_EQUAL,
  44. //+, -, *, /, %
  45. OPER_PLUS,
  46. OPER_MINUS,
  47. OPER_MULT,
  48. OPER_DIV,
  49. OPER_MOD,
  50. //!, &&, ||
  51. OPER_NOT,
  52. OPER_AND,
  53. OPER_OR,
  54. //(, )
  55. OPER_OPEN,
  56. OPER_CLOSE,
  57. NUMERIC
  58. }
  59. static Operators[16][3] = {
  60. "==", "!=", ">", "<", ">=", "<=",
  61. "+", "-", "*", "/", "%",
  62. "!", "&&", "||",
  63. "(", ")"
  64. };
  65. public OnFilterScriptInit()
  66. {
  67. CreateSearchDraws();
  68. foreach(new i : Player)
  69. {
  70. CreatePlayerSearchDraw(i);
  71. }
  72. #if defined OS_OnFilterScriptInit
  73. OS_OnFilterScriptInit();
  74. #endif
  75. return 1;
  76. }
  77. #if defined _ALS_OnFilterScriptInit
  78. #undef OnFilterScriptInit
  79. #else
  80. #define _ALS_OnFilterScriptInit
  81. #endif
  82. #define OnFilterScriptInit OS_OnFilterScriptInit
  83. #if defined OS_OnFilterScriptInit
  84. forward OS_OnFilterScriptInit();
  85. #endif
  86. public OnFilterScriptExit()
  87. {
  88. DestroySearchDraws();
  89. foreach(new i : Player)
  90. {
  91. DestroyPlayerSearchDraw(i);
  92. }
  93. #if defined OS_OnFilterScriptExit
  94. OS_OnFilterScriptExit();
  95. #endif
  96. return 1;
  97. }
  98. #if defined _ALS_OnFilterScriptExit
  99. #undef OnFilterScriptExit
  100. #else
  101. #define _ALS_OnFilterScriptExit
  102. #endif
  103. #define OnFilterScriptExit OS_OnFilterScriptExit
  104. #if defined OS_OnFilterScriptExit
  105. forward OS_OnFilterScriptExit();
  106. #endif
  107. public OnPlayerConnect(playerid)
  108. {
  109. CreatePlayerSearchDraw(playerid);
  110. CurrOSXRot[playerid] = -20.0;
  111. CurrOSYRot[playerid] = 0.0;
  112. CurrOSZRot[playerid] = -50.0;
  113. CurrOSZoom[playerid] = 1.0;
  114. #if defined OS_OnPlayerConnect
  115. OS_OnPlayerConnect(playerid);
  116. #endif
  117. return 1;
  118. }
  119. #if defined _ALS_OnPlayerConnect
  120. #undef OnPlayerConnect
  121. #else
  122. #define _ALS_OnPlayerConnect
  123. #endif
  124. #define OnPlayerConnect OS_OnPlayerConnect
  125. #if defined OS_OnPlayerConnect
  126. forward OS_OnPlayerConnect(playerid);
  127. #endif
  128. // Search for object names
  129. YCMD:osearch(playerid, arg[], help)
  130. {
  131. if(help)
  132. {
  133. SendClientMessage(playerid, STEALTH_ORANGE, "______________________________________________");
  134. SendClientMessage(playerid, STEALTH_GREEN, "Search for an object model by keyword.");
  135. return 1;
  136. }
  137. if(GetEditMode(playerid) != EDIT_MODE_OSEARCH) NoEditingMode(playerid);
  138. MapOpenCheck();
  139. for(new i = 0; i < MAX_SEARCH_OBJECT; i++) SearchObjects[playerid][i][SearchModel] = -1;
  140. new line[128];
  141. new totalobjectsfound;
  142. for(new i; i < sizeof(ObjectList); i++)
  143. {
  144. if(strfind(ObjectList[i][oName],arg, true) != -1)
  145. {
  146. if(totalobjectsfound == 0) SendClientMessage(playerid, STEALTH_ORANGE, "______________________________________________");
  147. format(line, sizeof(line), "Object Name: %s Model ID: %i", ObjectList[i][oName],ObjectList[i][oID]);
  148. SendClientMessage(playerid, STEALTH_GREEN, line);
  149. SearchObjects[playerid][totalobjectsfound][SearchModel] = ObjectList[i][oID];
  150. format(SearchObjects[playerid][totalobjectsfound][SearchName], 50, "%s", ObjectList[i][oName]);
  151. totalobjectsfound++;
  152. }
  153. if(totalobjectsfound == MAX_SEARCH_OBJECT)
  154. {
  155. SendClientMessage(playerid, STEALTH_YELLOW, "Maximum amount of objects found!");
  156. break;
  157. }
  158. }
  159. if(!totalobjectsfound)
  160. {
  161. SendClientMessage(playerid, STEALTH_ORANGE, "______________________________________________");
  162. SendClientMessage(playerid, STEALTH_YELLOW, "No objects found try searching again");
  163. }
  164. else
  165. {
  166. format(line, sizeof(line), "Total Objects Found: %i", totalobjectsfound);
  167. TotalObjectFound[playerid] = totalobjectsfound;
  168. ShowObjectList(playerid);
  169. SendClientMessage(playerid, STEALTH_ORANGE, "______________________________________________");
  170. SendClientMessage(playerid, STEALTH_GREEN, line);
  171. }
  172. return 1;
  173. }
  174. // Search for objects with expression
  175. YCMD:osearchex(playerid, arg[], help)
  176. {
  177. if(help)
  178. {
  179. SendClientMessage(playerid, STEALTH_ORANGE, "______________________________________________");
  180. SendClientMessage(playerid, STEALTH_GREEN, "Search for an object model by expression.");
  181. return 1;
  182. }
  183. if(GetEditMode(playerid) != EDIT_MODE_OSEARCH) NoEditingMode(playerid);
  184. MapOpenCheck();
  185. new out[64][24], type[64] = {-1, ...}, count = strexplode(out, arg, " ");
  186. for(new i = 0; i < MAX_SEARCH_OBJECT; i++) SearchObjects[playerid][i][SearchModel] = -1;
  187. new line[128];
  188. new totalobjectsfound, index;
  189. for(new c; c < count; c++) {
  190. if(!strcmp(out[c], "X", true)) {
  191. type[c] = NUMERIC;
  192. continue;
  193. }
  194. if(!strcmp(out[c], "Y", true)) {
  195. type[c] = NUMERIC;
  196. continue;
  197. }
  198. if(!strcmp(out[c], "Z", true)) {
  199. type[c] = NUMERIC;
  200. continue;
  201. }
  202. for(new i; i < sizeof Operators; i++) {
  203. if(!strcmp(out[c], Operators[i])) {
  204. type[c] = i;
  205. break;
  206. }
  207. }
  208. if(type[c] == -1 && isnumeric_f(out[c])) {
  209. type[c] = NUMERIC;
  210. }
  211. }
  212. new str[128];
  213. strcat(str, "SELECT `Model` FROM `AABB` WHERE (");
  214. for(new c; c < count; c++) {
  215. if(out[c][0] == 'X')
  216. format(out[c], sizeof out[], "(MaxX - MinX)");
  217. else if(out[c][0] == 'Y')
  218. format(out[c], sizeof out[], "(MaxY - MinY)");
  219. else if(out[c][0] == 'Z')
  220. format(out[c], sizeof out[], "(MaxZ - MinZ)");
  221. else switch(type[c]) {
  222. case OPER_AND:
  223. format(out[c], sizeof out[], " AND ");
  224. case OPER_OR:
  225. format(out[c], sizeof out[], " OR ");
  226. case OPER_NOT:
  227. format(out[c], sizeof out[], " NOT ");
  228. }
  229. strcat(str, out[c]);
  230. }
  231. strcat(str, ")");
  232. MS_RESULT = db_query(MS_DB, str);
  233. totalobjectsfound = db_num_rows(MS_RESULT);
  234. if(totalobjectsfound) {
  235. do
  236. {
  237. new model = db_get_field_int(MS_RESULT, 0), i = -1;
  238. for(new l; l < sizeof(ObjectList); l++) {
  239. if(ObjectList[l][oID] == model) {
  240. i = l;
  241. break;
  242. }
  243. }
  244. if(i == -1) // Invalid Model
  245. continue;
  246. if(index == 0) SendClientMessage(playerid, STEALTH_ORANGE, "______________________________________________");
  247. format(line, sizeof(line), "Object Name: %s Model ID: %i", ObjectList[i][oName],ObjectList[i][oID]);
  248. SendClientMessage(playerid, STEALTH_GREEN, line);
  249. SearchObjects[playerid][index][SearchModel] = ObjectList[i][oID];
  250. format(SearchObjects[playerid][index][SearchName], 50, "%s", ObjectList[i][oName]);
  251. index++;
  252. if(index == MAX_SEARCH_OBJECT)
  253. {
  254. SendClientMessage(playerid, STEALTH_YELLOW, "Maximum amount of objects found!");
  255. break;
  256. }
  257. }
  258. while(db_next_row(MS_RESULT));
  259. format(line, sizeof(line), "Total Objects Found: %i", totalobjectsfound);
  260. TotalObjectFound[playerid] = totalobjectsfound;
  261. ShowObjectList(playerid);
  262. SendClientMessage(playerid, STEALTH_ORANGE, "______________________________________________");
  263. SendClientMessage(playerid, STEALTH_GREEN, line);
  264. }
  265. else {
  266. SendClientMessage(playerid, STEALTH_ORANGE, "______________________________________________");
  267. SendClientMessage(playerid, STEALTH_YELLOW, "No objects found try searching again");
  268. }
  269. db_free_result(MS_RESULT);
  270. return 1;
  271. }
  272. ClickTextDrawOSearch(playerid, Text:clickedid)
  273. {
  274. if (Text:INVALID_TEXT_DRAW == clickedid)
  275. {
  276. // Textdraws are now closed
  277. ToggleTextDrawOpen(playerid, false);
  278. // Player is not in text editing mode anymore
  279. SetCurrTextDraw(playerid, TEXTDRAW_NONE);
  280. // Hide the text editor
  281. HidePlayerOSDraws(playerid);
  282. // Cancel textdraw select
  283. CancelSelectTextDraw(playerid);
  284. // Editing mode off
  285. EditingMode[playerid] = false;
  286. // Click finished processing
  287. SetEditMode(playerid, EDIT_MODE_NONE);
  288. // Unpause
  289. SetTimerEx("PlayerSetGUIPaused", 300, false, "ii", playerid, 0);
  290. return 1;
  291. }
  292. // Rotate XLeft
  293. else if(RotXLeft == clickedid)
  294. {
  295. CurrOSXRot[playerid] -= 10.0;
  296. if(CurrOSXRot[playerid] < 0.0) CurrOSXRot[playerid] = 350.0;
  297. UpdateOSPreview(playerid);
  298. }
  299. else if(RotYLeft == clickedid)
  300. {
  301. CurrOSYRot[playerid] -= 10.0;
  302. if(CurrOSYRot[playerid] < 0.0) CurrOSYRot[playerid] = 350.0;
  303. UpdateOSPreview(playerid);
  304. }
  305. else if(RotZLeft == clickedid)
  306. {
  307. CurrOSZRot[playerid] -= 10.0;
  308. if(CurrOSZRot[playerid] < 0.0) CurrOSZRot[playerid] = 350.0;
  309. UpdateOSPreview(playerid);
  310. }
  311. else if(RotXRight == clickedid)
  312. {
  313. CurrOSXRot[playerid] += 10.0;
  314. if(CurrOSXRot[playerid] > 359.0) CurrOSXRot[playerid] = 0.0;
  315. UpdateOSPreview(playerid);
  316. }
  317. else if(RotYRight == clickedid)
  318. {
  319. CurrOSYRot[playerid] += 10.0;
  320. if(CurrOSYRot[playerid] > 359.0) CurrOSYRot[playerid] = 0.0;
  321. UpdateOSPreview(playerid);
  322. }
  323. else if(RotZRight == clickedid)
  324. {
  325. CurrOSZRot[playerid] += 10.0;
  326. if(CurrOSZRot[playerid] > 359.0) CurrOSZRot[playerid] = 0.0;
  327. UpdateOSPreview(playerid);
  328. }
  329. else if(ZoomLeft == clickedid)
  330. {
  331. if(CurrOSZoom[playerid] > OS_MIN_ZOOM_CONSTRAINT) return 1;
  332. CurrOSZoom[playerid] += 0.1;
  333. UpdateOSPreview(playerid);
  334. }
  335. else if(ZoomRight == clickedid)
  336. {
  337. if(CurrOSZoom[playerid] < OS_MAX_ZOOM_CONSTRAINT) return 1;
  338. CurrOSZoom[playerid] -= 0.1;
  339. UpdateOSPreview(playerid);
  340. }
  341. // Scroll object page left
  342. else if(PageLeft == clickedid)
  343. {
  344. if(CurrObjectPage[playerid] == 0) CurrObjectPage[playerid] = (MAX_SEARCH_OBJECT / MAX_OS_PAGE) - 1;
  345. else CurrObjectPage[playerid]--;
  346. UpdateOSearchPage(playerid);
  347. }
  348. // Scroll object page right
  349. else if(PageRight == clickedid)
  350. {
  351. if(CurrObjectPage[playerid] == (MAX_SEARCH_OBJECT / MAX_OS_PAGE) - 1) CurrObjectPage[playerid] = 0;
  352. else CurrObjectPage[playerid]++;
  353. UpdateOSearchPage(playerid);
  354. }
  355. else if(Click_OS_Create == clickedid)
  356. {
  357. new index = (CurrObjectPage[playerid]*MAX_OS_PAGE) + CurrOSHighlight[playerid];
  358. if(SearchObjects[playerid][index][SearchModel] > -1)
  359. {
  360. new line[128];
  361. format(line, sizeof(line), "/cobject %i", SearchObjects[playerid][index][SearchModel]);
  362. EditingMode[playerid] = false;
  363. BroadcastCommand(playerid,line);
  364. EditingMode[playerid] = true;
  365. }
  366. }
  367. return 0;
  368. }
  369. ClickPlayerTextDrawOSearch(playerid, PlayerText:clickedid)
  370. {
  371. for(new i = 0; i < MAX_OS_PAGE; i++)
  372. {
  373. if(clickedid == OSearchIndex[playerid][i])
  374. {
  375. CurrOSHighlight[playerid] = i;
  376. UpdateOSHighLight(playerid);
  377. UpdateOSPreview(playerid);
  378. return 1;
  379. }
  380. }
  381. return 0;
  382. }
  383. static ShowObjectList(playerid)
  384. {
  385. ShowPlayerOSDraws(playerid);
  386. UpdateOSearchPage(playerid);
  387. SetCurrTextDraw(playerid, TEXTDRAW_OSEARCH);
  388. ToggleTextDrawOpen(playerid, true);
  389. SetEditMode(playerid, EDIT_MODE_OSEARCH);
  390. EditingMode[playerid] = true;
  391. CurrObjectPage[playerid] = 0;
  392. CurrOSHighlight[playerid] = 0;
  393. UpdateOSHighLight(playerid);
  394. SelectTextDraw(playerid, 0xD9D919FF);
  395. return 1;
  396. }
  397. static UpdateOSHighLight(playerid)
  398. {
  399. for(new i = 0; i < MAX_OS_PAGE; i++) TextDrawHideForPlayer(playerid, OSearch_HighLight[i]);
  400. TextDrawShowForPlayer(playerid, OSearch_HighLight[CurrOSHighlight[playerid]]);
  401. UpdateOSPreview(playerid);
  402. return 1;
  403. }
  404. static UpdateOSPreview(playerid)
  405. {
  406. new offset = CurrObjectPage[playerid]*MAX_OS_PAGE;
  407. PlayerTextDrawHide(playerid, SearchDisplayModel[playerid]);
  408. PlayerTextDrawSetPreviewModel(playerid, SearchDisplayModel[playerid], SearchObjects[playerid][CurrOSHighlight[playerid]+offset][SearchModel]);
  409. PlayerTextDrawSetPreviewRot(playerid, SearchDisplayModel[playerid], CurrOSXRot[playerid], CurrOSYRot[playerid], CurrOSZRot[playerid], CurrOSZoom[playerid]);
  410. PlayerTextDrawShow(playerid, SearchDisplayModel[playerid]);
  411. return 1;
  412. }
  413. static UpdateOSearchPage(playerid)
  414. {
  415. new line[128];
  416. new offset = CurrObjectPage[playerid]*MAX_OS_PAGE;
  417. for(new i = 0; i < MAX_OS_PAGE; i++)
  418. {
  419. if(SearchObjects[playerid][i+offset][SearchModel] > -1)
  420. {
  421. format(line, sizeof(line), "~r~ID:~g~ %i ~r~Name:~g~ %s",
  422. SearchObjects[playerid][i+offset][SearchModel],
  423. SearchObjects[playerid][i+offset][SearchName]
  424. );
  425. PlayerTextDrawSetString(playerid, OSearchIndex[playerid][i], line);
  426. }
  427. else PlayerTextDrawSetString(playerid, OSearchIndex[playerid][i], "~r~ID:~g~ -1 ~r~Name:~g~ None");
  428. }
  429. UpdateOSPreview(playerid);
  430. return 1;
  431. }
  432. static CreateSearchDraws()
  433. {
  434. RotXLeft = TextDrawCreate(150.000000, 320.000000, "LD_BEAT:left");
  435. TextDrawBackgroundColor(RotXLeft, 255);
  436. TextDrawFont(RotXLeft, 4);
  437. TextDrawLetterSize(RotXLeft, 0.500000, 1.000000);
  438. TextDrawColor(RotXLeft, 16777215);
  439. TextDrawSetOutline(RotXLeft, 0);
  440. TextDrawSetProportional(RotXLeft, 1);
  441. TextDrawSetShadow(RotXLeft, 1);
  442. TextDrawUseBox(RotXLeft, 1);
  443. TextDrawBoxColor(RotXLeft, 16777215);
  444. TextDrawTextSize(RotXLeft, 20.000000, 20.000000);
  445. TextDrawSetSelectable(RotXLeft, 1);
  446. RotYLeft = TextDrawCreate(150.000000, 340.000000, "LD_BEAT:left");
  447. TextDrawBackgroundColor(RotYLeft, 255);
  448. TextDrawFont(RotYLeft, 4);
  449. TextDrawLetterSize(RotYLeft, 0.500000, 1.000000);
  450. TextDrawColor(RotYLeft, 16777215);
  451. TextDrawSetOutline(RotYLeft, 0);
  452. TextDrawSetProportional(RotYLeft, 1);
  453. TextDrawSetShadow(RotYLeft, 1);
  454. TextDrawUseBox(RotYLeft, 1);
  455. TextDrawBoxColor(RotYLeft, 16777215);
  456. TextDrawTextSize(RotYLeft, 20.000000, 20.000000);
  457. TextDrawSetSelectable(RotYLeft, 1);
  458. RotZLeft = TextDrawCreate(150.000000, 360.000000, "LD_BEAT:left");
  459. TextDrawBackgroundColor(RotZLeft, 255);
  460. TextDrawFont(RotZLeft, 4);
  461. TextDrawLetterSize(RotZLeft, 0.500000, 1.000000);
  462. TextDrawColor(RotZLeft, 16777215);
  463. TextDrawSetOutline(RotZLeft, 0);
  464. TextDrawSetProportional(RotZLeft, 1);
  465. TextDrawSetShadow(RotZLeft, 1);
  466. TextDrawUseBox(RotZLeft, 1);
  467. TextDrawBoxColor(RotZLeft, 16777215);
  468. TextDrawTextSize(RotZLeft, 20.000000, 20.000000);
  469. TextDrawSetSelectable(RotZLeft, 1);
  470. ZoomLeft = TextDrawCreate(150.000000, 380.000000, "LD_BEAT:left");
  471. TextDrawBackgroundColor(ZoomLeft, 255);
  472. TextDrawFont(ZoomLeft, 4);
  473. TextDrawLetterSize(ZoomLeft, 0.500000, 1.000000);
  474. TextDrawColor(ZoomLeft, 16777215);
  475. TextDrawSetOutline(ZoomLeft, 0);
  476. TextDrawSetProportional(ZoomLeft, 1);
  477. TextDrawSetShadow(ZoomLeft, 1);
  478. TextDrawUseBox(ZoomLeft, 1);
  479. TextDrawBoxColor(ZoomLeft, 16777215);
  480. TextDrawTextSize(ZoomLeft, 20.000000, 20.000000);
  481. TextDrawSetSelectable(ZoomLeft, 1);
  482. RotXRight = TextDrawCreate(190.000000, 320.000000, "LD_BEAT:right");
  483. TextDrawBackgroundColor(RotXRight, 255);
  484. TextDrawFont(RotXRight, 4);
  485. TextDrawLetterSize(RotXRight, 0.500000, 1.000000);
  486. TextDrawColor(RotXRight, 16777215);
  487. TextDrawSetOutline(RotXRight, 0);
  488. TextDrawSetProportional(RotXRight, 1);
  489. TextDrawSetShadow(RotXRight, 1);
  490. TextDrawUseBox(RotXRight, 1);
  491. TextDrawBoxColor(RotXRight, 16777215);
  492. TextDrawTextSize(RotXRight, 20.000000, 20.000000);
  493. TextDrawSetSelectable(RotXRight, 1);
  494. RotYRight = TextDrawCreate(190.000000, 340.000000, "LD_BEAT:right");
  495. TextDrawBackgroundColor(RotYRight, 255);
  496. TextDrawFont(RotYRight, 4);
  497. TextDrawLetterSize(RotYRight, 0.500000, 1.000000);
  498. TextDrawColor(RotYRight, 16777215);
  499. TextDrawSetOutline(RotYRight, 0);
  500. TextDrawSetProportional(RotYRight, 1);
  501. TextDrawSetShadow(RotYRight, 1);
  502. TextDrawUseBox(RotYRight, 1);
  503. TextDrawBoxColor(RotYRight, 16777215);
  504. TextDrawTextSize(RotYRight, 20.000000, 20.000000);
  505. TextDrawSetSelectable(RotYRight, 1);
  506. RotZRight = TextDrawCreate(190.000000, 360.000000, "LD_BEAT:right");
  507. TextDrawBackgroundColor(RotZRight, 255);
  508. TextDrawFont(RotZRight, 4);
  509. TextDrawLetterSize(RotZRight, 0.500000, 1.000000);
  510. TextDrawColor(RotZRight, 16777215);
  511. TextDrawSetOutline(RotZRight, 0);
  512. TextDrawSetProportional(RotZRight, 1);
  513. TextDrawSetShadow(RotZRight, 1);
  514. TextDrawUseBox(RotZRight, 1);
  515. TextDrawBoxColor(RotZRight, 16777215);
  516. TextDrawTextSize(RotZRight, 20.000000, 20.000000);
  517. TextDrawSetSelectable(RotZRight, 1);
  518. ZoomRight = TextDrawCreate(190.000000, 380.000000, "LD_BEAT:right");
  519. TextDrawBackgroundColor(ZoomRight, 255);
  520. TextDrawFont(ZoomRight, 4);
  521. TextDrawLetterSize(ZoomRight, 0.500000, 1.000000);
  522. TextDrawColor(ZoomRight, 16777215);
  523. TextDrawSetOutline(ZoomRight, 0);
  524. TextDrawSetProportional(ZoomRight, 1);
  525. TextDrawSetShadow(ZoomRight, 1);
  526. TextDrawUseBox(ZoomRight, 1);
  527. TextDrawBoxColor(ZoomRight, 16777215);
  528. TextDrawTextSize(ZoomRight, 20.000000, 20.000000);
  529. TextDrawSetSelectable(ZoomRight, 1);
  530. new Float:pageoffset = 145.0 + (MAX_OS_PAGE * 10.0);
  531. PageLeft = TextDrawCreate(18.000000, pageoffset, "LD_BEAT:left");
  532. TextDrawBackgroundColor(PageLeft, 255);
  533. TextDrawFont(PageLeft, 4);
  534. TextDrawLetterSize(PageLeft, 0.500000, 1.000000);
  535. TextDrawColor(PageLeft, 16777215);
  536. TextDrawSetOutline(PageLeft, 0);
  537. TextDrawSetProportional(PageLeft, 1);
  538. TextDrawSetShadow(PageLeft, 1);
  539. TextDrawUseBox(PageLeft, 1);
  540. TextDrawBoxColor(PageLeft, 16777215);
  541. TextDrawTextSize(PageLeft, 20.000000, 20.000000);
  542. TextDrawSetSelectable(PageLeft, 1);
  543. PageRight = TextDrawCreate(68.000000, pageoffset, "LD_BEAT:right");
  544. TextDrawBackgroundColor(PageRight, 255);
  545. TextDrawFont(PageRight, 4);
  546. TextDrawLetterSize(PageRight, 0.500000, 1.000000);
  547. TextDrawColor(PageRight, 16777215);
  548. TextDrawSetOutline(PageRight, 0);
  549. TextDrawSetProportional(PageRight, 1);
  550. TextDrawSetShadow(PageRight, 1);
  551. TextDrawUseBox(PageRight, 1);
  552. TextDrawBoxColor(PageRight, 16777215);
  553. TextDrawTextSize(PageRight, 20.000000, 20.000000);
  554. TextDrawSetSelectable(PageRight, 1);
  555. OS_Background_0 = TextDrawCreate(172.000000, 324.000000, "RotX");
  556. TextDrawBackgroundColor(OS_Background_0, 255);
  557. TextDrawFont(OS_Background_0, 1);
  558. TextDrawLetterSize(OS_Background_0, 0.200000, 1.000000);
  559. TextDrawColor(OS_Background_0, -1);
  560. TextDrawSetOutline(OS_Background_0, 1);
  561. TextDrawSetProportional(OS_Background_0, 1);
  562. TextDrawSetSelectable(OS_Background_0, 0);
  563. OS_Background_1 = TextDrawCreate(172.000000, 344.000000, "RotY");
  564. TextDrawBackgroundColor(OS_Background_1, 255);
  565. TextDrawFont(OS_Background_1, 1);
  566. TextDrawLetterSize(OS_Background_1, 0.200000, 1.000000);
  567. TextDrawColor(OS_Background_1, -1);
  568. TextDrawSetOutline(OS_Background_1, 1);
  569. TextDrawSetProportional(OS_Background_1, 1);
  570. TextDrawSetSelectable(OS_Background_1, 0);
  571. OS_Background_2 = TextDrawCreate(172.000000, 364.000000, "RotZ");
  572. TextDrawBackgroundColor(OS_Background_2, 255);
  573. TextDrawFont(OS_Background_2, 1);
  574. TextDrawLetterSize(OS_Background_2, 0.200000, 1.000000);
  575. TextDrawColor(OS_Background_2, -1);
  576. TextDrawSetOutline(OS_Background_2, 1);
  577. TextDrawSetProportional(OS_Background_2, 1);
  578. TextDrawSetSelectable(OS_Background_2, 0);
  579. OS_Background_3 = TextDrawCreate(170.000000, 384.000000, "Zoom");
  580. TextDrawBackgroundColor(OS_Background_3, 255);
  581. TextDrawFont(OS_Background_3, 1);
  582. TextDrawLetterSize(OS_Background_3, 0.200000, 1.000000);
  583. TextDrawColor(OS_Background_3, -1);
  584. TextDrawSetOutline(OS_Background_3, 1);
  585. TextDrawSetProportional(OS_Background_3, 1);
  586. TextDrawSetSelectable(OS_Background_3, 0);
  587. Click_OS_Create = TextDrawCreate(158.000000, 400.000000, "Create");
  588. TextDrawBackgroundColor(Click_OS_Create, 255);
  589. TextDrawFont(Click_OS_Create, 1);
  590. TextDrawLetterSize(Click_OS_Create, 0.400000, 2.000000);
  591. TextDrawColor(Click_OS_Create, -65281);
  592. TextDrawSetOutline(Click_OS_Create, 1);
  593. TextDrawSetProportional(Click_OS_Create, 1);
  594. TextDrawUseBox(Click_OS_Create, 1);
  595. TextDrawBoxColor(Click_OS_Create, 0);
  596. TextDrawTextSize(Click_OS_Create, 200.000000, 12.000000);
  597. TextDrawSetSelectable(Click_OS_Create, 1);
  598. new Float:y = 130.0;
  599. for(new i = 0; i < MAX_OS_PAGE; i++)
  600. {
  601. OSearch_HighLight[i] = TextDrawCreate(18.000000, y, "_");
  602. TextDrawBackgroundColor(OSearch_HighLight[i], 255);
  603. TextDrawFont(OSearch_HighLight[i], 1);
  604. TextDrawLetterSize(OSearch_HighLight[i], 0.500000, 1.000000);
  605. TextDrawColor(OSearch_HighLight[i], -1);
  606. TextDrawSetOutline(OSearch_HighLight[i], 0);
  607. TextDrawSetProportional(OSearch_HighLight[i], 1);
  608. TextDrawSetShadow(OSearch_HighLight[i], 1);
  609. TextDrawUseBox(OSearch_HighLight[i], 1);
  610. TextDrawBoxColor(OSearch_HighLight[i], 16711730);
  611. TextDrawTextSize(OSearch_HighLight[i], 150.000000, 0.000000);
  612. TextDrawSetSelectable(OSearch_HighLight[i], 0);
  613. y += 10.0;
  614. }
  615. return 1;
  616. }
  617. static DestroySearchDraws()
  618. {
  619. TextDrawDestroy(RotXLeft);
  620. TextDrawDestroy(RotYLeft);
  621. TextDrawDestroy(RotZLeft);
  622. TextDrawDestroy(ZoomLeft);
  623. TextDrawDestroy(RotXRight);
  624. TextDrawDestroy(RotYRight);
  625. TextDrawDestroy(RotZRight);
  626. TextDrawDestroy(ZoomRight);
  627. TextDrawDestroy(PageLeft);
  628. TextDrawDestroy(PageRight);
  629. TextDrawDestroy(OS_Background_0);
  630. TextDrawDestroy(OS_Background_1);
  631. TextDrawDestroy(OS_Background_2);
  632. TextDrawDestroy(OS_Background_3);
  633. TextDrawDestroy(Click_OS_Create);
  634. for(new i = 0; i < MAX_OS_PAGE; i++)
  635. {
  636. TextDrawDestroy(OSearch_HighLight[i]);
  637. }
  638. return 1;
  639. }
  640. static CreatePlayerSearchDraw(playerid)
  641. {
  642. new Float:y = 130.0;
  643. for(new i = 0; i < MAX_OS_PAGE; i++)
  644. {
  645. OSearchIndex[playerid][i] = CreatePlayerTextDraw(playerid,20.000000, y, "~r~ID:~g~ 1337 ~r~Name:~g~ sign_01");
  646. PlayerTextDrawBackgroundColor(playerid,OSearchIndex[playerid][i], 255);
  647. PlayerTextDrawFont(playerid,OSearchIndex[playerid][i], 1);
  648. PlayerTextDrawLetterSize(playerid,OSearchIndex[playerid][i], 0.200000, 1.000000);
  649. PlayerTextDrawColor(playerid,OSearchIndex[playerid][i], 16711935);
  650. PlayerTextDrawSetOutline(playerid,OSearchIndex[playerid][i], 1);
  651. PlayerTextDrawSetProportional(playerid,OSearchIndex[playerid][i], 1);
  652. PlayerTextDrawUseBox(playerid,OSearchIndex[playerid][i], 1);
  653. PlayerTextDrawBoxColor(playerid,OSearchIndex[playerid][i], 0);
  654. PlayerTextDrawTextSize(playerid,OSearchIndex[playerid][i], 300.000000, 10.000000);
  655. PlayerTextDrawSetSelectable(playerid,OSearchIndex[playerid][i], 1);
  656. y += 10.0;
  657. }
  658. SearchDisplayModel[playerid] = CreatePlayerTextDraw(playerid,120.000000, 127.000000, "ModelDisplay");
  659. PlayerTextDrawBackgroundColor(playerid,SearchDisplayModel[playerid], 0);
  660. PlayerTextDrawFont(playerid,SearchDisplayModel[playerid], 5);
  661. PlayerTextDrawLetterSize(playerid,SearchDisplayModel[playerid], 0.500000, 1.000000);
  662. PlayerTextDrawColor(playerid,SearchDisplayModel[playerid], -1);
  663. PlayerTextDrawSetOutline(playerid,SearchDisplayModel[playerid], 0);
  664. PlayerTextDrawSetProportional(playerid,SearchDisplayModel[playerid], 1);
  665. PlayerTextDrawSetShadow(playerid,SearchDisplayModel[playerid], 1);
  666. PlayerTextDrawUseBox(playerid,SearchDisplayModel[playerid], 1);
  667. PlayerTextDrawBoxColor(playerid,SearchDisplayModel[playerid], 0);
  668. PlayerTextDrawTextSize(playerid,SearchDisplayModel[playerid], 200.000000, 200.000000);
  669. PlayerTextDrawSetPreviewModel(playerid, SearchDisplayModel[playerid], 1337);
  670. PlayerTextDrawSetPreviewRot(playerid, SearchDisplayModel[playerid], -16.000000, 0.000000, -55.000000, 1.000000);
  671. PlayerTextDrawSetSelectable(playerid,SearchDisplayModel[playerid], 0);
  672. return 1;
  673. }
  674. static DestroyPlayerSearchDraw(playerid)
  675. {
  676. for(new i = 0; i < MAX_OS_PAGE; i++)
  677. {
  678. PlayerTextDrawDestroy(playerid, OSearchIndex[playerid][i]);
  679. }
  680. PlayerTextDrawDestroy(playerid, SearchDisplayModel[playerid]);
  681. return 1;
  682. }
  683. static ShowPlayerOSDraws(playerid)
  684. {
  685. TextDrawShowForPlayer(playerid, RotXLeft);
  686. TextDrawShowForPlayer(playerid, RotYLeft);
  687. TextDrawShowForPlayer(playerid, RotZLeft);
  688. TextDrawShowForPlayer(playerid, ZoomLeft);
  689. TextDrawShowForPlayer(playerid, RotXRight);
  690. TextDrawShowForPlayer(playerid, RotYRight);
  691. TextDrawShowForPlayer(playerid, RotZRight);
  692. TextDrawShowForPlayer(playerid, ZoomRight);
  693. TextDrawShowForPlayer(playerid, PageRight);
  694. TextDrawShowForPlayer(playerid, PageLeft);
  695. TextDrawShowForPlayer(playerid, OS_Background_0);
  696. TextDrawShowForPlayer(playerid, OS_Background_1);
  697. TextDrawShowForPlayer(playerid, OS_Background_2);
  698. TextDrawShowForPlayer(playerid, OS_Background_3);
  699. TextDrawShowForPlayer(playerid, Click_OS_Create);
  700. for(new i = 0; i < MAX_OS_PAGE; i++)
  701. {
  702. PlayerTextDrawShow(playerid, OSearchIndex[playerid][i]);
  703. }
  704. PlayerTextDrawShow(playerid, SearchDisplayModel[playerid]);
  705. }
  706. static HidePlayerOSDraws(playerid)
  707. {
  708. TextDrawHideForPlayer(playerid, RotXLeft);
  709. TextDrawHideForPlayer(playerid, RotYLeft);
  710. TextDrawHideForPlayer(playerid, RotZLeft);
  711. TextDrawHideForPlayer(playerid, ZoomLeft);
  712. TextDrawHideForPlayer(playerid, RotXRight);
  713. TextDrawHideForPlayer(playerid, RotYRight);
  714. TextDrawHideForPlayer(playerid, RotZRight);
  715. TextDrawHideForPlayer(playerid, ZoomRight);
  716. TextDrawHideForPlayer(playerid, PageRight);
  717. TextDrawHideForPlayer(playerid, PageLeft);
  718. TextDrawHideForPlayer(playerid, OS_Background_0);
  719. TextDrawHideForPlayer(playerid, OS_Background_1);
  720. TextDrawHideForPlayer(playerid, OS_Background_2);
  721. TextDrawHideForPlayer(playerid, OS_Background_3);
  722. TextDrawHideForPlayer(playerid, Click_OS_Create);
  723. for(new i = 0; i < MAX_OS_PAGE; i++)
  724. {
  725. PlayerTextDrawHide(playerid, OSearchIndex[playerid][i]);
  726. TextDrawHideForPlayer(playerid, OSearch_HighLight[i]);
  727. }
  728. PlayerTextDrawHide(playerid, SearchDisplayModel[playerid]);
  729. }
  730. tsfunc isnumeric_f(str[])
  731. {
  732. new i, ch;
  733. while ((ch = str[i++])) if (!('0' <= ch <= '9') && ch != '.') return 0;
  734. return !str[i];
  735. }