12p Posted November 3, 2011 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
MetaGamer Posted November 3, 2011 Posted November 3, 2011 That would be really useful. Don't know when GTA San Andreas will be open-source.
Aibo Posted November 3, 2011 Posted November 3, 2011 what? you can make a captcha pretty easily with dx functions.
diegofkda Posted November 4, 2011 Posted November 4, 2011 For captcha you can use Custom Fonts or DirectX functions as well.
12p Posted November 4, 2011 Author Posted November 4, 2011 It was just kinda an example. There must be something else that you can use the functions I suggest for.
MTA Team qaisjp Posted November 4, 2011 MTA Team 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
AGENT_STEELMEAT Posted November 4, 2011 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
MTA Team qaisjp Posted November 4, 2011 MTA Team Posted November 4, 2011 not images, but rotated texts with different fonts
Aibo Posted November 4, 2011 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?)
AGENT_STEELMEAT Posted November 4, 2011 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
MTA Team qaisjp Posted November 4, 2011 MTA Team 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?
AGENT_STEELMEAT Posted November 4, 2011 Posted November 4, 2011 You can't rotate DX texts, unless you get fancy and use dxDrawLine on special character elements.
MTA Team qaisjp Posted November 4, 2011 MTA Team Posted November 4, 2011 You can't rotate DX texts wat.
AGENT_STEELMEAT Posted November 4, 2011 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.
MTA Team qaisjp Posted November 4, 2011 MTA Team Posted November 4, 2011 Dear MTA, please add rotation args to dxDrawText. Thanks.
karlis Posted November 5, 2011 Posted November 5, 2011 create render target and rotate it... problem much?
Recommended Posts