Jump to content

iAxel

Members
  • Posts

    160
  • Joined

  • Last visited

Everything posted by iAxel

  1. Hello everybody! The question is rather blunt, but I can't decide... How to make blink dxDraw? local alpha = 0 local atype = 'up' addEventHandler('onClientRender', root, function () if (alpha >= 0 and atype == 'up') then alpha = alpha + 5 elseif (alpha <= 200 and atype == 'down') then alpha = alpha - 5 end if (alpha == 0) then atype = 'up' elseif (alpha == 200) then atype = 'down' end dxDrawRectangle(x, y, w, h, tocolor(150, 0, 0, alpha)) end) I already have the code, but I want to use only the alpha variable if (alpha >= 0 and alpha ~= 200) then alpha = alpha + 5 elseif (alpha <= 200 and alpha ~= 1) then alpha = alpha - 5 end Just it does not work ...
  2. Всем хай! Вопрос скорее туповатый но все же никак не додумаюсь... Как можно заставить мигать dxDrawRectangle? Ну есть самый примитивный код Работает, но я бы предпочел без atype переменной, нельзя использовать саму alpha переменную? UPD: Эт тоже не помогло
  3. Как фишка планировалось значить, жаль хотел опробовать
  4. О-о-о, а разве в MTA можно использовать СиШарп? Да это же офигенно! Пора готовить свадьбу... надеюсь шарп согласиться00) С# в виде модуля будет, хотя если имеется такое я бы хотел опробовать
  5. I was mistaken, I apologize for my carelessness, and I thank for your help
  6. What is wrong with the use loadstring? You can give more information? It's both ugly and overcomplex. Also, I wouldn't call this a tutorial at all. Where is the explanation? Where is anything? You just put a bunch of lines of code there and expect people to understand it. Do not excuse yourself with "it's my first tutorial" - see, that is the problem with this section - you don't know what you're doing. I said that perhaps was wrong calling this tutorial And If you have not noticed, I described only in right places, I should describe each function? I am a newbie, but I know what features necessary for anything other. Perhaps I am wrong... Correct me, I need it in the future
  7. Maybe I made a mistake calling this tut, but this is my first tutorial) correct me if this is possible
  8. What is wrong with the use loadstring? You can give more information?
  9. What then you propose to use? And the code for the test
  10. ohh. sorry) Update local screenW, screenH = guiGetScreenSize() local sW = (screenW / 640) local sH = (screenH / 480) local tS = (screenW / 640) * 0.5
  11. [Tutorial] dxFunctions Hi everybody! Today, I will make a tutorial for this community... This tutorial will teach you to click dxElements (dxDrawRectangle, dxDrawText etc.) For the beginning, create variables --For all screen sizes local screenW, screenH = guiGetScreenSize() local sW = (screenW / 640) local sH = (screenH / 480) local tS = (screenW / 640) * 0.5 --Text Size --dx Button variable local dx_button = { --{x, y, width, height, color, text, output text after clicking} {x = sW * 70, y = sH * 200, w = sW * 75, h = sH * 10, c = tocolor(0, 0, 0, 0), t = 'Login', o = 'Login button works is fine!'}, {x = sW * 70, y = sH * 225, w = sW * 75, h = sH * 10, c = tocolor(0, 0, 0, 0), t = 'Register', o = 'Register button works is fine!'}, {x = sW * 70, y = sH * 250, w = sW * 75, h = sH * 10, c = tocolor(0, 0, 0, 0), t = 'Exit', o = 'Exit button works is fine!'} } local isVisible = false Created? great! Now we create function --We need a (onClientRender, onClientCursorMove, onClientClick) functions --Create Menu and deMenu functions for rendering dxElements function Menu() addEventHandler('onClientRender', root, Render) addEventHandler('onClientCursorMove', root, Move) addEventHandler('onClientClick', root, Click) end function deMenu() removeEventHandler('onClientRender', root, Render) removeEventHandler('onClientCursorMove', root, Move) removeEventHandler('onClientClick', root, Click) end function Bind() isVisible = (not isVisible) showCursor(isVisible) loadstring(('%s()'):format((isVisible and 'Menu' or 'deMenu')))() end bindKey('f', 'down', Bind) After creating the necessary functions function Render() for i = 1, #dx_button do dxDrawRectangle(dx_button[i].x, dx_button[i].y, dx_button[i].w, dx_button[i].h, dx_button[i].c) dxDrawText(dx_button[i].t, dx_button[i].x, dx_button[i].y, dx_button[i].x + dx_button[i].w, dx_button[i].y + dx_button[i].h, tocolor(255, 255, 255, 255), tS * 1, 'default', 'center', 'center') end end function Move(_, _, x, y) --Cursor x, y position for i = 1, #dx_button do --If the cursor position is equal to dx position, then change the color if (x >= dx_button[i].x and x <= dx_button[i].x + dx_button[i].w) and (y > dx_button[i].y and y < dx_button[i].y + dx_button[i].h) then dx_button[i].c = tocolor(150, 0, 0, 200) else dx_button[i].c = tocolor(0, 0, 0, 0) end end end function Click(b, s, x, y) if (b == 'left' and s == 'up') then for i = 1, #dx_button do --If the dx position is equal to cursor click position, then output message if (x >= dx_button[i].x and x <= dx_button[i].x + dx_button[i].w) and (y > dx_button[i].y and y < dx_button[i].y + dx_button[i].h) then if (dx_button[i].o) then outputChatBox(dx_button[i].o) end end end end end All this it turns out so local screenW, screenH = guiGetScreenSize() local sW = (screenW / 640) local sH = (screenH / 480) local tS = (screenW / 640) * 0.5 local dx_button = { {x = sW * 70, y = sH * 200, w = sW * 75, h = sH * 10, c = tocolor(0, 0, 0, 0), t = 'Login', o = 'Login button works is fine!'}, {x = sW * 70, y = sH * 225, w = sW * 75, h = sH * 10, c = tocolor(0, 0, 0, 0), t = 'Register', o = 'Register button works is fine!'}, {x = sW * 70, y = sH * 250, w = sW * 75, h = sH * 10, c = tocolor(0, 0, 0, 0), t = 'Exit', o = 'Exit button works is fine!'} } local isVisible = false function Menu() addEventHandler('onClientRender', root, Render) addEventHandler('onClientCursorMove', root, Move) addEventHandler('onClientClick', root, Click) end function deMenu() removeEventHandler('onClientRender', root, Render) removeEventHandler('onClientCursorMove', root, Move) removeEventHandler('onClientClick', root, Click) end function Bind() isVisible = (not isVisible) showCursor(isVisible) loadstring(('%s()'):format((isVisible and 'Menu' or 'deMenu')))() end bindKey('f', 'down', Bind) function Render() for i = 1, #dx_button do dxDrawRectangle(dx_button[i].x, dx_button[i].y, dx_button[i].w, dx_button[i].h, dx_button[i].c) dxDrawText(dx_button[i].t, dx_button[i].x, dx_button[i].y, dx_button[i].x + dx_button[i].w, dx_button[i].y + dx_button[i].h, tocolor(255, 255, 255, 255), tS * 1, 'default', 'center', 'center') end end function Move(_, _, x, y) for i = 1, #dx_button do if (x >= dx_button[i].x and x <= dx_button[i].x + dx_button[i].w) and (y > dx_button[i].y and y < dx_button[i].y + dx_button[i].h) then dx_button[i].c = tocolor(150, 0, 0, 200) else dx_button[i].c = tocolor(0, 0, 0, 0) end end end function Click(b, s, x, y) if (b == 'left' and s == 'up') then for i = 1, #dx_button do if (x >= dx_button[i].x and x <= dx_button[i].x + dx_button[i].w) and (y > dx_button[i].y and y < dx_button[i].y + dx_button[i].h) then if (dx_button[i].o) then outputChatBox(dx_button[i].o) end end end end end This way we are able to click dxElement That's all! p.s Do not judge strictly, this is my first tutorial
  12. You can provide a mapping? or is it private?
  13. A player's real-time display can be? example that it clothed, etc. And I can download your resource? the resource is not working
  14. What about video memory ie mean that the resource is demanding more powerful PC
  15. iAxel

    [HELP] Button

    dx function ? or gui?
  16. Example MySQL resource Login Resource Login Resource check player serial and if serial is in database then autologin or autoregister
  17. I don't want use setElementData because I use event for Check NPC 'onClientPreRender'
  18. Bro please show me example Thx
×
×
  • Create New...