Jump to content

DuduzinCp

Members
  • Posts

    6
  • Joined

  • Last visited

DuduzinCp's Achievements

Square

Square (6/54)

0

Reputation

  1. I tested the api code and the same lua file and it worked, it must be my hosting's php configuration
  2. Yes but I'm not looking for how to access the file, I'm looking for how to send the JSON as a response <?php header('Content-type: application/json; charset=utf-8'); $dadosEnviados = file_get_contents('php://input'); $dadosEnviados = json_decode($dadosEnviados, true); $connPdo = new PDO('db'); if (isset($dadosEnviados['busca'])) { (int)$busca = $dadosEnviados['busca']; $sql = $connPdo->prepare("SELECT * FROM licenses WHERE ID = ?"); $sql->bindParam(1, $busca); } $dados = [ 'result' => false, 'valores' => [] ]; if ($sql->execute()) { if ($sql->rowCount() > 0) { $dados['result'] = true; $dados['valores'] = $sql->fetchAll(); } } echo json_encode($dados); My php
  3. To be more specific, I'm having problems in php, because I don't know how to make php send this JSON to mta, I think it's incorrect to use 'echo' in php
  4. Can anyone help me with this problem? I made an API in php and it returns a JSON but it is not returning any result only in MTA. function test (url) sendOptions = { formFields = { verifyUserAccessTOJSON = toJSON( {busca = '1' }) }, } fetchRemote ( url, sendOptions, notificationCallback ) end function notificationCallback(data, info) test = fromJSON(data) print(inspect(data)) print(inspect(info)) end test('noLinkForSecurity') In PHP, okay, it returns a echo json_encode($dados); This that appears in the debug (nothing)
  5. Hello, how are you guys? I need help making a circle mask using shaders, until I managed to do so, but I wanted to apply a texture to it too and I'm not able to apply it.]/ // // Example shader - circle.fx // // // Based on code from: // http://www.geeks3d.com/20130705/shader-library-circle-disc-fake-sphere-in-glsl-opengl-glslhacker/ // float sCircleHeightInPixel = 100; float sCircleWidthInPixel = 100; float sBorderWidthInPixel = 10; float sAngleStart = -3.14; float sAngleEnd = 3.14; //------------------------------------------------------------------------------------------ // PixelShaderFunction // 1. Read from PS structure // 2. Process // 3. Return pixel color //------------------------------------------------------------------------------------------ float4 PixelShaderFunction(float4 Diffuse : COLOR0, float2 TexCoord : TEXCOORD0) : COLOR0 { float2 uv = float2( TexCoord.x, TexCoord.y ) - float2( 0.5, 0.5 ); // Clip unwanted pixels from partial pie float angle = atan2( -uv.x, uv.y ); // -PI to +PI if ( sAngleStart > sAngleEnd ) { if ( angle < sAngleStart && angle > sAngleEnd ) return 0; } else { if ( angle < sAngleStart || angle > sAngleEnd ) return 0; } // Calc border width to use float2 vec = normalize( uv ); float CircleRadiusInPixel = lerp( sCircleWidthInPixel, sCircleHeightInPixel, vec.y * vec.y ); float borderWidth = sBorderWidthInPixel / CircleRadiusInPixel; // Check if pixel is inside circle float dist = sqrt( dot( uv, uv ) ); if ( ( dist > 0.5 ) || ( dist < 0.5 - borderWidth ) ) return 0; else return Diffuse; } //------------------------------------------------------------------------------------------ // Techniques //------------------------------------------------------------------------------------------ technique tec0 { pass P0 { PixelShader = compile ps_2_0 PixelShaderFunction(); } } Up here is the shaders file I used and here below is what I did in lua profile = dxCreateTexture( "assets/images/profile.png" ) function Duduzin_circle( x, y, width, height, color, angleStart, angleSweep, borderWidth ) height = height or width color = color or tocolor(255,255,255) borderWidth = borderWidth or 1e9 angleStart = angleStart or 0 angleSweep = angleSweep or 360 - angleStart if ( angleSweep < 360 ) then angleEnd = math.fmod( angleStart + angleSweep, 360 ) + 0 else angleStart = 0 angleEnd = 360 end x = x - width / 2 y = y - height / 2 if not circleShader then circleShader = dxCreateShader ( "assets/archives/shader.fx" ) end dxSetShaderValue ( circleShader, "sCircleWidthInPixel", width ); dxSetShaderValue ( circleShader, "sCircleHeightInPixel", height ); dxSetShaderValue ( circleShader, "sBorderWidthInPixel", borderWidth ); dxSetShaderValue ( circleShader, "sAngleStart", math.rad( angleStart ) - math.pi ); dxSetShaderValue ( circleShader, "sAngleEnd", math.rad( angleEnd ) - math.pi ); dxSetShaderValue ( circleShader, "Profile", profile) dxDrawImage( x, y, width, height, circleShader, 0, 0, 0, color ) end Well as you can see I put an image and tried to set it in shaders but I couldn't. My idea is to take an image and transform it into a texture then round it with a circle mask!
×
×
  • Create New...