| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220 |
- /*
- SA-MP GUI by Thoth A.K.A Seif
- » Windows;
- » Text Labels;
- » Tabs;
- » Progress bars;
- » Itemlist
- » Checkbox/radio buttons
- » Buttons
- */
- #include <a_samp>
- #define function%0(%1) forward %0(%1); public %0(%1)
- #define GUI_TYPE_WINDOW (1)
- #define GUI_TYPE_TAB (2)
- #define GUI_TYPE_LABEL (3)
- #define GUI_TYPE_BAR (4)
- #define GUI_TYPE_ITEMLIST (5)
- #define GUI_TYPE_CHECKBOX (6)
- #define GUI_TYPE_BUTTON (7)
- #define UNIT 0.11 // Font size 0.11 ~= 1 unit pixel
- #define MAX_GUI (50) // Maximum GUI per player
- new textdrawVisibility[2048];
- new p_textdrawVisibility[MAX_PLAYERS][2048];
- new p_tab[MAX_PLAYERS];
- new p_row[MAX_PLAYERS];
- new pcount_i[MAX_PLAYERS];
- enum guiinfo_window
- {
- gui_win_ID,
- Float:gui_win_X,
- Float:gui_win_Y,
- Float:gui_win_SizeX,
- Float:gui_win_SizeY,
- gui_win_Title[64],
- PlayerText:gui_win_td,
- PlayerText:gui_win_tdtop,
- PlayerText:gui_win_tdtitle,
- gui_win_P,
- }
- new gui_WindowData[MAX_PLAYERS][MAX_GUI][guiinfo_window];
- enum guiinfo_label
- {
- gui_label_ID,
- gui_label_Type,
- gui_label_Window, // 0 for none, or set the window gui ID so it's part of it
- gui_label_Tab, // 0 for none, or set the tab gui ID so it's part of it. If the tab is part of a window, set the window id too!
- Float:gui_label_X, // if Window/Tab is set, this value is relative to the window's/tab's
- Float:gui_label_Y, // if Window/Tab is set, this value is relative to the window's/tab's
- Float:gui_label_Length,
- gui_label_Text[64],
- gui_label_Color,
- PlayerText:gui_label_td,
- gui_label_Lines,
- gui_label_P,
- }
- new gui_LabelData[MAX_PLAYERS][MAX_GUI][guiinfo_label];
- enum guiinfo_tab
- {
- gui_tab_ID,
- gui_tab_Type,
- gui_tab_Window, // 0 for none, or set the window gui ID so it's part of it
- Float:gui_tab_X, // if Window is set, this value is relative to the window's
- Float:gui_tab_Y, // if Window is set, this value is relative to the window's
- Float:gui_tab_plusX,
- Float:gui_tab_Height, // 0.0 will take the rest of the GUI window height IF window gui is set. This value is relative to its window parent.
- Float:gui_tab_Width, // 0.0 will take the rest of the GUI window width IF window gui is set This value is relative to its window parent.
- gui_tab_Text[64],
- PlayerText:gui_tab_td,
- PlayerText:gui_tab_td2, // active
- PlayerText:gui_tab_tdbg,
- PlayerText:gui_tab_tdbox,
- gui_tab_panel,
- Float:gui_tab_panelX,
- Float:gui_tab_panelY,
- gui_tab_P,
- }
- new gui_TabData[MAX_PLAYERS][MAX_GUI][guiinfo_tab];
- enum guiinfo_bar
- {
- gui_bar_ID,
- gui_bar_Type,
- gui_bar_Window, // 0 for none, or set the window gui ID so it's part of it
- gui_bar_Tab, // 0 for none, or set the tab gui ID so it's under it, AND set the window id of the tab.
- Float:gui_bar_X, // if Window is set, this value is relative to the window's/tab's
- Float:gui_bar_Y, // if Window is set, this value is relative to the window's/tab's
- Float:gui_bar_Height, // Sets the height of the bar.
- Float:gui_bar_Width, // Sets the weidth of the bar.
- Float:gui_bar_Progress, // The progress in percentage
- PlayerText:gui_bar_tdbg,
- PlayerText:gui_bar_tdbox,
- PlayerText:gui_bar_tdbar,
- gui_bar_bgcolor,
- gui_bar_boxcolor,
- gui_bar_barcolor,
- gui_bar_P,
- }
- new gui_BarData[MAX_PLAYERS][MAX_GUI][guiinfo_bar];
- enum guiinfo_list
- {
- gui_list_ID,
- gui_list_Type,
- gui_list_Window, // 0 for none, or set the window gui ID so it's part of it
- gui_list_Tab, // 0 for none, or set the tab gui ID so it's under it, AND set the window id of the tab.
- Float:gui_list_X, // if Window is set, this value is relative to the window's/tab's
- Float:gui_list_Y, // if Window is set, this value is relative to the window's/tab's
- Float:gui_list_Height, // Sets the height of the bar. Set to 0.0 to take up the whole window or tab panel
- Float:gui_list_Width, // Sets the weidth of the bar. Set to 0.0 to take up the whole window or tab panel
- Float:gui_list_RowX,
- Float:gui_list_RowY,
- gui_list_RowMax,
- gui_list_Title[32],
- PlayerText:gui_list_tdbox,
- PlayerText:gui_list_tdline,
- PlayerText:gui_list_tdtitle,
- gui_list_P,
- }
- new gui_ItemlistData[MAX_PLAYERS][MAX_GUI][guiinfo_list];
- enum guiinfo_row
- {
- gui_row_ID,
- gui_row_List,
- gui_row_Order, // The order number in the list. Ex. 0 = first in the list. 1 = second in the list(if there's multiple listitems)
- Float:gui_row_X,
- Float:gui_row_Y,
- Float:gui_row_Height,
- Float:gui_row_Width,
- gui_row_Text[32],
- PlayerText:gui_row_td,
- PlayerText:gui_row_td2, // active
- }
- new gui_ItemRowData[MAX_PLAYERS][MAX_GUI][guiinfo_row];
- enum guiinfo_check
- {
- gui_check_ID,
- gui_check_Type,
- gui_check_Window,
- gui_check_Tab,
- Float:gui_check_X,
- Float:gui_check_Y,
- PlayerText:gui_check_td,
- PlayerText:gui_check_td2, // active
- gui_check_P,
- }
- new gui_CheckboxData[MAX_PLAYERS][MAX_GUI][guiinfo_check];
- enum guiinfo_but
- {
- gui_but_ID,
- gui_but_Type,
- gui_but_Window, // 0 for none, or set the window gui ID so it's part of it
- gui_but_Tab, // 0 for none, or set the tab gui ID so it's under it, AND set the window id of the tab.
- Float:gui_but_X, // if Window is set, this value is relative to the window's/tab's
- Float:gui_but_Y, // if Window is set, this value is relative to the window's/tab's
- Float:gui_but_Height, // Sets the height of the bar.
- Float:gui_but_Width, // Sets the weidth of the bar.
- gui_but_Text[32],
- PlayerText:gui_but_tdbg,
- PlayerText:gui_but_tdout,
- PlayerText:gui_but_tdbox,
- PlayerText:gui_but_tdgl,
- PlayerText:gui_but_tdtxt,
- gui_but_P,
- }
- new gui_ButtonData[MAX_PLAYERS][MAX_GUI][guiinfo_but];
- forward OnPlayerClickTab(playerid, tabid);
- forward OnPlayerClickButton(playerid, buttonid);
- /*
- native guiSetVisible(playerid, type, gui, bool:toggle)
- native guiSetVisibleAll(type, gui, bool:toggle)
- native guiCreateWindow(playerid, Float:x, Float:y, Float:size_x, Float:size_y, title[])
- native guiCreateTab(playerid, windowid, Float:x, Float:y, Float:height, Float:width, text[])
- native guiCreateLabel(playerid, windowid, tabid, Float:x, Float:y, Float:length, color, font, text[])
- native guiLabelSetText(playerid, labelid, color, font, text[])
- native guiCreateProgressBar(playerid, windowid, tabid, Float:x, Float:y, Float:height, Float:width, color_bg, color_box, color_bar)
- native guiProgressBarSetProgress(playerid, barid, Float:progress)
- native Float:guiProgressBarGetProgress(playerid, barid)
- native guiCreateItemList(playerid, windowid, tabid, Float:x, Float:y, Float:height, Float:width, title[])
- native guiItemListAddRow(playerid, listid, text[])
- native guiItemListRemoveRow(playerid, listid, rowid)
- native guiItemListSetRowOrder(playerid, listid, rowid, orderid)
- native guiItemListGetSelectedRow(playerid)
- native guiItemListGetRowText(playerid, listid, rowid, string[])
- native guiItemListGetCount(playerid, listid)
- native guiItemListGetRowList(playerid, rowid)
- native guiCreateCheckBox(playerid, windowid, tabid, Float:x, Float:y)
- native guiCheckBoxGetSelected(playerid, checkboxid)
- native guiCheckBoxSetSelected(playerid, checkboxid)
- native guiGetCheckBoxPos(playerid, checkboxid, &Float:x, &Float:y)
- native guiCreateButton(playerid, windowid, tabid, Float:x, Float:y, Float:height, Float:width, text[])
- native Float:guiGetButtonHeight(playerid, buttonid)
- native Float:guiGetButtonWidth(playerid, buttonid)
- native guiGetButtonPos(playerid, buttonid, &Float:x, &Float:y)
- native guiIsVisible(playerid, type, gui)
- native guiDestroy(playerid, type, gui)
- native guiDestroyAll(playerid, type)
- */
- /*x---------------------------------CallBacks-------------------------------------x*/
- /*forward gui_OnPlayerConnect(playerid);
- public gui_OnPlayerConnect(playerid)
- {
- //CreatePlayerTextDraw(playerid, 0.0, 0.0, "_");
- //p_tab[playerid] = 0;
- //p_row[playerid] = 0;
- //return OnPlayerConnect(playerid);
- return 1;
- }
- //#define OnPlayerConnect gui_OnPlayerConnect*/
- forward gui_OnPlayerConnect(playerid);
- public gui_OnPlayerConnect(playerid)
- {
- CreatePlayerTextDraw(playerid, 0.0, 0.0, "_");
- p_tab[playerid] = 0;
- p_row[playerid] = 0;
- return OnPlayerConnect(playerid);
- }
- function PlayerTextDrawShowEx(playerid, PlayerText:textdrawid)
- {
- p_textdrawVisibility[playerid][io_PlayerText:textdrawid] = 1;
- return PlayerTextDrawShow(playerid, textdrawid);
- }
- #define PlayerTextDrawShow(%0,%1) PlayerTextDrawShowEx(%0,%1)
- function PlayerTextDrawHideEx(playerid, PlayerText:textdrawid)
- {
- p_textdrawVisibility[playerid][io_PlayerText:textdrawid] = 0;
- return PlayerTextDrawHide(playerid, textdrawid);
- }
- #define PlayerTextDrawHide(%0,%1) PlayerTextDrawHideEx(%0,%1)
- function TextDrawDestroyEx(playerid, PlayerText:textdrawid)
- {
- for(new p; p < MAX_PLAYERS; p++)
- {
- if (!IsPlayerConnected(p)) continue;
- p_textdrawVisibility[p][io_PlayerText:textdrawid] = 0;
- }
- textdrawVisibility[io_PlayerText:textdrawid] = 0;
- return PlayerTextDrawDestroy(playerid, textdrawid);
- }
- function GetTextDrawVisibilityForPlayer(playerid, PlayerText:textdrawid) return p_textdrawVisibility[playerid][io_PlayerText:textdrawid];
- function GetTextDrawVisibilityForAll(PlayerText:textdrawid) return textdrawVisibility[io_PlayerText:textdrawid];
- function guiSetVisible(playerid, type, gui, bool:toggle)
- {
- new str[32],end = 0;
- new oldw = GetPVarInt(playerid, "guisetvisible_w");
- if (toggle == true)
- {
- format(str, sizeof str, "PlayerTextDrawShowEx");
- }
- else if (toggle == false)
- {
- format(str, sizeof str, "PlayerTextDrawHideEx");
- }
- new gid = guiGetID(playerid, type, gui);
- if (gid == -1) return 0;
- //printf("ID: %d = %s", playerid, str);
-
- if (type == GUI_TYPE_WINDOW)
- {
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_WindowData[playerid][gid][gui_win_td]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_WindowData[playerid][gid][gui_win_tdtop]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_WindowData[playerid][gid][gui_win_tdtitle]);
- }
- else if (type != GUI_TYPE_TAB && type != GUI_TYPE_WINDOW) end = 1;
- new count;
- /*if (p_tab[playerid] > 0)
- {
- type = GUI_TYPE_TAB;
- gui = gui_TabData[p_tab[playerid]][gui_tab_ID];
- }*/
- for(new g; g < MAX_GUI; g++)
- {
- switch (type)
- {
- case GUI_TYPE_TAB: goto TAB;
- case GUI_TYPE_LABEL: goto LABEL;
- case GUI_TYPE_BAR: goto BAR;
- case GUI_TYPE_ITEMLIST: goto ITEMLIST;
- case GUI_TYPE_CHECKBOX: goto CHECKBOX;
- case GUI_TYPE_BUTTON: goto BUTTON;
- }
- TAB:
- if (
- gui_TabData[playerid][g][gui_tab_ID] > 0 &&
- (
- (type == GUI_TYPE_WINDOW && gui_TabData[playerid][g][gui_tab_Window] == gui) ||
- (type == gui_TabData[playerid][g][gui_tab_Type])
- ) &&
- gui_TabData[playerid][g][gui_tab_P] == playerid
- )
- {
- if (!count && !p_tab[playerid])
- {
- p_tab[playerid] = g;
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_TabData[playerid][g][gui_tab_td2]); // first tab
- //type = GUI_TYPE_TAB;
- //gui = gui_TabData[g][gui_tab_ID];
- if (type == GUI_TYPE_WINDOW) // Re-applies the function with the tab option, so it can show its child elements
- {
- SetPVarInt(playerid, "guisetvisible_w", gui);
- guiSetVisible(playerid, GUI_TYPE_TAB, gui_TabData[playerid][g][gui_tab_ID], toggle);
- break;
- }
- }
- else if (p_tab[playerid] == g)
- {
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_TabData[playerid][g][gui_tab_td2]); // selected tab
- //type = GUI_TYPE_TAB;
- //gui = gui_TabData[playerid][g][gui_tab_ID];
- if (type == GUI_TYPE_WINDOW)
- {
- guiSetVisible(playerid, GUI_TYPE_TAB, gui_TabData[playerid][g][gui_tab_ID], toggle);
- break;
- }
- }
- else CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_TabData[playerid][g][gui_tab_td]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_TabData[playerid][g][gui_tab_tdbg]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_TabData[playerid][g][gui_tab_tdbox]);
- count++;
- }
- if (end) continue;
- LABEL:
- //printf("Type: %d(%d) | GUI: %d(%d) | Window: %d(%d) | Tab: %d(%d)", type, gui_LabelData[playerid][g][gui_label_Type], gui, gui_LabelData[playerid][g][gui_label_ID], gui, gui_LabelData[playerid][g][gui_label_Window], gui, gui_LabelData[playerid][g][gui_label_Tab]);
- if (
- gui_LabelData[playerid][g][gui_label_ID] > 0 && // Valid gui?
- (
- (type == GUI_TYPE_WINDOW && gui_LabelData[playerid][g][gui_label_Window] == gui && // If it's being viewed under a window (In case the window has no tab)
- (
- (!gui_LabelData[playerid][g][gui_label_Tab] && toggle) ||
- (gui_LabelData[playerid][g][gui_label_Tab] > 0 && !toggle)
- )
- ) ||
- (type == GUI_TYPE_TAB && gui_LabelData[playerid][g][gui_label_Tab] == gui) || // Under a tab?
- (type == gui_LabelData[playerid][g][gui_label_Type] && gui_LabelData[playerid][g][gui_label_ID] == gui) // Maybe it's alone?
- ) ||
- ( // It's under a window, however if the window has a tab, it automatically runs the function under tab. So this checks if it's only under a window
- oldw > 0 && oldw == gui_LabelData[playerid][g][gui_label_Window] &&
- (type == GUI_TYPE_TAB && !gui_LabelData[playerid][g][gui_label_Tab])
- ) &&
- gui_LabelData[playerid][g][gui_label_P] == playerid
- )
- {
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_LabelData[playerid][g][gui_label_td]);
- }
- if (end) continue;
- BAR:
- if (
- gui_BarData[playerid][g][gui_bar_ID] > 0 &&
- (
- (type == GUI_TYPE_WINDOW && gui_BarData[playerid][g][gui_bar_Window] == gui &&
- (
- (!gui_BarData[playerid][g][gui_bar_Tab] && toggle) ||
- (gui_BarData[playerid][g][gui_bar_Tab] > 0 && !toggle)
- )
- ) ||
- (type == GUI_TYPE_TAB && gui_BarData[playerid][g][gui_bar_Tab] == gui) ||
- (type == gui_BarData[playerid][g][gui_bar_Type] && gui_BarData[playerid][g][gui_bar_ID] == gui)
- ) ||
- (
- oldw > 0 && oldw == gui_BarData[playerid][g][gui_bar_Window] &&
- (type == GUI_TYPE_TAB && !gui_BarData[playerid][g][gui_bar_Tab])
- ) &&
- gui_BarData[playerid][g][gui_bar_P] == playerid
- )
- {
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_BarData[playerid][g][gui_bar_tdbg]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_BarData[playerid][g][gui_bar_tdbox]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_BarData[playerid][g][gui_bar_tdbar]);
- }
- if (end) continue;
- ITEMLIST:
- if (
- gui_ItemlistData[playerid][g][gui_list_ID] > 0 &&
- (
- (type == GUI_TYPE_WINDOW && gui_ItemlistData[playerid][g][gui_list_Window] == gui &&
- (
- (!gui_ItemlistData[playerid][g][gui_list_Tab] && toggle) ||
- (gui_ItemlistData[playerid][g][gui_list_Tab] > 0 && !toggle)
- )
- ) ||
- (type == GUI_TYPE_TAB && gui_ItemlistData[playerid][g][gui_list_Tab] == gui) ||
- (type == gui_ItemlistData[playerid][g][gui_list_Type] && gui_ItemlistData[playerid][g][gui_list_ID] == gui)
- ) ||
- (
- oldw > 0 && oldw == gui_ItemlistData[playerid][g][gui_list_Window] &&
- (type == GUI_TYPE_TAB && !gui_ItemlistData[playerid][g][gui_list_Tab])
- ) &&
- gui_ItemlistData[playerid][g][gui_list_P] == playerid
- )
- {
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_ItemlistData[playerid][g][gui_list_tdbox]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_ItemlistData[playerid][g][gui_list_tdline]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_ItemlistData[playerid][g][gui_list_tdtitle]);
- pcount_i[playerid] = 0;
- for(new r; r <= gui_ItemlistData[playerid][g][gui_list_RowMax]+1; r++)
- {
- if (gui_ItemRowData[playerid][r][gui_row_ID] > 0 && gui_ItemRowData[playerid][r][gui_row_List] == gui_ItemlistData[playerid][g][gui_list_ID])
- {
- if ((!pcount_i[playerid] && !p_row[playerid]) || p_row[playerid] == r)
- {
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_ItemRowData[playerid][r][gui_row_td2]);
- p_row[playerid] = g;
- }
- else
- {
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_ItemRowData[playerid][r][gui_row_td]);
- }
- }
- pcount_i[playerid]++;
- }
- }
- if (end) continue;
- CHECKBOX:
- if (
- gui_CheckboxData[playerid][g][gui_check_ID] > 0 &&
- (
- (type == GUI_TYPE_WINDOW && gui_CheckboxData[playerid][g][gui_check_Window] == gui &&
- (
- (!gui_CheckboxData[playerid][g][gui_check_Tab] && toggle) ||
- (gui_CheckboxData[playerid][g][gui_check_Tab] > 0 && !toggle)
- )
- ) ||
- (type == GUI_TYPE_TAB && gui_CheckboxData[playerid][g][gui_check_Tab] == gui) ||
- (type == gui_CheckboxData[playerid][g][gui_check_Type] && gui_CheckboxData[playerid][g][gui_check_ID] == gui)
- ) ||
- (
- oldw > 0 && oldw == gui_CheckboxData[playerid][g][gui_check_Window] &&
- (type == GUI_TYPE_TAB && !gui_CheckboxData[playerid][g][gui_check_Tab])
- ) &&
- gui_CheckboxData[playerid][g][gui_check_P] == playerid
- )
- {
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_CheckboxData[playerid][g][gui_check_td]);
- }
- if (end) continue;
- BUTTON:
- //printf("Type: %d(%d) | GUI: %d(%d) | Window: %d | Tab: %d", type, gui_ButtonData[playerid][g][gui_but_Type], gui, gui_ButtonData[playerid][g][gui_but_ID], gui_ButtonData[playerid][g][gui_but_Window], gui_ButtonData[playerid][g][gui_but_Tab]);
- if (
- gui_ButtonData[playerid][g][gui_but_ID] > 0 &&
- (
- (type == GUI_TYPE_WINDOW && gui_ButtonData[playerid][g][gui_but_Window] == gui &&
- (
- (!gui_ButtonData[playerid][g][gui_but_Tab] && toggle) ||
- (gui_ButtonData[playerid][g][gui_but_Tab] > 0 && !toggle)
- )
- ) ||
- (type == GUI_TYPE_TAB && gui_ButtonData[playerid][g][gui_but_Tab] == gui) ||
- (type == gui_ButtonData[playerid][g][gui_but_Type] && gui_ButtonData[playerid][g][gui_but_ID] == gui)
- ) ||
- (
- oldw > 0 && oldw == gui_ButtonData[playerid][g][gui_but_Window] &&
- (type == GUI_TYPE_TAB && !gui_ButtonData[playerid][g][gui_but_Tab])
- ) &&
- gui_ButtonData[playerid][g][gui_but_P] == playerid
- )
- {
- //printf("%s(%d, %d)", str, playerid, io_PlayerText:gui_ButtonData[playerid][g][gui_but_tdbg]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_ButtonData[playerid][g][gui_but_tdbg]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_ButtonData[playerid][g][gui_but_tdout]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_ButtonData[playerid][g][gui_but_tdbox]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_ButtonData[playerid][g][gui_but_tdtxt]);
- CallLocalFunction(str, "dd", playerid, io_PlayerText:gui_ButtonData[playerid][g][gui_but_tdgl]);
- }
- if (end) continue;
- }
- return 1;
- }
- function guiSetVisibleAll(type, gui, bool:toggle)
- {
- for(new playerid, m = GetMaxPlayers(); playerid < m; playerid++)
- {
- if (!IsPlayerConnected(playerid)) continue;
- guiSetVisible(playerid, type, gui, toggle);
- }
- }
- /*function guiSetVisibleAll(type, gui, bool:toggle)
- {
- gui--;
- new str[32],end = 0;
- if (toggle == true)
- {
- format(str, sizeof str, "TextDrawShowForAllEx");
- }
- else if (toggle == false)
- {
- format(str, sizeof str, "TextDrawHideForAllEx");
- }
- if (type == GUI_TYPE_WINDOW)
- {
- CallLocalFunction(str, "d", io_PlayerText:gui_WindowData[gui][gui_win_td]);
- CallLocalFunction(str, "d", io_PlayerText:gui_WindowData[gui][gui_win_tdtop]);
- CallLocalFunction(str, "d", io_PlayerText:gui_WindowData[gui][gui_win_tdtitle]);
- }
- else if (type != GUI_TYPE_WINDOW && type != GUI_TYPE_WINDOW) end = 1;
- new count;
- if (p_tab[playerid] > 0)
- {
- type = GUI_TYPE_TAB;
- gui = gui_TabData[p_tab[playerid]][gui_tab_ID]-1;
- }
- for(new g; g < MAX_GUI; g++)
- {
- if (end)
- {
- switch (type)
- {
- case GUI_TYPE_TAB: goto TAB;
- case GUI_TYPE_LABEL: goto LABEL;
- case GUI_TYPE_BAR: goto BAR;
- case GUI_TYPE_ITEMLIST: goto ITEMLIST;
- case GUI_TYPE_CHECKBOX: goto CHECKBOX;
- case GUI_TYPE_BUTTON: goto BUTTON;
- }
- }
- TAB:
- if (gui_TabData[g][gui_tab_ID] > 0 && ((type == GUI_TYPE_WINDOW && gui_TabData[g][gui_tab_Window] == gui) || type == gui_TabData[g][gui_tab_Type]))
- {
- if (!count)
- {
- for(new playerid; playerid < MAX_PLAYERS; playerid++)
- {
- if (IsPlayerConnected(playerid) && !p_tab[playerid])
- {
- p_tab[playerid] = g;
- CallLocalFunction(str, "d", io_PlayerText:gui_TabData[g][gui_tab_td2]); // first tab
- type = GUI_TYPE_TAB;
- gui = gui_TabData[p_tab[playerid]][gui_tab_ID]-1;
- }
- }
- }
- else CallLocalFunction(str, "d", io_PlayerText:gui_TabData[g][gui_tab_td]);
- CallLocalFunction(str, "d", io_PlayerText:gui_TabData[g][gui_tab_tdbg]);
- CallLocalFunction(str, "d", io_PlayerText:gui_TabData[g][gui_tab_tdbox]);
- count++;
- }
- if (end) break;
- LABEL:
- if (gui_LabelData[g][gui_label_ID] > 0 && ((type == GUI_TYPE_WINDOW && gui_LabelData[g][gui_label_Window] == gui && !gui_LabelData[g][gui_label_Tab]) || (type == GUI_TYPE_TAB && gui_LabelData[g][gui_label_Tab] == gui) || type == gui_LabelData[g][gui_label_Type]))
- CallLocalFunction(str, "d", io_PlayerText:gui_LabelData[g][gui_label_td]);
- if (end) break;
- BAR:
- if (gui_BarData[g][gui_bar_ID] > 0 && ((type == GUI_TYPE_WINDOW && gui_BarData[g][gui_bar_Window] == gui && !gui_BarData[g][gui_bar_Tab]) || (type == GUI_TYPE_TAB && gui_BarData[g][gui_bar_Tab] == gui) || type == gui_BarData[g][gui_bar_Type]))
- {
- CallLocalFunction(str, "d", io_PlayerText:gui_BarData[g][gui_bar_tdbg]);
- CallLocalFunction(str, "d", io_PlayerText:gui_BarData[g][gui_bar_tdbox]);
- CallLocalFunction(str, "d", io_PlayerText:gui_BarData[g][gui_bar_tdbar]);
- }
- if (end) break;
- ITEMLIST:
- if (gui_ItemlistData[g][gui_list_ID] > 0 && ((type == GUI_TYPE_WINDOW && gui_ItemlistData[g][gui_list_Window] == gui && !gui_ItemlistData[g][gui_list_Tab]) || (type == GUI_TYPE_TAB && gui_ItemlistData[g][gui_list_Tab] == gui) || type == gui_ItemlistData[g][gui_list_Type]))
- {
- CallLocalFunction(str, "d", io_PlayerText:gui_ItemlistData[g][gui_list_tdbox]);
- CallLocalFunction(str, "d", io_PlayerText:gui_ItemlistData[g][gui_list_tdline]);
- CallLocalFunction(str, "d", io_PlayerText:gui_ItemlistData[g][gui_list_tdtitle]);
- count = 0;
- for(new r; r <= gui_ItemlistData[g][gui_list_RowMax]+1; r++)
- {
- if (gui_ItemRowData[playerid][r][gui_row_ID] > 0)
- {
- if (!count)
- {
- CallLocalFunction(str, "d", io_PlayerText:gui_ItemRowData[playerid][r][gui_row_td2]);
- for(new playerid; playerid < MAX_PLAYERS; playerid++)
- p_row[playerid] = g;
- }
- else CallLocalFunction(str, "d", io_PlayerText:gui_ItemRowData[playerid][r][gui_row_td]);
- }
- count++;
- }
- }
- if (end) break;
- CHECKBOX:
- if (gui_CheckboxData[g][gui_check_ID] > 0 && ((type == GUI_TYPE_WINDOW && gui_CheckboxData[g][gui_check_Window] == gui && !gui_CheckboxData[g][gui_check_Tab]) || (type == GUI_TYPE_TAB && gui_CheckboxData[g][gui_check_Tab] == gui) || type == gui_CheckboxData[g][gui_check_Type]))
- {
- CallLocalFunction(str, "d", io_PlayerText:gui_CheckboxData[g][gui_check_td]);
- }
- if (end) break;
- BUTTON:
- if (gui_ButtonData[g][gui_but_ID] > 0 && ((type == GUI_TYPE_WINDOW && gui_ButtonData[g][gui_but_Window] == gui && !gui_ButtonData[g][gui_but_Tab]) || (type == GUI_TYPE_TAB && gui_ButtonData[g][gui_but_Tab] == gui) || type == gui_ButtonData[g][gui_but_Type]))
- {
- CallLocalFunction(str, "d", io_PlayerText:gui_ButtonData[g][gui_but_tdbg]);
- CallLocalFunction(str, "d", io_PlayerText:gui_ButtonData[g][gui_but_tdout]);
- CallLocalFunction(str, "d", io_PlayerText:gui_ButtonData[g][gui_but_tdbox]);
- CallLocalFunction(str, "d", io_PlayerText:gui_ButtonData[g][gui_but_tdtxt]);
- CallLocalFunction(str, "d", io_PlayerText:gui_ButtonData[g][gui_but_tdgl]);
- }
- if (end) break;
- }
- }*/
- function guiCreateWindow(playerid, Float:x, Float:y, Float:size_x, Float:size_y, title[])
- {
- new wid = -1;
- for(new c; c < MAX_GUI; c++)
- {
- if (!gui_WindowData[playerid][c][gui_win_ID])
- {
- wid = c;
- break;
- }
- }
- if (wid == -1) return !printf("ERROR GUI: You cannot exceed the GUI window limit! (%d)", MAX_GUI);
- gui_WindowData[playerid][wid][gui_win_X] = x;
- gui_WindowData[playerid][wid][gui_win_Y] = y;
- gui_WindowData[playerid][wid][gui_win_SizeX] = size_x;
- gui_WindowData[playerid][wid][gui_win_SizeY] = size_y;
- strins(gui_WindowData[playerid][wid][gui_win_Title], title, 0);
- gui_WindowData[playerid][wid][gui_win_P] = playerid;
- gui_WindowData[playerid][wid][gui_win_ID] = wid+1;
- gui_WindowData[playerid][wid][gui_win_td] = CreatePlayerTextDraw(playerid, x, y, "_");
- PlayerTextDrawAlignment(playerid, gui_WindowData[playerid][wid][gui_win_td], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_WindowData[playerid][wid][gui_win_td], 255);
- PlayerTextDrawFont(playerid, gui_WindowData[playerid][wid][gui_win_td], 1);
- PlayerTextDrawLetterSize(playerid, gui_WindowData[playerid][wid][gui_win_td], 0.500000, size_y*UNIT);
- PlayerTextDrawColor(playerid, gui_WindowData[playerid][wid][gui_win_td], -1);
- PlayerTextDrawSetOutline(playerid, gui_WindowData[playerid][wid][gui_win_td], 1);
- PlayerTextDrawSetProportional(playerid, gui_WindowData[playerid][wid][gui_win_td], 1);
- PlayerTextDrawUseBox(playerid, gui_WindowData[playerid][wid][gui_win_td], 1);
- PlayerTextDrawBoxColor(playerid, gui_WindowData[playerid][wid][gui_win_td], 155);
- PlayerTextDrawTextSize(playerid, gui_WindowData[playerid][wid][gui_win_td], 0.000000, size_x);
- gui_WindowData[playerid][wid][gui_win_tdtop] = CreatePlayerTextDraw(playerid, x, y, "_");
- PlayerTextDrawAlignment(playerid, gui_WindowData[playerid][wid][gui_win_tdtop], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_WindowData[playerid][wid][gui_win_tdtop], 255);
- PlayerTextDrawFont(playerid, gui_WindowData[playerid][wid][gui_win_tdtop], 1);
- PlayerTextDrawLetterSize(playerid, gui_WindowData[playerid][wid][gui_win_tdtop], 0.500000, 0.599997);
- PlayerTextDrawColor(playerid, gui_WindowData[playerid][wid][gui_win_tdtop], -1);
- PlayerTextDrawSetOutline(playerid, gui_WindowData[playerid][wid][gui_win_tdtop], 1);
- PlayerTextDrawSetProportional(playerid, gui_WindowData[playerid][wid][gui_win_tdtop], 1);
- PlayerTextDrawUseBox(playerid, gui_WindowData[playerid][wid][gui_win_tdtop], 1);
- PlayerTextDrawBoxColor(playerid, gui_WindowData[playerid][wid][gui_win_tdtop], -1296911838);
- PlayerTextDrawTextSize(playerid, gui_WindowData[playerid][wid][gui_win_tdtop], 0.000000, size_x);
- gui_WindowData[playerid][wid][gui_win_tdtitle] = CreatePlayerTextDraw(playerid, x, y-1.0, title);
- PlayerTextDrawAlignment(playerid, gui_WindowData[playerid][wid][gui_win_tdtitle], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_WindowData[playerid][wid][gui_win_tdtitle], 255);
- PlayerTextDrawFont(playerid, gui_WindowData[playerid][wid][gui_win_tdtitle], 2);
- PlayerTextDrawLetterSize(playerid, gui_WindowData[playerid][wid][gui_win_tdtitle], 0.179999, 0.799997);
- PlayerTextDrawColor(playerid, gui_WindowData[playerid][wid][gui_win_tdtitle], -1);
- PlayerTextDrawSetOutline(playerid, gui_WindowData[playerid][wid][gui_win_tdtitle], 0);
- PlayerTextDrawSetProportional(playerid, gui_WindowData[playerid][wid][gui_win_tdtitle], 1);
- PlayerTextDrawSetShadow(playerid, gui_WindowData[playerid][wid][gui_win_tdtitle], 0);
- return gui_WindowData[playerid][wid][gui_win_ID];
- }
- function guiCreateTab(playerid, windowid, Float:x, Float:y, Float:height, Float:width, text[])
- {
- new id = -1, pos, Float:len, wind = windowid;
- for(new c; c < MAX_GUI; c++)
- {
- if (!gui_TabData[playerid][c][gui_tab_ID] && id == -1)
- {
- id = c;
- //printf("TAB ID: %d", c);
- }
- if (gui_TabData[playerid][c][gui_tab_Window] == windowid)
- {
- pos++;
- len += (float(strlen(gui_TabData[playerid][c][gui_tab_Text]))*5.0)+4.0 + gui_TabData[playerid][c][gui_tab_plusX];
- }
- }
- if (id == -1) return !printf("ERROR GUI: You cannot exceed the GUI tab limit! (%d)", MAX_GUI);
- new units = strlen(text)*5; // Every char is 5 units space
- new Float:boxX = x, Float:boxY = y+10.0, Float:tabheight = 0.799996;
- if (windowid > 0) // If you set the tab under a GUI Window ...
- {
- windowid = guiGetID(playerid, GUI_TYPE_WINDOW, windowid);
- /*printf("CURRENT LEN: %.2f | MAX LEN: %.2f | TOTAL: %d(%d)", (gui_WindowData[windowid][gui_win_X]-(gui_WindowData[windowid][gui_win_SizeX]/2))+((len+units)/2)+4.0, gui_WindowData[windowid][gui_win_X]+(gui_WindowData[windowid][gui_win_SizeX]/2), len+units, units);
- if (((gui_WindowData[windowid][gui_win_X]-(gui_WindowData[windowid][gui_win_SizeX]/2))+((len+units)/2)+4.0) > (gui_WindowData[windowid][gui_win_X]+(gui_WindowData[windowid][gui_win_SizeX]/2)))
- {
- printf("ERROR GUI: Tab %d cannot be created because it does not fit in the window!", id);
- gui_TabData[playerid][id][gui_tab_ID] = 0;
- return 0;
- }*/
- gui_TabData[playerid][id][gui_tab_plusX] = x;
- boxX = gui_WindowData[playerid][windowid][gui_win_X];
- x += (gui_WindowData[playerid][windowid][gui_win_X]-(gui_WindowData[playerid][windowid][gui_win_SizeX]/2)); // relative positioning
- y += (gui_WindowData[playerid][windowid][gui_win_Y]+10.0);
- boxY = y+10.5;
- if (height == 0.0) height = ( ((gui_WindowData[playerid][windowid][gui_win_SizeY])*UNIT) - (20.0)*UNIT ) - (4.0*UNIT);
- else height *= UNIT;
- if (width == 0.0) width = gui_WindowData[playerid][windowid][gui_win_SizeX]-3.0;
- else width += gui_WindowData[playerid][windowid][gui_win_SizeX];
- //printf("CURRENT: %.2f | MAXIMUM: %.2f", (x+units+len+4.0), gui_WindowData[windowid][gui_win_X]+(gui_WindowData[windowid][gui_win_SizeX]/2));
- if ((x+float(units)+len+4.0+gui_TabData[playerid][id][gui_tab_plusX]) > (gui_WindowData[playerid][windowid][gui_win_X]+(gui_WindowData[playerid][windowid][gui_win_SizeX]/2)))
- {
- printf("ERROR GUI: Tab %d cannot be created because it does not fit in the window!", id);
- gui_TabData[playerid][id][gui_tab_ID] = 0;
- return 0;
- }
- //printf("height:%.2f | width: %.2f | boxY: %.2f | winY: %.2f = %.2f", height, width, boxY, gui_WindowData[playerid][windowid][gui_win_SizeY], gui_WindowData[playerid][windowid][gui_win_Y]-boxY);
- }
- if (pos > 0)
- {
- for(new c; c < MAX_GUI; c++)
- {
- if (!gui_TabData[playerid][c][gui_tab_ID]) continue;
- if (gui_TabData[playerid][c][gui_tab_Window] == wind)
- {
- gui_TabData[playerid][c][gui_tab_panel] = id;
- x += float(strlen(gui_TabData[playerid][c][gui_tab_Text]))*5+4.0 + gui_TabData[playerid][c][gui_tab_plusX];
- //if (pos == 7) x = gui_WindowData[playerid][windowid][gui_win_X]-(gui_WindowData[playerid][windowid][gui_win_SizeX]/2);
- //printf("(%d)x:%.2f - %d(%s)", c, x, strlen(gui_TabData[playerid][c][gui_tab_Text]), gui_TabData[playerid][c][gui_tab_Text]);
- }
- }
- }
- gui_TabData[playerid][id][gui_tab_X] = x;
- gui_TabData[playerid][id][gui_tab_Y] = y;
- gui_TabData[playerid][id][gui_tab_Height] = height;
- gui_TabData[playerid][id][gui_tab_Width] = width;
- strins(gui_TabData[playerid][id][gui_tab_Text], text, 0);
- gui_TabData[playerid][id][gui_tab_Window] = wind;
- gui_TabData[playerid][id][gui_tab_panelX] = boxX;
- gui_TabData[playerid][id][gui_tab_panelY] = boxY+2.0;
- gui_TabData[playerid][id][gui_tab_Type] = GUI_TYPE_TAB;
- gui_TabData[playerid][id][gui_tab_P] = playerid;
- gui_TabData[playerid][id][gui_tab_ID] = id+1;
- gui_TabData[playerid][id][gui_tab_td] = CreatePlayerTextDraw(playerid, (x+2.0+float(units)/2), y, text);
- PlayerTextDrawAlignment(playerid, gui_TabData[playerid][id][gui_tab_td], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_TabData[playerid][id][gui_tab_td], 255);
- PlayerTextDrawFont(playerid, gui_TabData[playerid][id][gui_tab_td], 2);
- PlayerTextDrawLetterSize(playerid, gui_TabData[playerid][id][gui_tab_td], 0.179998, tabheight);
- PlayerTextDrawColor(playerid, gui_TabData[playerid][id][gui_tab_td], -1);
- PlayerTextDrawSetOutline(playerid, gui_TabData[playerid][id][gui_tab_td], 0);
- PlayerTextDrawSetProportional(playerid, gui_TabData[playerid][id][gui_tab_td], 1);
- PlayerTextDrawSetShadow(playerid, gui_TabData[playerid][id][gui_tab_td], 0);
- PlayerTextDrawUseBox(playerid, gui_TabData[playerid][id][gui_tab_td], 1);
- PlayerTextDrawBoxColor(playerid, gui_TabData[playerid][id][gui_tab_td], 0x6F6F6F22);
- PlayerTextDrawTextSize(playerid, gui_TabData[playerid][id][gui_tab_td], tabheight/UNIT, float(units));
- PlayerTextDrawSetSelectable(playerid, gui_TabData[playerid][id][gui_tab_td], 1);
- gui_TabData[playerid][id][gui_tab_td2] = CreatePlayerTextDraw(playerid, (x+2.0+float(units)/2), y, text);
- PlayerTextDrawAlignment(playerid, gui_TabData[playerid][id][gui_tab_td2], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_TabData[playerid][id][gui_tab_td2], 255);
- PlayerTextDrawFont(playerid, gui_TabData[playerid][id][gui_tab_td2], 2);
- PlayerTextDrawLetterSize(playerid, gui_TabData[playerid][id][gui_tab_td2], 0.179998, tabheight);
- PlayerTextDrawColor(playerid, gui_TabData[playerid][id][gui_tab_td2], -1);
- PlayerTextDrawSetOutline(playerid, gui_TabData[playerid][id][gui_tab_td2], 0);
- PlayerTextDrawSetProportional(playerid, gui_TabData[playerid][id][gui_tab_td2], 1);
- PlayerTextDrawSetShadow(playerid, gui_TabData[playerid][id][gui_tab_td2], 0);
- PlayerTextDrawUseBox(playerid, gui_TabData[playerid][id][gui_tab_td2], 1);
- PlayerTextDrawBoxColor(playerid, gui_TabData[playerid][id][gui_tab_td2], 0xC3C3C344);
- PlayerTextDrawTextSize(playerid, gui_TabData[playerid][id][gui_tab_td2], tabheight/UNIT, float(units));
- if (!pos) // only the first tab will create the tab panel
- {
- gui_TabData[playerid][id][gui_tab_panel] = id;
- gui_TabData[playerid][id][gui_tab_tdbg] = CreatePlayerTextDraw(playerid, boxX, boxY, "_");
- PlayerTextDrawAlignment(playerid, gui_TabData[playerid][id][gui_tab_tdbg], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_TabData[playerid][id][gui_tab_tdbg], 255);
- PlayerTextDrawFont(playerid, gui_TabData[playerid][id][gui_tab_tdbg], 1);
- PlayerTextDrawLetterSize(playerid, gui_TabData[playerid][id][gui_tab_tdbg], 0.199998, height);
- PlayerTextDrawColor(playerid, gui_TabData[playerid][id][gui_tab_tdbg], -1);
- PlayerTextDrawSetOutline(playerid, gui_TabData[playerid][id][gui_tab_tdbg], 0);
- PlayerTextDrawSetProportional(playerid, gui_TabData[playerid][id][gui_tab_tdbg], 1);
- PlayerTextDrawSetShadow(playerid, gui_TabData[playerid][id][gui_tab_tdbg], 0);
- PlayerTextDrawUseBox(playerid, gui_TabData[playerid][id][gui_tab_tdbg], 1);
- PlayerTextDrawBoxColor(playerid, gui_TabData[playerid][id][gui_tab_tdbg], 0xC3C3C344);
- PlayerTextDrawTextSize(playerid, gui_TabData[playerid][id][gui_tab_tdbg], 0.0, width);
- gui_TabData[playerid][id][gui_tab_tdbox] = CreatePlayerTextDraw(playerid, boxX, boxY+2.0, "_");
- PlayerTextDrawAlignment(playerid, gui_TabData[playerid][id][gui_tab_tdbox], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_TabData[playerid][id][gui_tab_tdbox], 255);
- PlayerTextDrawFont(playerid, gui_TabData[playerid][id][gui_tab_tdbox], 1);
- PlayerTextDrawLetterSize(playerid, gui_TabData[playerid][id][gui_tab_tdbox], 0.199998, height-(4.0*UNIT));
- PlayerTextDrawColor(playerid, gui_TabData[playerid][id][gui_tab_tdbox], -1);
- PlayerTextDrawSetOutline(playerid, gui_TabData[playerid][id][gui_tab_tdbox], 0);
- PlayerTextDrawSetProportional(playerid, gui_TabData[playerid][id][gui_tab_tdbox], 1);
- PlayerTextDrawSetShadow(playerid, gui_TabData[playerid][id][gui_tab_tdbox], 0);
- PlayerTextDrawUseBox(playerid, gui_TabData[playerid][id][gui_tab_tdbox], 1);
- PlayerTextDrawBoxColor(playerid, gui_TabData[playerid][id][gui_tab_tdbox], 153);
- PlayerTextDrawTextSize(playerid, gui_TabData[playerid][id][gui_tab_tdbox], 0.0, width-3.0);
- }
- return gui_TabData[playerid][id][gui_tab_ID];
- }
- function guiCreateLabel(playerid, windowid, tabid, Float:x, Float:y, Float:length, color, font, text[])
- {
- new id = -1, wind = windowid, t = tabid;
- for(new c; c < MAX_GUI; c++)
- {
- if (!gui_LabelData[playerid][c][gui_label_ID])
- {
- id = c;
- break;
- }
- }
- if (id == -1) return !printf("ERROR GUI: You cannot exceed the GUI label limit! (%d)", MAX_GUI);
- if (windowid > 0) // If you set the label under a GUI Window ...
- {
- windowid = guiGetID(playerid, GUI_TYPE_WINDOW, windowid);
- if (tabid > 0) // if it's under a tab panel
- {
- tabid = guiGetID(playerid, GUI_TYPE_TAB, tabid);
- x += (gui_TabData[playerid][tabid][gui_tab_panelX]-(gui_TabData[playerid][tabid][gui_tab_Width]/2))+1.5;
- y += (gui_TabData[playerid][tabid][gui_tab_panelY]-(gui_TabData[playerid][tabid][gui_tab_Height]/2))+6.0; // relative positioning
- if (length == 0.0) length = x+gui_TabData[playerid][tabid][gui_tab_Width];
- else length += x;
- }
- else // only under a window gui
- {
- x += (gui_WindowData[playerid][windowid][gui_win_X]-(gui_WindowData[playerid][windowid][gui_win_SizeX]/2));
- y += (gui_WindowData[playerid][windowid][gui_win_Y]+7.0); // relative positioning
- // SendFormatMessage(0, 0xFFFFFFFF, "%f - %f", gui_WindowData[playerid][windowid][gui_win_SizeX], gui_WindowData[playerid][windowid][gui_win_X]+gui_WindowData[playerid][windowid][gui_win_SizeX]);
- if (length == 0.0) length = x+gui_WindowData[playerid][windowid][gui_win_SizeX];
- else length += x;
- }
- }
- gui_LabelData[playerid][id][gui_label_X] = x;
- gui_LabelData[playerid][id][gui_label_Y] = y;
- gui_LabelData[playerid][id][gui_label_Length] = length;
- strins(gui_LabelData[playerid][id][gui_label_Text], text, 0);
- gui_LabelData[playerid][id][gui_label_Window] = wind;
- gui_LabelData[playerid][id][gui_label_Tab] = t;
- gui_LabelData[playerid][id][gui_label_Color] = color;
- gui_LabelData[playerid][id][gui_label_Type] = GUI_TYPE_LABEL;
- gui_LabelData[playerid][id][gui_label_P] = playerid;
- gui_LabelData[playerid][id][gui_label_ID] = id+1;
- gui_LabelData[playerid][id][gui_label_td] = CreatePlayerTextDraw(playerid, x, y, text);
- PlayerTextDrawBackgroundColor(playerid, gui_LabelData[playerid][id][gui_label_td], 255);
- PlayerTextDrawFont(playerid, gui_LabelData[playerid][id][gui_label_td], font);
- PlayerTextDrawLetterSize(playerid, gui_LabelData[playerid][id][gui_label_td], 0.199998, 0.799996);
- PlayerTextDrawColor(playerid, gui_LabelData[playerid][id][gui_label_td], color);
- PlayerTextDrawSetOutline(playerid, gui_LabelData[playerid][id][gui_label_td], 0);
- PlayerTextDrawSetProportional(playerid, gui_LabelData[playerid][id][gui_label_td], 1);
- PlayerTextDrawSetShadow(playerid, gui_LabelData[playerid][id][gui_label_td], 0);
- PlayerTextDrawUseBox(playerid, gui_LabelData[playerid][id][gui_label_td], 1);
- PlayerTextDrawBoxColor(playerid, gui_LabelData[playerid][id][gui_label_td], 0xFFFFFF00);
- PlayerTextDrawTextSize(playerid, gui_LabelData[playerid][id][gui_label_td], length, 0.000000);
- return gui_LabelData[playerid][id][gui_label_ID];
- }
- function guiLabelSetText(playerid, labelid, color, font, text[])
- {
- if (labelid >= MAX_GUI) return 0;
- new id = guiGetID(playerid, GUI_TYPE_LABEL, labelid);
- if (id == -1) return 0;
- if (!IsPlayerConnected(playerid)) return 0;
- PlayerTextDrawDestroy(playerid, gui_LabelData[playerid][id][gui_label_td]);
- new PlayerText:txt = CreatePlayerTextDraw(playerid, gui_LabelData[playerid][id][gui_label_X], gui_LabelData[playerid][id][gui_label_Y], text);
- PlayerTextDrawBackgroundColor(playerid, txt, 255);
- PlayerTextDrawFont(playerid, txt, font);
- PlayerTextDrawLetterSize(playerid, txt, 0.199998, 0.799996);
- PlayerTextDrawColor(playerid, txt, color);
- PlayerTextDrawSetOutline(playerid, txt, 0);
- PlayerTextDrawSetProportional(playerid, txt, 1);
- PlayerTextDrawSetShadow(playerid, txt, 0);
- PlayerTextDrawUseBox(playerid, txt, 1);
- PlayerTextDrawBoxColor(playerid, txt, 0xFFFFFF00);
- PlayerTextDrawTextSize(playerid, txt, gui_LabelData[playerid][id][gui_label_Length], 0.000000);
- gui_LabelData[playerid][id][gui_label_Color] = color;
- strdel(gui_LabelData[playerid][id][gui_label_Text], 0, strlen(gui_LabelData[playerid][id][gui_label_Text]));
- strins(gui_LabelData[playerid][id][gui_label_Text], text, 0);
- //printf("%s",text);
- gui_LabelData[playerid][id][gui_label_td] = txt;
- if (GetTextDrawVisibilityForPlayer(playerid, txt)) PlayerTextDrawShow(playerid, txt);
- return 1;
- }
- function guiCreateProgressBar(playerid, windowid, tabid, Float:x, Float:y, Float:height, Float:width, color_bg, color_box, color_bar)
- {
- new id = -1, wind = windowid, t = tabid;
- for(new c; c < MAX_GUI; c++)
- {
- if (!gui_BarData[playerid][c][gui_bar_ID])
- {
- id = c;
- break;
- }
- }
- if (id == -1) return !printf("ERROR GUI: You cannot exceed the GUI progress bar limit! (%d)", MAX_GUI);
- if (windowid > 0) // If you set the label under a GUI Window ...
- {
- windowid = guiGetID(playerid, GUI_TYPE_WINDOW, windowid);
- if (tabid > 0) // if it's under a tab panel
- {
- tabid = guiGetID(playerid, GUI_TYPE_TAB, tabid);
- x += (gui_TabData[playerid][tabid][gui_tab_panelX]-(gui_TabData[playerid][tabid][gui_tab_Width]/2))+1.5;
- y += (gui_TabData[playerid][tabid][gui_tab_panelY]-(gui_TabData[playerid][tabid][gui_tab_Height]/2))+6.0; // relative positioning
- }
- else // only under a window gui
- {
- x += (gui_WindowData[playerid][windowid][gui_win_X]-(gui_WindowData[playerid][windowid][gui_win_SizeX]/2));
- y += (gui_WindowData[playerid][windowid][gui_win_Y]+7.0); // relative positioning
- }
- }
- gui_BarData[playerid][id][gui_bar_X] = x;
- gui_BarData[playerid][id][gui_bar_Y] = y;
- gui_BarData[playerid][id][gui_bar_Height] = height;
- gui_BarData[playerid][id][gui_bar_Width] = width;
- gui_BarData[playerid][id][gui_bar_Window] = wind;
- gui_BarData[playerid][id][gui_bar_Tab] = t;
- gui_BarData[playerid][id][gui_bar_Progress] = 100.0; // 100%
- gui_BarData[playerid][id][gui_bar_bgcolor] = color_bg;
- gui_BarData[playerid][id][gui_bar_boxcolor] = color_box;
- gui_BarData[playerid][id][gui_bar_barcolor] = color_bar;
- gui_BarData[playerid][id][gui_bar_Type] = GUI_TYPE_BAR;
- gui_BarData[playerid][id][gui_bar_P] = playerid;
- gui_BarData[playerid][id][gui_bar_ID] = id+1;
- gui_BarData[playerid][id][gui_bar_tdbg] = CreatePlayerTextDraw(playerid, x, y, "_");
- PlayerTextDrawBackgroundColor(playerid, gui_BarData[playerid][id][gui_bar_tdbg], 255);
- PlayerTextDrawFont(playerid, gui_BarData[playerid][id][gui_bar_tdbg], 1);
- PlayerTextDrawLetterSize(playerid, gui_BarData[playerid][id][gui_bar_tdbg], 0.0, height*UNIT);
- PlayerTextDrawColor(playerid, gui_BarData[playerid][id][gui_bar_tdbg], -1);
- PlayerTextDrawSetOutline(playerid, gui_BarData[playerid][id][gui_bar_tdbg], 1);
- PlayerTextDrawSetProportional(playerid, gui_BarData[playerid][id][gui_bar_tdbg], 1);
- PlayerTextDrawUseBox(playerid, gui_BarData[playerid][id][gui_bar_tdbg], 1);
- PlayerTextDrawBoxColor(playerid, gui_BarData[playerid][id][gui_bar_tdbg], color_bg);
- PlayerTextDrawTextSize(playerid, gui_BarData[playerid][id][gui_bar_tdbg], x+width, 0.000000);
- gui_BarData[playerid][id][gui_bar_tdbox] = CreatePlayerTextDraw(playerid, x+2.0, y+2.0, "_");
- PlayerTextDrawBackgroundColor(playerid, gui_BarData[playerid][id][gui_bar_tdbox], 255);
- PlayerTextDrawFont(playerid, gui_BarData[playerid][id][gui_bar_tdbox], 1);
- PlayerTextDrawLetterSize(playerid, gui_BarData[playerid][id][gui_bar_tdbox], 0.0, (height*UNIT)-(4.0*UNIT));
- PlayerTextDrawColor(playerid, gui_BarData[playerid][id][gui_bar_tdbox], -1);
- PlayerTextDrawSetOutline(playerid, gui_BarData[playerid][id][gui_bar_tdbox], 1);
- PlayerTextDrawSetProportional(playerid, gui_BarData[playerid][id][gui_bar_tdbox], 1);
- PlayerTextDrawUseBox(playerid, gui_BarData[playerid][id][gui_bar_tdbox], 1);
- PlayerTextDrawBoxColor(playerid, gui_BarData[playerid][id][gui_bar_tdbox], color_box);
- PlayerTextDrawTextSize(playerid, gui_BarData[playerid][id][gui_bar_tdbox], x+width-2.0, 0.000000);
- gui_BarData[playerid][id][gui_bar_tdbar] = CreatePlayerTextDraw(playerid, x+2.0, y+2.0, "_");
- PlayerTextDrawBackgroundColor(playerid, gui_BarData[playerid][id][gui_bar_tdbar], 255);
- PlayerTextDrawFont(playerid, gui_BarData[playerid][id][gui_bar_tdbar], 1);
- PlayerTextDrawLetterSize(playerid, gui_BarData[playerid][id][gui_bar_tdbar], 0.0, (height*UNIT)-(4.0*UNIT));
- PlayerTextDrawColor(playerid, gui_BarData[playerid][id][gui_bar_tdbar], -1);
- PlayerTextDrawSetOutline(playerid, gui_BarData[playerid][id][gui_bar_tdbar], 1);
- PlayerTextDrawSetProportional(playerid, gui_BarData[playerid][id][gui_bar_tdbar], 1);
- PlayerTextDrawUseBox(playerid, gui_BarData[playerid][id][gui_bar_tdbar], 1);
- PlayerTextDrawBoxColor(playerid, gui_BarData[playerid][id][gui_bar_tdbar], color_bar);
- PlayerTextDrawTextSize(playerid, gui_BarData[playerid][id][gui_bar_tdbar], x+width-2.0, 0.000000);
- return gui_BarData[playerid][id][gui_bar_ID];
- }
- function guiProgressBarSetProgress(playerid, barid, Float:progress)
- {
- if (barid >= MAX_GUI) return 0;
- new r;
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_BarData[playerid][g][gui_bar_ID] == barid)
- {
- barid = g;
- r = 1;
- break;
- }
- }
- if (!r) return 0;
- if (!gui_BarData[playerid][barid][gui_bar_ID]) return 0;
- gui_BarData[playerid][barid][gui_bar_Progress] = progress;
- new Float:size = (gui_BarData[playerid][barid][gui_bar_X]+gui_BarData[playerid][barid][gui_bar_Width]-2.0) - gui_BarData[playerid][barid][gui_bar_X];
- size *= progress/100.0;
- PlayerTextDrawTextSize(gui_BarData[playerid][barid][gui_bar_P], gui_BarData[playerid][barid][gui_bar_tdbar], gui_BarData[playerid][barid][gui_bar_X]+size, 0.000000);
- if (GetTextDrawVisibilityForPlayer(gui_BarData[playerid][barid][gui_bar_P], gui_BarData[playerid][barid][gui_bar_tdbg]))
- {
- PlayerTextDrawShow(gui_BarData[playerid][barid][gui_bar_P], gui_BarData[playerid][barid][gui_bar_tdbg]);
- PlayerTextDrawShow(gui_BarData[playerid][barid][gui_bar_P], gui_BarData[playerid][barid][gui_bar_tdbox]);
- PlayerTextDrawShow(gui_BarData[playerid][barid][gui_bar_P], gui_BarData[playerid][barid][gui_bar_tdbar]);
- }
- /*for(new i; i < MAX_PLAYERS; i++)
- {
- if (!IsPlayerConnected(i)) continue;
- if (GetTextDrawVisibilityForPlayer(i, gui_BarData[barid][gui_bar_tdbg]))
- {
- PlayerTextDrawShow(i, gui_BarData[barid][gui_bar_tdbg]);
- PlayerTextDrawShow(i, gui_BarData[barid][gui_bar_tdbox]);
- PlayerTextDrawShow(i, gui_BarData[barid][gui_bar_tdbar]);
- }
- }*/
- return 1;
- }
- function Float:guiProgressBarGetProgress(playerid, barid)
- {
- if (barid >= MAX_GUI) return -1.0;
- new r;
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_BarData[playerid][g][gui_bar_ID] == barid)
- {
- barid = g;
- r = 1;
- break;
- }
- }
- if (!r) return -1.0;
- if (!gui_BarData[playerid][barid][gui_bar_ID]) return -1.0;
- return gui_BarData[playerid][barid][gui_bar_Progress];
- }
- function guiCreateItemList(playerid, windowid, tabid, Float:x, Float:y, Float:height, Float:width, title[])
- {
- new id = -1, wind = windowid, t = tabid;
- for(new c; c < MAX_GUI; c++)
- {
- if (!gui_ItemlistData[playerid][c][gui_list_ID])
- {
- id = c;
- break;
- }
- }
- if (id == -1) return !printf("ERROR GUI: You cannot exceed the GUI item list limit! (%d)", MAX_GUI);
- if (windowid > 0) // If you set the tab under a GUI Window ...
- {
- windowid = guiGetID(playerid, GUI_TYPE_WINDOW, windowid);
- if (tabid > 0)
- {
- tabid = guiGetID(playerid, GUI_TYPE_TAB, tabid);
- new Float:offsetY = y;
- x += gui_TabData[playerid][tabid][gui_tab_panelX]-0.5;
- y += (gui_TabData[playerid][tabid][gui_tab_panelY]+3.0);
- if (height == 0.0) height = gui_TabData[playerid][tabid][gui_tab_Height] - (8.0*UNIT) - (2.0*UNIT) - (offsetY*UNIT);
- else height *= UNIT;
- if (width == 0.0) width = gui_TabData[playerid][tabid][gui_tab_Width]-7.5;
- else x = x-(gui_TabData[playerid][tabid][gui_tab_Width]/2)+(width/2)+4.0;
- }
- else
- {
- x += gui_WindowData[playerid][windowid][gui_win_X];
- y += (gui_WindowData[playerid][windowid][gui_win_Y]+10.5);
- if (height == 0.0) height = ( ((gui_WindowData[playerid][windowid][gui_win_SizeY])*UNIT) - (20.0)*UNIT ) - (4.0*UNIT);
- else height *= UNIT;
- if (width == 0.0) width = gui_WindowData[playerid][windowid][gui_win_SizeX]-3.0;
- else width += gui_WindowData[playerid][windowid][gui_win_SizeX];
- }
- }
- else height *= UNIT;
- gui_ItemlistData[playerid][id][gui_list_X] = x;
- gui_ItemlistData[playerid][id][gui_list_Y] = y;
- gui_ItemlistData[playerid][id][gui_list_Height] = height;
- gui_ItemlistData[playerid][id][gui_list_Width] = width;
- strins(gui_ItemlistData[playerid][id][gui_list_Title], title, 0);
- gui_ItemlistData[playerid][id][gui_list_Window] = wind;
- gui_ItemlistData[playerid][id][gui_list_Tab] = t;
- gui_ItemlistData[playerid][id][gui_list_RowX] = x-(width/2) + 2.0;
- gui_ItemlistData[playerid][id][gui_list_RowY] = y+9.0;
- gui_ItemlistData[playerid][id][gui_list_RowMax] = 1;
- gui_ItemlistData[playerid][id][gui_list_Type] = GUI_TYPE_ITEMLIST;
- gui_ItemlistData[playerid][id][gui_list_P] = playerid;
- gui_ItemlistData[playerid][id][gui_list_ID] = id+1;
- gui_ItemlistData[playerid][id][gui_list_tdbox] = CreatePlayerTextDraw(playerid, x, y, "_");
- PlayerTextDrawAlignment(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], 255);
- PlayerTextDrawFont(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], 2);
- PlayerTextDrawLetterSize(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], 0.199998, height);
- PlayerTextDrawColor(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], -1);
- PlayerTextDrawSetOutline(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], 0);
- PlayerTextDrawSetProportional(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], 1);
- PlayerTextDrawSetShadow(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], 0);
- PlayerTextDrawUseBox(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], 1);
- PlayerTextDrawBoxColor(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], 255);
- PlayerTextDrawTextSize(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], 0.0, width);
- PlayerTextDrawSetPreviewModel(playerid, gui_ItemlistData[playerid][id][gui_list_tdbox], 0);
- gui_ItemlistData[playerid][id][gui_list_tdline] = CreatePlayerTextDraw(playerid, x, y+6.0, "_");
- PlayerTextDrawAlignment(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], 255);
- PlayerTextDrawFont(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], 1);
- PlayerTextDrawLetterSize(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], 0.199998, -0.200004);
- PlayerTextDrawColor(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], -1);
- PlayerTextDrawSetOutline(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], 0);
- PlayerTextDrawSetProportional(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], 1);
- PlayerTextDrawSetShadow(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], 0);
- PlayerTextDrawUseBox(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], 1);
- PlayerTextDrawBoxColor(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], -1);
- PlayerTextDrawTextSize(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], 0.0, width-4.0);
- PlayerTextDrawSetPreviewModel(playerid, gui_ItemlistData[playerid][id][gui_list_tdline], 0);
- gui_ItemlistData[playerid][id][gui_list_tdtitle] = CreatePlayerTextDraw(playerid, x, y-2.0, title);
- PlayerTextDrawAlignment(playerid, gui_ItemlistData[playerid][id][gui_list_tdtitle], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_ItemlistData[playerid][id][gui_list_tdtitle], 255);
- PlayerTextDrawFont(playerid, gui_ItemlistData[playerid][id][gui_list_tdtitle], 2);
- PlayerTextDrawLetterSize(playerid, gui_ItemlistData[playerid][id][gui_list_tdtitle], 0.139998, 0.799995);
- PlayerTextDrawColor(playerid, gui_ItemlistData[playerid][id][gui_list_tdtitle], -1);
- PlayerTextDrawSetOutline(playerid, gui_ItemlistData[playerid][id][gui_list_tdtitle], 0);
- PlayerTextDrawSetProportional(playerid, gui_ItemlistData[playerid][id][gui_list_tdtitle], 1);
- PlayerTextDrawSetShadow(playerid, gui_ItemlistData[playerid][id][gui_list_tdtitle], 0);
- PlayerTextDrawSetPreviewModel(playerid, gui_ItemlistData[playerid][id][gui_list_tdtitle], 0);
- return gui_ItemlistData[playerid][id][gui_list_ID];
- }
- function guiItemListAddRow(playerid, listid, text[])
- {
- if (!(listid > 0)) return !print("ERROR GUI: Item row must be placed under a list id!");
- new id = -1, l = listid;
- for(new c; c < MAX_GUI; c++)
- {
- if (!gui_ItemRowData[playerid][c][gui_row_ID])
- {
- id = c;
- break;
- }
- }
- if (id == -1) return !printf("ERROR GUI: You cannot exceed the GUI item row limit! (%d)", MAX_GUI);
- listid = guiGetID(playerid, GUI_TYPE_ITEMLIST, listid);
- gui_ItemRowData[playerid][id][gui_row_X] = gui_ItemlistData[playerid][listid][gui_list_RowX];
- gui_ItemRowData[playerid][id][gui_row_Y] = gui_ItemlistData[playerid][listid][gui_list_RowY];
- gui_ItemRowData[playerid][id][gui_row_Height] = 8.5;
- gui_ItemRowData[playerid][id][gui_row_Width] = gui_ItemRowData[playerid][id][gui_row_X]+gui_ItemlistData[playerid][listid][gui_list_Width] - 4.0;
- strins(gui_ItemRowData[playerid][id][gui_row_Text], text, 0);
- gui_ItemRowData[playerid][id][gui_row_List] = l;
- gui_ItemRowData[playerid][id][gui_row_Order] = gui_ItemlistData[playerid][listid][gui_list_RowMax];
- gui_ItemRowData[playerid][id][gui_row_ID] = id+1;
- gui_ItemlistData[playerid][listid][gui_list_RowY] += 9.5;
- gui_ItemlistData[playerid][listid][gui_list_RowMax]++;
- //printf("ADD: %d %s %.2f", playerid, text, gui_ItemRowData[playerid][id][gui_row_Y]);
- gui_ItemRowData[playerid][id][gui_row_td] = CreatePlayerTextDraw(playerid, gui_ItemRowData[playerid][id][gui_row_X], gui_ItemRowData[playerid][id][gui_row_Y], text);
- PlayerTextDrawBackgroundColor(playerid, gui_ItemRowData[playerid][id][gui_row_td], 55);
- PlayerTextDrawFont(playerid, gui_ItemRowData[playerid][id][gui_row_td], 1);
- PlayerTextDrawLetterSize(playerid, gui_ItemRowData[playerid][id][gui_row_td], 0.175000, gui_ItemRowData[playerid][id][gui_row_Height]*UNIT);
- PlayerTextDrawColor(playerid, gui_ItemRowData[playerid][id][gui_row_td], -1);
- PlayerTextDrawSetOutline(playerid, gui_ItemRowData[playerid][id][gui_row_td], 1);
- PlayerTextDrawSetProportional(playerid, gui_ItemRowData[playerid][id][gui_row_td], 1);
- PlayerTextDrawUseBox(playerid, gui_ItemRowData[playerid][id][gui_row_td], 1);
- PlayerTextDrawBoxColor(playerid, gui_ItemRowData[playerid][id][gui_row_td], 0x00000000);
- PlayerTextDrawTextSize(playerid, gui_ItemRowData[playerid][id][gui_row_td], gui_ItemRowData[playerid][id][gui_row_Width], gui_ItemRowData[playerid][id][gui_row_Height]);
- PlayerTextDrawSetSelectable(playerid, gui_ItemRowData[playerid][id][gui_row_td], 1);
- gui_ItemRowData[playerid][id][gui_row_td2] = CreatePlayerTextDraw(playerid, gui_ItemRowData[playerid][id][gui_row_X], gui_ItemRowData[playerid][id][gui_row_Y], text);
- PlayerTextDrawBackgroundColor(playerid, gui_ItemRowData[playerid][id][gui_row_td2], 55);
- PlayerTextDrawFont(playerid, gui_ItemRowData[playerid][id][gui_row_td2], 1);
- PlayerTextDrawLetterSize(playerid, gui_ItemRowData[playerid][id][gui_row_td2], 0.175000, gui_ItemRowData[playerid][id][gui_row_Height]*UNIT);
- PlayerTextDrawColor(playerid, gui_ItemRowData[playerid][id][gui_row_td2], -1);
- PlayerTextDrawSetOutline(playerid, gui_ItemRowData[playerid][id][gui_row_td2], 1);
- PlayerTextDrawSetProportional(playerid, gui_ItemRowData[playerid][id][gui_row_td2], 1);
- PlayerTextDrawUseBox(playerid, gui_ItemRowData[playerid][id][gui_row_td2], 1);
- PlayerTextDrawBoxColor(playerid, gui_ItemRowData[playerid][id][gui_row_td2], 0xFF000033);
- PlayerTextDrawTextSize(playerid, gui_ItemRowData[playerid][id][gui_row_td2], gui_ItemRowData[playerid][id][gui_row_Width], gui_ItemRowData[playerid][id][gui_row_Height]);
- return gui_ItemRowData[playerid][id][gui_row_ID];
- }
- function guiItemListRemoveRow(playerid, listid, rowid)
- {
- if (!(listid > 0)) return !print("ERROR GUI: Itemlist ID required to remove row!");
- if (!(rowid > 0)) return !print("ERROR GUI: Row ID required to remove row!");
- new l = listid;
- listid = guiGetID(playerid, GUI_TYPE_ITEMLIST, listid);
- new id = -1;
- for(new r; r <= gui_ItemlistData[playerid][listid][gui_list_RowMax]; r++)
- {
- //printf("ROW: %d ID: %d", r, gui_ItemRowData[playerid][r][gui_row_ID]);
- if (gui_ItemRowData[playerid][r][gui_row_ID] == rowid)
- {
- rowid = r;
- id = 1;
- break;
- }
- }
- if (id == -1) return !printf("ERROR GUI: Invalid row ID. (%d)",rowid);
-
- for(new r; r <= gui_ItemlistData[playerid][listid][gui_list_RowMax]; r++)
- {
- if (!gui_ItemRowData[playerid][r][gui_row_ID]) continue;
- if (gui_ItemRowData[playerid][r][gui_row_List] != l) continue;
- if (gui_ItemRowData[playerid][r][gui_row_Order] > gui_ItemRowData[playerid][rowid][gui_row_Order])
- {
- gui_ItemRowData[playerid][r][gui_row_Y] -= 9.5;
- gui_ItemRowData[playerid][r][gui_row_Order]--;
- PlayerTextDrawDestroy(playerid, gui_ItemRowData[playerid][r][gui_row_td]);
- gui_ItemRowData[playerid][r][gui_row_td] = CreatePlayerTextDraw(playerid, gui_ItemRowData[playerid][r][gui_row_X], gui_ItemRowData[playerid][r][gui_row_Y], gui_ItemRowData[playerid][r][gui_row_Text]);
- PlayerTextDrawBackgroundColor(playerid, gui_ItemRowData[playerid][r][gui_row_td], 55);
- PlayerTextDrawFont(playerid, gui_ItemRowData[playerid][r][gui_row_td], 1);
- PlayerTextDrawLetterSize(playerid, gui_ItemRowData[playerid][r][gui_row_td], 0.175000, gui_ItemRowData[playerid][r][gui_row_Height]*UNIT);
- PlayerTextDrawColor(playerid, gui_ItemRowData[playerid][r][gui_row_td], -1);
- PlayerTextDrawSetOutline(playerid, gui_ItemRowData[playerid][r][gui_row_td], 1);
- PlayerTextDrawSetProportional(playerid, gui_ItemRowData[playerid][r][gui_row_td], 1);
- PlayerTextDrawUseBox(playerid, gui_ItemRowData[playerid][r][gui_row_td], 1);
- PlayerTextDrawBoxColor(playerid, gui_ItemRowData[playerid][r][gui_row_td], 0x00000000);
- PlayerTextDrawTextSize(playerid, gui_ItemRowData[playerid][r][gui_row_td], gui_ItemRowData[playerid][r][gui_row_Width], gui_ItemRowData[playerid][r][gui_row_Height]);
- PlayerTextDrawSetSelectable(playerid, gui_ItemRowData[playerid][r][gui_row_td], 1);
- PlayerTextDrawDestroy(playerid, gui_ItemRowData[playerid][r][gui_row_td2]);
- gui_ItemRowData[playerid][r][gui_row_td2] = CreatePlayerTextDraw(playerid, gui_ItemRowData[playerid][r][gui_row_X], gui_ItemRowData[playerid][r][gui_row_Y], gui_ItemRowData[playerid][r][gui_row_Text]);
- PlayerTextDrawBackgroundColor(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 55);
- PlayerTextDrawFont(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 1);
- PlayerTextDrawLetterSize(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 0.175000, gui_ItemRowData[playerid][r][gui_row_Height]*UNIT);
- PlayerTextDrawColor(playerid, gui_ItemRowData[playerid][r][gui_row_td2], -1);
- PlayerTextDrawSetOutline(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 1);
- PlayerTextDrawSetProportional(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 1);
- PlayerTextDrawUseBox(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 1);
- PlayerTextDrawBoxColor(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 0xFF000033);
- PlayerTextDrawTextSize(playerid, gui_ItemRowData[playerid][r][gui_row_td2], gui_ItemRowData[playerid][r][gui_row_Width], gui_ItemRowData[playerid][r][gui_row_Height]);
- }
- }
- if (id)
- {
- if (GetTextDrawVisibilityForPlayer(playerid, gui_ItemRowData[playerid][rowid][gui_row_td]))
- {
- for(new r; r <= gui_ItemlistData[playerid][listid][gui_list_RowMax]; r++)
- {
- if (!gui_ItemRowData[playerid][r][gui_row_ID]) continue;
- if (gui_ItemRowData[playerid][r][gui_row_List] != l) continue;
- if (gui_ItemRowData[playerid][r][gui_row_Order] >= gui_ItemRowData[playerid][rowid][gui_row_Order])
- PlayerTextDrawShow(playerid, gui_ItemRowData[playerid][r][gui_row_td]);
- }
- }
- TextDrawDestroyEx(playerid, gui_ItemRowData[playerid][rowid][gui_row_td]);
- TextDrawDestroyEx(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2]);
- strdel(gui_ItemRowData[playerid][rowid][gui_row_Text], 0, strlen(gui_ItemRowData[playerid][rowid][gui_row_Text]));
- gui_ItemRowData[playerid][rowid][gui_row_ID] = 0;
- gui_ItemRowData[playerid][rowid][gui_row_X] = 0.0;
- gui_ItemRowData[playerid][rowid][gui_row_Y] = 0.0;
- gui_ItemRowData[playerid][rowid][gui_row_Height] = 0.0;
- gui_ItemRowData[playerid][rowid][gui_row_Width] = 0.0;
- gui_ItemRowData[playerid][rowid][gui_row_List] = 0;
- gui_ItemRowData[playerid][rowid][gui_row_Order] = 0;
- gui_ItemlistData[playerid][listid][gui_list_RowY] -= 9.5;
- gui_ItemlistData[playerid][listid][gui_list_RowMax]--;
- return 1;
- }
- return 0;
- }
- function guiItemListSetRowOrder(playerid, listid, rowid, orderid)
- {
- if (!(listid > 0)) return !print("ERROR GUI: Itemlist ID required to remove row!");
- if (!(rowid > 0)) return !print("ERROR GUI: Row ID required to remove row!");
- new id = -1, l = listid;
- listid = guiGetID(playerid, GUI_TYPE_ITEMLIST, listid);
- if (listid == -1) return !print("ERROR GUI: Invalid list ID.");
- for(new r; r <= gui_ItemlistData[playerid][listid][gui_list_RowMax]; r++)
- {
- if (gui_ItemRowData[playerid][r][gui_row_ID] == rowid)
- {
- rowid = r;
- id = 1;
- break;
- }
- }
- if (id == -1) return !print("ERROR GUI: Invalid row ID.");
- if (orderid == gui_ItemRowData[playerid][rowid][gui_row_Order]) return 0;
- new current = gui_ItemRowData[playerid][rowid][gui_row_Order];
-
- for(new r; r <= gui_ItemlistData[playerid][listid][gui_list_RowMax]; r++)
- {
- if (!gui_ItemRowData[playerid][r][gui_row_ID]) continue;
- if (gui_ItemRowData[playerid][r][gui_row_List] != l) continue;
- new oldid;
- oldid = gui_ItemRowData[playerid][r][gui_row_Order];
- if (gui_ItemRowData[playerid][r][gui_row_Order] == orderid && orderid > current) gui_ItemRowData[playerid][r][gui_row_Order]--;
- else if (gui_ItemRowData[playerid][r][gui_row_Order] == orderid && orderid < current) gui_ItemRowData[playerid][r][gui_row_Order]++;
- else if (gui_ItemRowData[playerid][r][gui_row_Order] >= orderid && orderid < current && gui_ItemRowData[playerid][r][gui_row_Order] < current) gui_ItemRowData[playerid][r][gui_row_Order]++;
- else if (gui_ItemRowData[playerid][r][gui_row_Order] <= orderid && orderid > current && gui_ItemRowData[playerid][r][gui_row_Order] > current) gui_ItemRowData[playerid][r][gui_row_Order]--;
- else if (gui_ItemRowData[playerid][r][gui_row_Order] <= orderid && orderid == current && gui_ItemRowData[playerid][r][gui_row_Order] > current) gui_ItemRowData[playerid][r][gui_row_Order]--;
- new Float:y = 9.0*gui_ItemRowData[playerid][r][gui_row_Order];
- gui_ItemRowData[playerid][r][gui_row_Y] = (gui_ItemRowData[playerid][r][gui_row_Y]-(9.0*oldid))+y;
- PlayerTextDrawDestroy(playerid, gui_ItemRowData[playerid][r][gui_row_td]);
- gui_ItemRowData[playerid][r][gui_row_td] = CreatePlayerTextDraw(playerid, gui_ItemRowData[playerid][r][gui_row_X], gui_ItemRowData[playerid][r][gui_row_Y], gui_ItemRowData[playerid][r][gui_row_Text]);
- PlayerTextDrawBackgroundColor(playerid, gui_ItemRowData[playerid][r][gui_row_td], 55);
- PlayerTextDrawFont(playerid, gui_ItemRowData[playerid][r][gui_row_td], 1);
- PlayerTextDrawLetterSize(playerid, gui_ItemRowData[playerid][r][gui_row_td], 0.150000, gui_ItemRowData[playerid][r][gui_row_Height]*UNIT);
- PlayerTextDrawColor(playerid, gui_ItemRowData[playerid][r][gui_row_td], -1);
- PlayerTextDrawSetOutline(playerid, gui_ItemRowData[playerid][r][gui_row_td], 1);
- PlayerTextDrawSetProportional(playerid, gui_ItemRowData[playerid][r][gui_row_td], 1);
- PlayerTextDrawUseBox(playerid, gui_ItemRowData[playerid][r][gui_row_td], 1);
- PlayerTextDrawBoxColor(playerid, gui_ItemRowData[playerid][r][gui_row_td], 0x00000000);
- PlayerTextDrawTextSize(playerid, gui_ItemRowData[playerid][r][gui_row_td], gui_ItemRowData[playerid][r][gui_row_Width], gui_ItemRowData[playerid][r][gui_row_Height]);
- PlayerTextDrawSetSelectable(playerid, gui_ItemRowData[playerid][r][gui_row_td], 1);
- PlayerTextDrawDestroy(playerid, gui_ItemRowData[playerid][r][gui_row_td2]);
- gui_ItemRowData[playerid][r][gui_row_td2] = CreatePlayerTextDraw(playerid, gui_ItemRowData[playerid][r][gui_row_X], gui_ItemRowData[playerid][r][gui_row_Y], gui_ItemRowData[playerid][r][gui_row_Text]);
- PlayerTextDrawBackgroundColor(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 55);
- PlayerTextDrawFont(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 1);
- PlayerTextDrawLetterSize(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 0.150000, gui_ItemRowData[playerid][r][gui_row_Height]*UNIT);
- PlayerTextDrawColor(playerid, gui_ItemRowData[playerid][r][gui_row_td2], -1);
- PlayerTextDrawSetOutline(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 1);
- PlayerTextDrawSetProportional(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 1);
- PlayerTextDrawUseBox(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 1);
- PlayerTextDrawBoxColor(playerid, gui_ItemRowData[playerid][r][gui_row_td2], 0xFF000033);
- PlayerTextDrawTextSize(playerid, gui_ItemRowData[playerid][r][gui_row_td2], gui_ItemRowData[playerid][r][gui_row_Width], gui_ItemRowData[playerid][r][gui_row_Height]);
- }
- if (id)
- {
- gui_ItemRowData[playerid][rowid][gui_row_Y] = (gui_ItemRowData[playerid][rowid][gui_row_Y]-(9.0*gui_ItemRowData[playerid][rowid][gui_row_Order]))+(9.0*orderid);
- PlayerTextDrawDestroy(playerid, gui_ItemRowData[playerid][rowid][gui_row_td]);
- gui_ItemRowData[playerid][rowid][gui_row_td] = CreatePlayerTextDraw(playerid, gui_ItemRowData[playerid][rowid][gui_row_X], gui_ItemRowData[playerid][rowid][gui_row_Y], gui_ItemRowData[playerid][rowid][gui_row_Text]);
- PlayerTextDrawBackgroundColor(playerid, gui_ItemRowData[playerid][rowid][gui_row_td], 55);
- PlayerTextDrawFont(playerid, gui_ItemRowData[playerid][rowid][gui_row_td], 1);
- PlayerTextDrawLetterSize(playerid, gui_ItemRowData[playerid][rowid][gui_row_td], 0.150000, gui_ItemRowData[playerid][rowid][gui_row_Height]*UNIT);
- PlayerTextDrawColor(playerid, gui_ItemRowData[playerid][rowid][gui_row_td], -1);
- PlayerTextDrawSetOutline(playerid, gui_ItemRowData[playerid][rowid][gui_row_td], 1);
- PlayerTextDrawSetProportional(playerid, gui_ItemRowData[playerid][rowid][gui_row_td], 1);
- PlayerTextDrawUseBox(playerid, gui_ItemRowData[playerid][rowid][gui_row_td], 1);
- PlayerTextDrawBoxColor(playerid, gui_ItemRowData[playerid][rowid][gui_row_td], 0x00000000);
- PlayerTextDrawTextSize(playerid, gui_ItemRowData[playerid][rowid][gui_row_td], gui_ItemRowData[playerid][rowid][gui_row_Width], gui_ItemRowData[playerid][rowid][gui_row_Height]);
- PlayerTextDrawSetSelectable(playerid, gui_ItemRowData[playerid][rowid][gui_row_td], 1);
- PlayerTextDrawDestroy(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2]);
- gui_ItemRowData[playerid][rowid][gui_row_td2] = CreatePlayerTextDraw(playerid, gui_ItemRowData[playerid][rowid][gui_row_X], gui_ItemRowData[playerid][rowid][gui_row_Y], gui_ItemRowData[playerid][rowid][gui_row_Text]);
- PlayerTextDrawBackgroundColor(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2], 55);
- PlayerTextDrawFont(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2], 1);
- PlayerTextDrawLetterSize(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2], 0.150000, gui_ItemRowData[playerid][rowid][gui_row_Height]*UNIT);
- PlayerTextDrawColor(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2], -1);
- PlayerTextDrawSetOutline(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2], 1);
- PlayerTextDrawSetProportional(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2], 1);
- PlayerTextDrawUseBox(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2], 1);
- PlayerTextDrawBoxColor(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2], 0xFF000033);
- PlayerTextDrawTextSize(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2], gui_ItemRowData[playerid][rowid][gui_row_Width], gui_ItemRowData[playerid][rowid][gui_row_Height]);
- if (GetTextDrawVisibilityForPlayer(playerid, gui_ItemRowData[playerid][rowid][gui_row_td]) || GetTextDrawVisibilityForPlayer(playerid, gui_ItemRowData[playerid][rowid][gui_row_td2]))
- {
- PlayerTextDrawShow(playerid, gui_ItemRowData[playerid][rowid][gui_row_td]);
- for(new r; r <= gui_ItemlistData[playerid][listid][gui_list_RowMax]; r++)
- {
- if (!gui_ItemRowData[playerid][r][gui_row_ID]) continue;
- if (gui_ItemRowData[playerid][r][gui_row_List] != l) continue;
- if (p_row[playerid] == r) PlayerTextDrawShow(playerid, gui_ItemRowData[playerid][r][gui_row_td2]);
- else PlayerTextDrawShow(playerid, gui_ItemRowData[playerid][r][gui_row_td]);
- }
- }
- gui_ItemRowData[playerid][rowid][gui_row_Order] = orderid;
- return 1;
- }
- return 0;
- }
- function guiItemListGetSelectedRow(playerid)
- {
- return gui_ItemRowData[playerid][p_row[playerid]][gui_row_ID];
- }
- function guiItemListGetRowText(playerid, listid, rowid, string[])
- {
- if (rowid >= MAX_GUI || listid >= MAX_GUI) return 0;
- new r;
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ItemRowData[playerid][g][gui_row_ID] == rowid && gui_ItemRowData[playerid][g][gui_row_List] == listid)
- {
- rowid = g;
- r = 1;
- break;
- }
- }
- if (!r) return 0;
- if (!gui_ItemRowData[playerid][rowid][gui_row_ID]) return 0;
- strins(string, gui_ItemRowData[playerid][rowid][gui_row_Text], 0, strlen(gui_ItemRowData[playerid][rowid][gui_row_Text]));
- return 1;
- }
- function guiItemListGetCount(playerid, listid)
- {
- if (listid >= MAX_GUI) return 0;
- new r;
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ItemlistData[playerid][g][gui_list_ID] == listid)
- {
- listid = g;
- r = 1;
- break;
- }
- }
- if (!r) return 0;
- if (!gui_ItemlistData[playerid][listid][gui_list_ID]) return 0;
- return gui_ItemlistData[playerid][listid][gui_list_RowMax];
- }
- function guiItemListGetRowList(playerid, rowid)
- {
- if (rowid >= MAX_GUI) return 0;
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ItemRowData[playerid][g][gui_row_ID] == rowid)
- {
- return gui_ItemRowData[playerid][g][gui_row_List];
- }
- }
- return 0;
- }
- function guiCreateCheckBox(playerid, windowid, tabid, Float:x, Float:y)
- {
- new id = -1, wind = windowid, t = tabid;
- for(new c; c < MAX_GUI; c++)
- {
- if (!gui_CheckboxData[playerid][c][gui_check_ID])
- {
- id = c;
- break;
- }
- }
- if (id == -1) return !printf("ERROR GUI: You cannot exceed the GUI checkbox limit! (%d)", MAX_GUI);
- if (windowid > 0) // If you set the tab under a GUI Window ...
- {
- windowid = guiGetID(playerid, GUI_TYPE_WINDOW, windowid);
- if (tabid > 0)
- {
- tabid = guiGetID(playerid, GUI_TYPE_TAB, tabid);
- x += (gui_TabData[playerid][tabid][gui_tab_panelX] - (gui_TabData[playerid][tabid][gui_tab_Width]/2) + 4.0);
- y += (gui_TabData[playerid][tabid][gui_tab_panelY] +2.0);
- }
- else
- {
- x += gui_WindowData[playerid][windowid][gui_win_X];
- y += (gui_WindowData[playerid][windowid][gui_win_Y]+10.5);
- }
- }
- gui_CheckboxData[playerid][id][gui_check_X] = x;
- gui_CheckboxData[playerid][id][gui_check_Y] = y;
- gui_CheckboxData[playerid][id][gui_check_Window] = wind;
- gui_CheckboxData[playerid][id][gui_check_Tab] = t;
- gui_CheckboxData[playerid][id][gui_check_Type] = GUI_TYPE_CHECKBOX;
- gui_CheckboxData[playerid][id][gui_check_P] = playerid;
- gui_CheckboxData[playerid][id][gui_check_ID] = id+1;
- gui_CheckboxData[playerid][id][gui_check_td] = CreatePlayerTextDraw(playerid, x, y, "O");
- PlayerTextDrawBackgroundColor(playerid, gui_CheckboxData[playerid][id][gui_check_td], 0xFFFFFFFF);
- PlayerTextDrawFont(playerid, gui_CheckboxData[playerid][id][gui_check_td], 1);
- PlayerTextDrawLetterSize(playerid, gui_CheckboxData[playerid][id][gui_check_td], 0.179998, 0.800000);
- PlayerTextDrawColor(playerid, gui_CheckboxData[playerid][id][gui_check_td], 0xFFFFFFFF);
- PlayerTextDrawSetOutline(playerid, gui_CheckboxData[playerid][id][gui_check_td], 1);
- PlayerTextDrawSetProportional(playerid, gui_CheckboxData[playerid][id][gui_check_td], 1);
- PlayerTextDrawTextSize(playerid, gui_CheckboxData[playerid][id][gui_check_td], x+8.0, 10.0);
- PlayerTextDrawSetSelectable(playerid, gui_CheckboxData[playerid][id][gui_check_td], 1);
- //printf("%f %f", x, y);
- gui_CheckboxData[playerid][id][gui_check_td2] = CreatePlayerTextDraw(playerid, x, y, "O");
- PlayerTextDrawBackgroundColor(playerid, gui_CheckboxData[playerid][id][gui_check_td2], 0xFFFFFFFF);
- PlayerTextDrawFont(playerid, gui_CheckboxData[playerid][id][gui_check_td2], 1);
- PlayerTextDrawLetterSize(playerid, gui_CheckboxData[playerid][id][gui_check_td2], 0.179998, 0.800000);
- PlayerTextDrawColor(playerid, gui_CheckboxData[playerid][id][gui_check_td2], 0x00000000);
- PlayerTextDrawSetOutline(playerid, gui_CheckboxData[playerid][id][gui_check_td2], 1);
- PlayerTextDrawSetProportional(playerid, gui_CheckboxData[playerid][id][gui_check_td2], 1);
- PlayerTextDrawTextSize(playerid, gui_CheckboxData[playerid][id][gui_check_td2], x+8.0, 10.0);
- PlayerTextDrawSetSelectable(playerid, gui_CheckboxData[playerid][id][gui_check_td2], 1);
- return gui_CheckboxData[playerid][id][gui_check_ID];
- }
- function guiCheckBoxGetSelected(playerid, checkboxid)
- {
- if (checkboxid >= MAX_GUI) return -1;
- new r;
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_CheckboxData[playerid][g][gui_check_ID] == checkboxid)
- {
- checkboxid = g;
- r = 1;
- break;
- }
- }
- if (!r) return -1;
- if (!gui_CheckboxData[playerid][checkboxid][gui_check_ID]) return -1;
- return GetTextDrawVisibilityForPlayer(playerid, gui_CheckboxData[playerid][checkboxid][gui_check_td2]);
- }
- function guiCheckBoxSetSelected(playerid, checkboxid)
- {
- if (checkboxid >= MAX_GUI) return 0;
- new r;
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_CheckboxData[playerid][g][gui_check_ID] == checkboxid)
- {
- checkboxid = g;
- r = 1;
- break;
- }
- }
- if (!r) return 0;
- if (!gui_CheckboxData[playerid][checkboxid][gui_check_ID]) return 0;
- PlayerTextDrawHide(playerid, gui_CheckboxData[playerid][checkboxid][gui_check_td]);
- PlayerTextDrawShow(playerid, gui_CheckboxData[playerid][checkboxid][gui_check_td2]);
- return 1;
- }
- function guiGetCheckBoxPos(playerid, checkboxid, &Float:x, &Float:y)
- {
- if (checkboxid >= MAX_GUI) return 0;
- new r;
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_CheckboxData[playerid][g][gui_check_ID] == checkboxid)
- {
- checkboxid = g;
- r = 1;
- break;
- }
- }
- if (!r) return 0;
- if (!gui_CheckboxData[playerid][checkboxid][gui_check_ID]) return 0;
- x = gui_CheckboxData[playerid][checkboxid][gui_check_X];
- y = gui_CheckboxData[playerid][checkboxid][gui_check_Y];
- return 1;
- }
- function guiCreateButton(playerid, windowid, tabid, Float:x, Float:y, Float:height, Float:width, text[])
- {
- new id = -1, wind = windowid, t = tabid;
- for(new c; c < MAX_GUI; c++)
- {
- if (!gui_ButtonData[playerid][c][gui_but_ID])
- {
- id = c;
- break;
- }
- }
- if (id == -1) return !printf("ERROR GUI: You cannot exceed the GUI button limit! (%d)", MAX_GUI);
- if (windowid > 0) // If you set the label under a GUI Window ...
- {
- windowid = guiGetID(playerid, GUI_TYPE_WINDOW, windowid);
- if (tabid > 0) // if it's under a tab panel
- {
- tabid = guiGetID(playerid, GUI_TYPE_TAB, tabid);
- x += (gui_TabData[playerid][tabid][gui_tab_panelX]-(gui_TabData[playerid][tabid][gui_tab_Width]/2))+10.0;
- y += (gui_TabData[playerid][tabid][gui_tab_panelY]-(gui_TabData[playerid][tabid][gui_tab_Height]/2))+6.0; // relative positioning
- }
- else // only under a window gui
- {
- x += (gui_WindowData[playerid][windowid][gui_win_X]-(gui_WindowData[playerid][windowid][gui_win_SizeX]/2));
- y += (gui_WindowData[playerid][windowid][gui_win_Y]+7.0); // relative positioning
- }
- }
- new Float:len = strlen(text)*4.0;
- if (width == 0.0) width = len+16.0;
- if (height == 0.0) height = 20.0;
- x += (width/2)-8.0;
- gui_ButtonData[playerid][id][gui_but_X] = x;
- gui_ButtonData[playerid][id][gui_but_Y] = y;
- gui_ButtonData[playerid][id][gui_but_Height] = height;
- gui_ButtonData[playerid][id][gui_but_Width] = width;
- gui_ButtonData[playerid][id][gui_but_Window] = wind;
- gui_ButtonData[playerid][id][gui_but_Tab] = t;
- strins(gui_ButtonData[playerid][id][gui_but_Text], text, 0);
- gui_ButtonData[playerid][id][gui_but_Type] = GUI_TYPE_BUTTON;
- gui_ButtonData[playerid][id][gui_but_P] = playerid;
- gui_ButtonData[playerid][id][gui_but_ID] = id+1;
- gui_ButtonData[playerid][id][gui_but_tdbg] = CreatePlayerTextDraw(playerid, x, y, "_");
- PlayerTextDrawAlignment(playerid, gui_ButtonData[playerid][id][gui_but_tdbg], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_ButtonData[playerid][id][gui_but_tdbg], 255);
- PlayerTextDrawFont(playerid, gui_ButtonData[playerid][id][gui_but_tdbg], 1);
- PlayerTextDrawLetterSize(playerid, gui_ButtonData[playerid][id][gui_but_tdbg], 0.179998, (height*UNIT));
- PlayerTextDrawColor(playerid, gui_ButtonData[playerid][id][gui_but_tdbg], -1);
- PlayerTextDrawSetOutline(playerid, gui_ButtonData[playerid][id][gui_but_tdbg], 1);
- PlayerTextDrawSetProportional(playerid, gui_ButtonData[playerid][id][gui_but_tdbg], 1);
- PlayerTextDrawUseBox(playerid, gui_ButtonData[playerid][id][gui_but_tdbg], 1);
- PlayerTextDrawBoxColor(playerid, gui_ButtonData[playerid][id][gui_but_tdbg], 255);
- PlayerTextDrawTextSize(playerid, gui_ButtonData[playerid][id][gui_but_tdbg], height, width);
- PlayerTextDrawSetSelectable(playerid, gui_ButtonData[playerid][id][gui_but_tdbg], 1);
- gui_ButtonData[playerid][id][gui_but_tdout] = CreatePlayerTextDraw(playerid, x, y+1.0, "_");
- PlayerTextDrawAlignment(playerid, gui_ButtonData[playerid][id][gui_but_tdout], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_ButtonData[playerid][id][gui_but_tdout], 255);
- PlayerTextDrawFont(playerid, gui_ButtonData[playerid][id][gui_but_tdout], 1);
- PlayerTextDrawLetterSize(playerid, gui_ButtonData[playerid][id][gui_but_tdout], 0.159998, (height*UNIT)-0.25);
- //PlayerTextDrawLetterSize(playerid, gui_ButtonData[playerid][id][gui_but_tdout], 0.159998, ((height-2.0)*UNIT));
- PlayerTextDrawColor(playerid, gui_ButtonData[playerid][id][gui_but_tdout], -1);
- PlayerTextDrawSetOutline(playerid, gui_ButtonData[playerid][id][gui_but_tdout], 1);
- PlayerTextDrawSetProportional(playerid, gui_ButtonData[playerid][id][gui_but_tdout], 1);
- PlayerTextDrawUseBox(playerid, gui_ButtonData[playerid][id][gui_but_tdout], 1);
- PlayerTextDrawBoxColor(playerid, gui_ButtonData[playerid][id][gui_but_tdout], -892679629);
- PlayerTextDrawTextSize(playerid, gui_ButtonData[playerid][id][gui_but_tdout], height, width-2.0);
- gui_ButtonData[playerid][id][gui_but_tdbox] = CreatePlayerTextDraw(playerid, x, y+2.0, "_");
- PlayerTextDrawAlignment(playerid, gui_ButtonData[playerid][id][gui_but_tdbox], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_ButtonData[playerid][id][gui_but_tdbox], 255);
- PlayerTextDrawFont(playerid, gui_ButtonData[playerid][id][gui_but_tdbox], 1);
- PlayerTextDrawLetterSize(playerid, gui_ButtonData[playerid][id][gui_but_tdbox], 0.159998, (height*UNIT)-0.4741);
- //PlayerTextDrawLetterSize(playerid, gui_ButtonData[playerid][id][gui_but_tdbox], 0.159998, ((height-4.0)*UNIT));
- PlayerTextDrawColor(playerid, gui_ButtonData[playerid][id][gui_but_tdbox], -1);
- PlayerTextDrawSetOutline(playerid, gui_ButtonData[playerid][id][gui_but_tdbox], 1);
- PlayerTextDrawSetProportional(playerid, gui_ButtonData[playerid][id][gui_but_tdbox], 1);
- PlayerTextDrawUseBox(playerid, gui_ButtonData[playerid][id][gui_but_tdbox], 1);
- PlayerTextDrawBoxColor(playerid, gui_ButtonData[playerid][id][gui_but_tdbox], 222);
- PlayerTextDrawTextSize(playerid, gui_ButtonData[playerid][id][gui_but_tdbox], height, width-4.0);
- gui_ButtonData[playerid][id][gui_but_tdtxt] = CreatePlayerTextDraw(playerid, x, y+(height/2)-((0.8/UNIT)/2), text);
- PlayerTextDrawAlignment(playerid, gui_ButtonData[playerid][id][gui_but_tdtxt], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_ButtonData[playerid][id][gui_but_tdtxt], 255);
- PlayerTextDrawFont(playerid, gui_ButtonData[playerid][id][gui_but_tdtxt], 2);
- PlayerTextDrawLetterSize(playerid, gui_ButtonData[playerid][id][gui_but_tdtxt], 0.159999, 0.8);
- PlayerTextDrawColor(playerid, gui_ButtonData[playerid][id][gui_but_tdtxt], -1);
- PlayerTextDrawSetOutline(playerid, gui_ButtonData[playerid][id][gui_but_tdtxt], 1);
- PlayerTextDrawSetProportional(playerid, gui_ButtonData[playerid][id][gui_but_tdtxt], 1);
- PlayerTextDrawTextSize(playerid, gui_ButtonData[playerid][id][gui_but_tdtxt], height-(height/4), width);
- PlayerTextDrawSetSelectable(playerid, gui_ButtonData[playerid][id][gui_but_tdtxt], 1);
- gui_ButtonData[playerid][id][gui_but_tdgl] = CreatePlayerTextDraw(playerid, x, y+2.0, "_");
- PlayerTextDrawAlignment(playerid, gui_ButtonData[playerid][id][gui_but_tdgl], 2);
- PlayerTextDrawBackgroundColor(playerid, gui_ButtonData[playerid][id][gui_but_tdgl], 255);
- PlayerTextDrawFont(playerid, gui_ButtonData[playerid][id][gui_but_tdgl], 1);
- //PlayerTextDrawLetterSize(playerid, gui_ButtonData[playerid][id][gui_but_tdgl], 0.159998, (height*UNIT)-1.075);
- PlayerTextDrawLetterSize(playerid, gui_ButtonData[playerid][id][gui_but_tdgl], 0.159998, (((height/2)-4.0)*UNIT));
- PlayerTextDrawColor(playerid, gui_ButtonData[playerid][id][gui_but_tdgl], -1);
- PlayerTextDrawSetOutline(playerid, gui_ButtonData[playerid][id][gui_but_tdgl], 1);
- PlayerTextDrawSetProportional(playerid, gui_ButtonData[playerid][id][gui_but_tdgl], 1);
- PlayerTextDrawUseBox(playerid, gui_ButtonData[playerid][id][gui_but_tdgl], 1);
- PlayerTextDrawBoxColor(playerid, gui_ButtonData[playerid][id][gui_but_tdgl], -245);
- PlayerTextDrawTextSize(playerid, gui_ButtonData[playerid][id][gui_but_tdgl], height, width-4.0);
- return gui_ButtonData[playerid][id][gui_but_ID];
- }
- function Float:guiGetButtonHeight(playerid, buttonid)
- {
- if (buttonid >= MAX_GUI) return 0.0;
- new r;
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ButtonData[playerid][g][gui_but_ID]== buttonid)
- {
- buttonid = g;
- r = 1;
- break;
- }
- }
- if (!r) return 0.0;
- if (!gui_ButtonData[playerid][buttonid][gui_but_ID]) return 0.0;
- return gui_ButtonData[playerid][buttonid][gui_but_Height];
- }
- function Float:guiGetButtonWidth(playerid, buttonid)
- {
- if (buttonid >= MAX_GUI) return 0.0;
- new r;
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ButtonData[playerid][g][gui_but_ID]== buttonid)
- {
- buttonid = g;
- r = 1;
- break;
- }
- }
- if (!r) return 0.0;
- if (!gui_ButtonData[playerid][buttonid][gui_but_ID]) return 0.0;
- return gui_ButtonData[playerid][buttonid][gui_but_Width];
- }
- function guiGetButtonPos(playerid, buttonid, &Float:x, &Float:y)
- {
- if (buttonid >= MAX_GUI) return 0;
- new r;
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ButtonData[playerid][g][gui_but_ID]== buttonid)
- {
- buttonid = g;
- r = 1;
- break;
- }
- }
- if (!r) return 0;
- if (!gui_ButtonData[playerid][buttonid][gui_but_ID]) return 0;
- x = gui_ButtonData[playerid][buttonid][gui_but_X];
- y = gui_ButtonData[playerid][buttonid][gui_but_Y];
- return 1;
- }
- function guiGetID(playerid, type, gui)
- {
- switch (type)
- {
- case GUI_TYPE_WINDOW:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_WindowData[playerid][g][gui_win_ID] == gui)
- return g;
- }
- }
- case GUI_TYPE_TAB:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_TabData[playerid][g][gui_tab_ID] == gui)
- return g;
- }
- }
- case GUI_TYPE_LABEL:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_LabelData[playerid][g][gui_label_ID] == gui)
- return g;
- }
- }
- case GUI_TYPE_BAR:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_BarData[playerid][g][gui_bar_ID] == gui)
- return g;
- }
- }
- case GUI_TYPE_ITEMLIST:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ItemlistData[playerid][g][gui_list_ID] == gui)
- return g;
- }
- }
- case GUI_TYPE_CHECKBOX:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_CheckboxData[playerid][g][gui_check_ID] == gui)
- return g;
- }
- }
- case GUI_TYPE_BUTTON:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ButtonData[playerid][g][gui_but_ID] == gui)
- return g;
- }
- }
- }
- return -1;
- }
- function guiIsVisible(playerid, type, gui)
- {
- switch (type)
- {
- case GUI_TYPE_WINDOW:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_WindowData[playerid][g][gui_win_ID] == gui)
- return GetTextDrawVisibilityForPlayer(playerid, gui_WindowData[playerid][g][gui_win_td]);
- }
- }
- case GUI_TYPE_TAB:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_TabData[playerid][g][gui_tab_ID] == gui)
- {
- if (!GetTextDrawVisibilityForPlayer(playerid, gui_TabData[playerid][g][gui_tab_td])) return GetTextDrawVisibilityForPlayer(playerid, gui_TabData[playerid][g][gui_tab_td2]);
- else GetTextDrawVisibilityForPlayer(playerid, gui_TabData[playerid][g][gui_tab_td]);
- }
- }
- }
- case GUI_TYPE_LABEL:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_LabelData[playerid][g][gui_label_ID] == gui)
- return GetTextDrawVisibilityForPlayer(playerid, gui_LabelData[playerid][g][gui_label_td]);
- }
- }
- case GUI_TYPE_BAR:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_BarData[playerid][g][gui_bar_ID] == gui)
- return GetTextDrawVisibilityForPlayer(playerid, gui_BarData[playerid][g][gui_bar_tdbg]);
- }
- }
- case GUI_TYPE_ITEMLIST:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ItemlistData[playerid][g][gui_list_ID] == gui)
- return GetTextDrawVisibilityForPlayer(playerid, gui_ItemlistData[playerid][g][gui_list_tdbox]);
- }
- }
- case GUI_TYPE_CHECKBOX:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_CheckboxData[playerid][g][gui_check_ID] == gui)
- {
- if (!GetTextDrawVisibilityForPlayer(playerid, gui_CheckboxData[playerid][g][gui_check_td])) return GetTextDrawVisibilityForPlayer(playerid, gui_CheckboxData[playerid][g][gui_check_td2]);
- else GetTextDrawVisibilityForPlayer(playerid, gui_CheckboxData[playerid][g][gui_check_td]);
- }
- }
- }
- case GUI_TYPE_BUTTON:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ButtonData[playerid][g][gui_but_ID] == gui)
- return GetTextDrawVisibilityForPlayer(playerid, gui_ButtonData[playerid][g][gui_but_tdtxt]);
- }
- }
- }
- return 0;
- }
- function guiDestroy(playerid, type, gui)
- {
- if (!IsPlayerConnected(playerid)) return 0;
- switch (type)
- {
- case GUI_TYPE_WINDOW:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_WindowData[playerid][g][gui_win_ID] == gui)
- {
- gui_WindowData[playerid][g][gui_win_ID] = 0;
- TextDrawDestroyEx(playerid, gui_WindowData[playerid][g][gui_win_td]);
- TextDrawDestroyEx(playerid, gui_WindowData[playerid][g][gui_win_tdtop]);
- TextDrawDestroyEx(playerid, gui_WindowData[playerid][g][gui_win_tdtitle]);
- return 1;
- }
- }
- }
- case GUI_TYPE_TAB:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_TabData[playerid][g][gui_tab_ID] == gui)
- {
- gui_TabData[playerid][g][gui_tab_ID] = 0;
- TextDrawDestroyEx(playerid, gui_TabData[playerid][g][gui_tab_td]);
- TextDrawDestroyEx(playerid, gui_TabData[playerid][g][gui_tab_td2]);
- TextDrawDestroyEx(playerid, gui_TabData[playerid][gui_TabData[playerid][g][gui_tab_panel]][gui_tab_tdbg]);
- TextDrawDestroyEx(playerid, gui_TabData[playerid][gui_TabData[playerid][g][gui_tab_panel]][gui_tab_tdbox]);
- return 1;
- }
- }
- }
- case GUI_TYPE_LABEL:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_LabelData[playerid][g][gui_label_ID] == gui)
- {
- gui_LabelData[playerid][g][gui_label_ID] = 0;
- TextDrawDestroyEx(playerid, gui_LabelData[playerid][g][gui_label_td]);
- return 1;
- }
- }
- }
- case GUI_TYPE_BAR:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_BarData[playerid][g][gui_bar_ID] == gui)
- {
- gui_BarData[playerid][g][gui_bar_ID] = 0;
- TextDrawDestroyEx(playerid, gui_BarData[playerid][g][gui_bar_tdbg]);
- TextDrawDestroyEx(playerid, gui_BarData[playerid][g][gui_bar_tdbox]);
- TextDrawDestroyEx(playerid, gui_BarData[playerid][g][gui_bar_tdbar]);
- return 1;
- }
- }
- }
- case GUI_TYPE_ITEMLIST:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ItemlistData[playerid][g][gui_list_ID] == gui)
- {
- gui_ItemlistData[playerid][g][gui_list_ID] = 0;
- TextDrawDestroyEx(playerid, gui_ItemlistData[playerid][g][gui_list_tdbox]);
- TextDrawDestroyEx(playerid, gui_ItemlistData[playerid][g][gui_list_tdline]);
- TextDrawDestroyEx(playerid, gui_ItemlistData[playerid][g][gui_list_tdtitle]);
- for(new r; r <= gui_ItemlistData[playerid][g][gui_list_RowMax]; r++)
- {
- if (gui_ItemRowData[playerid][r][gui_row_ID] > 0)
- {
- gui_ItemRowData[playerid][r][gui_row_ID] = 0;
- TextDrawDestroyEx(playerid, gui_ItemRowData[playerid][r][gui_row_td]);
- TextDrawDestroyEx(playerid, gui_ItemRowData[playerid][r][gui_row_td2]);
- }
- }
- return 1;
- }
- }
- }
- case GUI_TYPE_CHECKBOX:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_CheckboxData[playerid][g][gui_check_ID] == gui)
- {
- gui_CheckboxData[playerid][g][gui_check_ID] = 0;
- TextDrawDestroyEx(playerid, gui_CheckboxData[playerid][g][gui_check_td]);
- TextDrawDestroyEx(playerid, gui_CheckboxData[playerid][g][gui_check_td2]);
- return 1;
- }
- }
- }
- case GUI_TYPE_BUTTON:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ButtonData[playerid][g][gui_but_ID] == gui)
- {
- gui_ButtonData[playerid][g][gui_but_ID] = 0;
- TextDrawDestroyEx(playerid, gui_ButtonData[playerid][g][gui_but_tdbg]);
- TextDrawDestroyEx(playerid, gui_ButtonData[playerid][g][gui_but_tdout]);
- TextDrawDestroyEx(playerid, gui_ButtonData[playerid][g][gui_but_tdbox]);
- TextDrawDestroyEx(playerid, gui_ButtonData[playerid][g][gui_but_tdtxt]);
- TextDrawDestroyEx(playerid, gui_ButtonData[playerid][g][gui_but_tdgl]);
- return 1;
- }
- }
- }
- }
- return 0;
- }
- function guiDestroyAll(playerid, type) // 0 = all
- {
- if (!IsPlayerConnected(playerid)) return 0;
- new follow;
- START:
- switch (type)
- {
- case 0:
- {
- follow = 1;
- type = GUI_TYPE_WINDOW;
- goto START;
- }
- case GUI_TYPE_WINDOW:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_WindowData[playerid][g][gui_win_ID] > 0)
- {
- gui_WindowData[playerid][g][gui_win_ID] = 0;
- TextDrawDestroyEx(playerid, gui_WindowData[playerid][g][gui_win_td]);
- TextDrawDestroyEx(playerid, gui_WindowData[playerid][g][gui_win_tdtop]);
- TextDrawDestroyEx(playerid, gui_WindowData[playerid][g][gui_win_tdtitle]);
- }
- }
- if (follow)
- {
- type = GUI_TYPE_TAB;
- goto START;
- }
- }
- case GUI_TYPE_TAB:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_TabData[playerid][g][gui_tab_ID] > 0)
- {
- gui_TabData[playerid][g][gui_tab_ID] = 0;
- TextDrawDestroyEx(playerid, gui_TabData[playerid][g][gui_tab_td]);
- TextDrawDestroyEx(playerid, gui_TabData[playerid][g][gui_tab_td2]);
- TextDrawDestroyEx(playerid, gui_TabData[playerid][gui_TabData[playerid][g][gui_tab_panel]][gui_tab_tdbg]);
- TextDrawDestroyEx(playerid, gui_TabData[playerid][gui_TabData[playerid][g][gui_tab_panel]][gui_tab_tdbox]);
- }
- }
- if (follow)
- {
- type = GUI_TYPE_LABEL;
- goto START;
- }
- }
- case GUI_TYPE_LABEL:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_LabelData[playerid][g][gui_label_ID] > 0)
- {
- gui_LabelData[playerid][g][gui_label_ID] = 0;
- TextDrawDestroyEx(playerid, gui_LabelData[playerid][g][gui_label_td]);
- }
- }
- if (follow)
- {
- type = GUI_TYPE_BAR;
- goto START;
- }
- }
- case GUI_TYPE_BAR:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_BarData[playerid][g][gui_bar_ID] > 0)
- {
- gui_BarData[playerid][g][gui_bar_ID] = 0;
- TextDrawDestroyEx(playerid, gui_BarData[playerid][g][gui_bar_tdbg]);
- TextDrawDestroyEx(playerid, gui_BarData[playerid][g][gui_bar_tdbox]);
- TextDrawDestroyEx(playerid, gui_BarData[playerid][g][gui_bar_tdbar]);
- }
- }
- if (follow)
- {
- type = GUI_TYPE_ITEMLIST;
- goto START;
- }
- }
- case GUI_TYPE_ITEMLIST:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ItemlistData[playerid][g][gui_list_ID] > 0)
- {
- gui_ItemlistData[playerid][g][gui_list_ID] = 0;
- TextDrawDestroyEx(playerid, gui_ItemlistData[playerid][g][gui_list_tdbox]);
- TextDrawDestroyEx(playerid, gui_ItemlistData[playerid][g][gui_list_tdline]);
- TextDrawDestroyEx(playerid, gui_ItemlistData[playerid][g][gui_list_tdtitle]);
- for(new r; r <= gui_ItemlistData[playerid][g][gui_list_RowMax]; r++)
- {
- if (gui_ItemRowData[playerid][r][gui_row_ID] > 0)
- {
- gui_ItemRowData[playerid][r][gui_row_ID] = 0;
- TextDrawDestroyEx(playerid, gui_ItemRowData[playerid][r][gui_row_td]);
- TextDrawDestroyEx(playerid, gui_ItemRowData[playerid][r][gui_row_td2]);
- }
- }
- }
- }
- if (follow)
- {
- type = GUI_TYPE_CHECKBOX;
- goto START;
- }
- }
- case GUI_TYPE_CHECKBOX:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_CheckboxData[playerid][g][gui_check_ID] > 0)
- {
- gui_CheckboxData[playerid][g][gui_check_ID] = 0;
- TextDrawDestroyEx(playerid, gui_CheckboxData[playerid][g][gui_check_td]);
- TextDrawDestroyEx(playerid, gui_CheckboxData[playerid][g][gui_check_td2]);
- }
- }
- if (follow)
- {
- type = GUI_TYPE_BUTTON;
- goto START;
- }
- }
- case GUI_TYPE_BUTTON:
- {
- for(new g; g < MAX_GUI; g++)
- {
- if (gui_ButtonData[playerid][g][gui_but_ID] > 0)
- {
- gui_ButtonData[playerid][g][gui_but_ID] = 0;
- TextDrawDestroyEx(playerid, gui_ButtonData[playerid][g][gui_but_tdbg]);
- TextDrawDestroyEx(playerid, gui_ButtonData[playerid][g][gui_but_tdout]);
- TextDrawDestroyEx(playerid, gui_ButtonData[playerid][g][gui_but_tdbox]);
- TextDrawDestroyEx(playerid, gui_ButtonData[playerid][g][gui_but_tdtxt]);
- TextDrawDestroyEx(playerid, gui_ButtonData[playerid][g][gui_but_tdgl]);
- }
- }
- }
- }
- return 1;
- }
- forward gui_OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid);
- public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
- {
- if ((tickcount()-GetPVarInt(playerid, "guiinc_i")) < 500) return 0; // Preventing spam, because of loop.
- for(new c; c < MAX_GUI; c++)
- {
- if (gui_TabData[playerid][c][gui_tab_ID] > 0)
- {
- if (playerid != gui_TabData[playerid][c][gui_tab_P]) continue;
-
- if (playertextid == gui_TabData[playerid][c][gui_tab_td])
- {
- PlayerTextDrawHide(playerid, gui_TabData[playerid][p_tab[playerid]][gui_tab_td2]);
- guiSetVisible(playerid, GUI_TYPE_TAB, gui_TabData[playerid][p_tab[playerid]][gui_tab_ID], false);
- PlayerTextDrawHide(playerid, gui_TabData[playerid][c][gui_tab_td]);
- p_tab[playerid] = c;
- guiSetVisible(playerid, GUI_TYPE_TAB, gui_TabData[playerid][c][gui_tab_ID], true);
- OnPlayerClickTab(playerid, gui_TabData[playerid][c][gui_tab_ID]);
- break;
- }
- }
- if (gui_ButtonData[playerid][c][gui_but_ID] > 0)
- {
- if (playerid != gui_ButtonData[playerid][c][gui_but_P]) continue;
- if (playertextid == gui_ButtonData[playerid][c][gui_but_tdtxt] || playertextid == gui_ButtonData[playerid][c][gui_but_tdbg])
- {
- OnPlayerClickButton(playerid, gui_ButtonData[playerid][c][gui_but_ID]);
- break;
- }
- }
- if (gui_ItemRowData[playerid][c][gui_row_ID] > 0)
- {
- if (playertextid == gui_ItemRowData[playerid][c][gui_row_td])
- {
- PlayerTextDrawHide(playerid, gui_ItemRowData[playerid][p_row[playerid]][gui_row_td2]);
- PlayerTextDrawShow(playerid, gui_ItemRowData[playerid][p_row[playerid]][gui_row_td]);
- PlayerTextDrawHide(playerid, gui_ItemRowData[playerid][c][gui_row_td]);
- PlayerTextDrawShow(playerid, gui_ItemRowData[playerid][c][gui_row_td2]);
- p_row[playerid] = c;
- break;
- }
- }
- if (gui_CheckboxData[playerid][c][gui_check_ID] > 0)
- {
- if (playerid != gui_CheckboxData[playerid][c][gui_check_P]) continue;
- if (playertextid == gui_CheckboxData[playerid][c][gui_check_td])
- {
- PlayerTextDrawHide(playerid, gui_CheckboxData[playerid][c][gui_check_td]);
- PlayerTextDrawShow(playerid, gui_CheckboxData[playerid][c][gui_check_td2]);
- break;
- }
- if (playertextid == gui_CheckboxData[playerid][c][gui_check_td2])
- {
- PlayerTextDrawHide(playerid, gui_CheckboxData[playerid][c][gui_check_td2]);
- PlayerTextDrawShow(playerid, gui_CheckboxData[playerid][c][gui_check_td]);
- break;
- }
- }
- }
- SetPVarInt(playerid, "guiinc_i", tickcount());
- return gui_OnPlayerClickPlayerTextDraw(playerid, playertextid);
- //return 0;
- }
- #define OnPlayerClickPlayerTextDraw gui_OnPlayerClickPlayerTextDraw
- // END
- #if defined function
- #undef function
- #endif
|