Death Posted May 2, 2015 Share Posted May 2, 2015 ERROR attemp to perform arithmetic on local 'x' (a boolean value) line 61 addEvent("onSetOwner", true) resourceRoot = getResourceRootElement() addEventHandler("onClientResourceStart",resourceRoot, function() triggerServerEvent( "clientReady", resourceRoot ) end ) local fonts = { [ "default" ] = true, [ "default-bold" ] = true,[ "clear" ] = true,[ "arial" ] = true,[ "sans" ] = true, [ "pricedown" ] = true, [ "bankgothic" ] = true,[ "diploma" ] = true,[ "beckett" ] = true }; function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end bases={} function lol(id, name, owner, preco, x, y, z, red, green, blue) bases[id] = {} bases[id]['name'] = name bases[id]['owner'] = owner bases[id]['preco'] = preco bases[id]['x'] = x bases[id]['y'] = y bases[id]['z'] = z bases[id]['r'] = red bases[id]['g'] = green bases[id]['b'] = blue end addEventHandler ( "onSetOwner", getRootElement(), lol ) local myFont = dxCreateFont( "font/Oswald.ttf", 22 ) addEventHandler( "onClientRender", root, function () local pX, pY, pZ = getElementPosition( localPlayer ); local AWX, AWY, AWZ = getScreenFromWorldPosition( bases[1]['x'], bases[1]['y'], bases[1]['z']+0.512) local la, le, li = getScreenFromWorldPosition( bases[1]['x'], bases[1]['y'], bases[1]['z']+0.400) local a, e, i = getScreenFromWorldPosition( bases[1]['x'], bases[1]['y'], bases[1]['z']+0.288) local distance = getDistanceBetweenPoints3D( pX, pY, pZ, bases[1]['x'], bases[1]['y'], bases[1]['z']+0.512 ); if AWX and AWY and AWZ then if bases[1]['x'] and bases[1]['y'] and bases[1]['z'] then if distance <= 12 then dxDrawBorderedText("Base: "..bases[1]['name'], AWX, AWY, _, _, tocolor(bases[1]['r'], bases[1]['g'], bases[1]['b'], 255), 0.5, myFont, "center", "center")-- screenWidth, screenHeight, tocolor(255 255, 0, 255), 1, "default") dxDrawBorderedText("Owner: "..bases[1]['owner'], la, le, _, _, tocolor(bases[1]['r'], bases[1]['g'], bases[1]['b'], 255), 0.5, myFont, "center", "center") dxDrawBorderedText("Preço: "..convertNumber(bases[1]['preco']), a, e, _, _, tocolor(bases[1]['r'], bases[1]['g'], bases[1]['b'], 255), 0.5, myFont, "center", "center") end end end end ); function dxDrawBorderedText( text, x, y, _, _, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) dxDrawText ( text, x - 1, y - 1, _, _, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) ---- error line dxDrawText ( text, x + 1, y - 1, _, _, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x - 1, y + 1, _, _, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y + 1, _, _, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y, _, _, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) end Link to comment
WhoAmI Posted May 2, 2015 Share Posted May 2, 2015 Check if variables 'a' and 'e' are returning correct values. Link to comment
Death Posted May 2, 2015 Author Share Posted May 2, 2015 solved as follows hug! addEventHandler( "onClientRender", root, function () local pX, pY, pZ = getElementPosition( localPlayer ); if bases[1] then local AWX, AWY, AWZ = getScreenFromWorldPosition( bases[1]['x'], bases[1]['y'], bases[1]['z']+0.512) local distance = getDistanceBetweenPoints3D( pX, pY, pZ, bases[1]['x'], bases[1]['y'], bases[1]['z']+0.512 ); if AWX and AWY and AWZ then if bases[1]['x'] and bases[1]['y'] and bases[1]['z'] then if distance <= 12 then dxDrawBorderedText("Base: "..bases[1]['name'], AWX, AWY, _, _, tocolor(bases[1]['r'], bases[1]['g'], bases[1]['b'], 255), 0.5, myFont, "center", "center")-- screenWidth, screenHeight, tocolor(255 255, 0, 255), 1, "default") dxDrawBorderedText("Owner: "..bases[1]['owner'], AWX, AWY+13, _, _, tocolor(bases[1]['r'], bases[1]['g'], bases[1]['b'], 255), 0.5, myFont, "center", "center") dxDrawBorderedText("Preço: "..convertNumber(bases[1]['preco']), AWX, AWY+26, _, _, tocolor(bases[1]['r'], bases[1]['g'], bases[1]['b'], 255), 0.5, myFont, "center", "center") end end end end end ); Link to comment
#RooTs Posted May 2, 2015 Share Posted May 2, 2015 try this function dxDrawBorderedText( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x - 1, y, w - 1, h, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y, w + 1, h, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y - 1, w, h - 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y + 1, w, h + 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) end Link to comment
Mr.unpredictable. Posted May 2, 2015 Share Posted May 2, 2015 try this function dxDrawBorderedText( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x - 1, y, w - 1, h, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y, w + 1, h, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y - 1, w, h - 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y + 1, w, h + 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) end did you even read his 1st post? Link to comment
#RooTs Posted May 2, 2015 Share Posted May 2, 2015 you are trying to make a function of border, You try to use my function? function dxDrawBorderedText Link to comment
WhoAmI Posted May 2, 2015 Share Posted May 2, 2015 #RooTs, leave this forum, pls. ;-; Link to comment
RenanPG Posted May 3, 2015 Share Posted May 3, 2015 Where you put _, _ are float arguments, probably is that problem, try using 0. dxDrawText ( text, x - 1, y - 1, 0, 0, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) --not this, cause it returns a nil value. dxDrawText ( text, x - 1, y - 1, _, _, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) Link to comment
myonlake Posted May 3, 2015 Share Posted May 3, 2015 Where you put _, _ are float arguments, probably is that problem, try using 0. dxDrawText ( text, x - 1, y - 1, 0, 0, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) --not this, cause it returns a nil value. dxDrawText ( text, x - 1, y - 1, _, _, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) If width and height is set to 0, that would simply make it not visible. Are you sure that would be of any help? Link to comment
RenanPG Posted May 3, 2015 Share Posted May 3, 2015 Where you put _, _ are float arguments, probably is that problem, try using 0. dxDrawText ( text, x - 1, y - 1, 0, 0, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) --not this, cause it returns a nil value. dxDrawText ( text, x - 1, y - 1, _, _, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) If width and height is set to 0, that would simply make it not visible. Are you sure that would be of any help? If the worcBreak and clip is false, it will be visible. Link to comment
myonlake Posted May 3, 2015 Share Posted May 3, 2015 Where you put _, _ are float arguments, probably is that problem, try using 0. dxDrawText ( text, x - 1, y - 1, 0, 0, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) --not this, cause it returns a nil value. dxDrawText ( text, x - 1, y - 1, _, _, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false ) If width and height is set to 0, that would simply make it not visible. Are you sure that would be of any help? If the worcBreak and clip is false, it will be visible. Well... if you think that's the right way to do it then go ahead. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now