12p Posted November 3, 2011 Share Posted November 3, 2011 (edited) Creating images from simple strings or another arguments. E.g: CAPTCHAS. Those uses texts on images, right? IDK how do those work, but someway it works with MANY random images. If this suggestion is accepted, it may help to reduce good download space. Edited November 4, 2011 by Guest Link to comment
MetaGamer Posted November 3, 2011 Share Posted November 3, 2011 That would be really useful. Don't know when GTA San Andreas will be open-source. Link to comment
Aibo Posted November 3, 2011 Share Posted November 3, 2011 what? you can make a captcha pretty easily with dx functions. Link to comment
diegofkda Posted November 4, 2011 Share Posted November 4, 2011 For captcha you can use Custom Fonts or DirectX functions as well. Link to comment
12p Posted November 4, 2011 Author Share Posted November 4, 2011 It was just kinda an example. There must be something else that you can use the functions I suggest for. Link to comment
qaisjp Posted November 4, 2011 Share Posted November 4, 2011 function dxCreateCaptcha(length) local c = createElement("dxCaptcha") local alph = {"a","b", "c", "d", "e", "f", "g", "h", "i", "insertmore"} local captch = "" for i=0, length do if math.random(2)==2 then captch = captch..alpha[math.random(#alph)] else captch = captch..math.random(0,9) end end setElementData(c, "captcha", captch) return c end function dxDrawCaptcha(captcha) if not isElement(captcha) -- bunch of dxDrawText calls end end sorry about the create element thing, i was just kinda bored Link to comment
AGENT_STEELMEAT Posted November 4, 2011 Share Posted November 4, 2011 This is very easy to make, theres no need for a built-in solution. Simply have a library of small images of the numbers 0-9 and letters a-z client-side (client/images/captcha/a.png for example). Then, when a captcha code is needed, request a random string from the server. When the string is recieved, split it into a table, and then for each character in the string, draw the proper image. For example: --The width of a captcha image will remain the same at all times local characterWidth, characterHeight = 48, 48 --These are static values, all captcha images should be the same size. local captchaCode = string.split(strCaptcha) --Where 'strCaptcha' is what is recieved from the server. local x = 0 --This should be whatever the actual gui element's x position is local y = 0 --Same for this --Draw the individual images for _, character in ipairs(captchaCode) do dxDrawImage(x, y, characterWidth, characterHeight, "client/images/captcha/"..character..".png") x = x + characterWidth end Link to comment
qaisjp Posted November 4, 2011 Share Posted November 4, 2011 not images, but rotated texts with different fonts Link to comment
Aibo Posted November 4, 2011 Share Posted November 4, 2011 this is not a scripting section. and i doubt Benxamix2 knows himself what is this suggestion for ("some engine" for "some functions"? "Creating images from simple strings or another arguments" - what?) Link to comment
AGENT_STEELMEAT Posted November 4, 2011 Share Posted November 4, 2011 the images would be of rotated texts with different fonts - this is how its done in the actual captcha system commonly found Link to comment
qaisjp Posted November 4, 2011 Share Posted November 4, 2011 why create an image for numbers 0-9 and letters a-z when you can jst use fonts and randomly generated angles? Link to comment
AGENT_STEELMEAT Posted November 4, 2011 Share Posted November 4, 2011 You can't rotate DX texts, unless you get fancy and use dxDrawLine on special character elements. Link to comment
qaisjp Posted November 4, 2011 Share Posted November 4, 2011 You can't rotate DX texts wat. Link to comment
AGENT_STEELMEAT Posted November 4, 2011 Share Posted November 4, 2011 bool dxDrawText ( string text, int left, int top [, int right=left, int bottom=top, int color=white, float scale=1, mixed font="default", string alignX="left", string alignY="top", bool clip=false, bool wordBreak=false, bool postGUI ] I see no rotation args. Link to comment
qaisjp Posted November 4, 2011 Share Posted November 4, 2011 Dear MTA, please add rotation args to dxDrawText. Thanks. Link to comment
karlis Posted November 5, 2011 Share Posted November 5, 2011 create render target and rotate it... problem much? Link to comment
Recommended Posts