Jump to content

Image

Members
  • Posts

    61
  • Joined

  • Last visited

Everything posted by Image

  1. Here's my code: function onClientLoginRequest(thePlayer, nickname, password) if (nickname) and (nickname~="") then if (password) and (password~="") then local query = mysql:query("SELECT * FROM `Accounts` WHERE `Username` = '" .. mysql:escapeString(nickname) .. "' AND `Password` = '" .. mysql:escapeString(password) .. "'") if (mysql:numRows(query) == 1) then local sourceAccount = getPlayerAccount(thePlayer) if not isGuestAccount(sourceAccount) then exports.box:showBoxS(thePlayer,"error","Már be vagy jelentkezve.") else local account = getAccount(nickname, password) if (account ~= false) then local data = mysql:fetchRow(query) local query = mysql:query("SELECT * FROM `Characters` WHERE `AccountID` = '" .. data[1] .. "'") if (mysql:numRows(query) > 0) then local peds = {} peds[i] = {} local rows = mysql:numRows(query) for i = 0, rows do peds[i][CharacterID] = data[1] peds[i][AccountID] = data[2] peds[i][Name] = data[3] peds[i][Gender] = data[4] peds[i][Age] = data[5] peds[i][Skin] = data[6] peds[i][PosX] = data[7] peds[i][PosY] = data[8] peds[i][PosZ] = data[9] peds[i][Dimension] = data[10] peds[i][Interior] = data[11] peds[i][Health] = data[12] peds[i][Armour] = data[13] end triggerClientEvent(thePlayer, "onSuccessLogin", getRootElement(), peds) logIn(thePlayer, account, password) exports.box:showBoxS(thePlayer,"info","Sikeresen bejelentkeztél.") else exports.box:showBoxS(thePlayer,"error","Nincs egyetlen karakter sem hozzárendelve ehhez az accounthoz. A játék megkezdése előtt mindenképpen szükséged van legalább 1 karakterre, melyet weboldalunkon tudsz elkészíteni. ([url=http://www.sa-stories.net]http://www.sa-stories.net[/url])") end else exports.box:showBoxS(thePlayer,"error","A MySQL adatbázisban és a szerver belső adatbázisában található jelszavak nem egyeznek!\nJavaslat: A probléma megoldásához kérlek vedd fel a kapcsolatot egy adminisztrátorral.") end end else exports.box:showBoxS(thePlayer,"error","Helytelen bejelentkezési adatokat adtál meg.") end else exports.box:showBoxS(thePlayer,"error","Nem adtál meg jelszót.") end else exports.box:showBoxS(thePlayer,"error","Nem adtál meg felhasználónevet.") end mysql:freeResult(query) end addEvent("onClientLoginRequest", true) addEventHandler("onClientLoginRequest", getRootElement(), onClientLoginRequest) And the error message: [2012-11-24 19:17:13] ERROR: account_manager\s_account_functions.lua:37: table index is nil What am i doing wrong?
  2. i have another problem it uses extremely amount of performance and my fps drops here's my lua code: -- -- c_bloom.lua -- local scx, scy = guiGetScreenSize() ----------------------------------------------------------------------------------- -- Le settings ----------------------------------------------------------------------------------- Settings = {} Settings.var = {} Settings.var.bloom = 1.5 Settings.var.blendR = 255 Settings.var.blendG = 255 Settings.var.blendB = 255 Settings.var.blendA = 100 ---------------------------------------------------------------- -- onClientResourceStart ---------------------------------------------------------------- addEventHandler( "onClientResourceStart", resourceRoot, function() -- Version check if getVersion ().sortable < "1.1.0" then outputChatBox( "Resource is not compatible with this client." ) return end -- Create things myScreenSource = dxCreateScreenSource( scx/2, scy/2 ) blurHShader,tecName = dxCreateShader( "blurH.fx" ) outputDebugString( "blurHShader is using technique " .. tostring(tecName) ) --blurVShader,tecName = dxCreateShader( "blurV.fx" ) --outputDebugString( "blurVShader is using technique " .. tostring(tecName) ) -- Check everything is ok bAllValid = myScreenSource and blurHShader if not bAllValid then outputChatBox( "Could not create some things. Please use debugscript 3" ) end end ) ----------------------------------------------------------------------------------- -- onClientHUDRender ----------------------------------------------------------------------------------- addEventHandler( "onClientHUDRender", root, function() if not Settings.var then return end if bAllValid then -- Reset render target pool RTPool.frameStart() -- Update screen dxUpdateScreenSource( myScreenSource ) -- Start with screen local current = myScreenSource -- Apply all the effects, bouncing from one render target to another current = applyGBlurH( current, Settings.var.bloom ) --current = applyGBlurV( current, Settings.var.bloom ) -- When we're done, turn the render target back to default dxSetRenderTarget() -- Mix result onto the screen using 'add' rather than 'alpha blend' if current then dxSetShaderValue( blurHShader, "TEX0", current ) local col = tocolor(Settings.var.blendR, Settings.var.blendG, Settings.var.blendB, Settings.var.blendA) dxDrawImage( 0, 0, scx, scy, blurHShader, 0,0,0, col) end end end ) ----------------------------------------------------------------------------------- -- Apply the different stages ----------------------------------------------------------------------------------- function applyGBlurH( Src, bloom ) if not Src then return nil end local mx,my = dxGetMaterialSize( Src ) local newRT = RTPool.GetUnused(mx,my) if not newRT then return nil end dxSetRenderTarget( newRT, true ) dxSetShaderValue( blurHShader, "TEX0", Src ) dxSetShaderValue( blurHShader, "TEX0SIZE", mx,my ) dxSetShaderValue( blurHShader, "BLOOM", bloom ) dxDrawImage( 0, 0, mx, my, blurHShader ) return newRT end ----------------------------------------------------------------------------------- -- Pool of render targets ----------------------------------------------------------------------------------- RTPool = {} RTPool.list = {} function RTPool.frameStart() for rt,info in pairs(RTPool.list) do info.bInUse = false end end function RTPool.GetUnused( mx, my ) -- Find unused existing for rt,info in pairs(RTPool.list) do if not info.bInUse and info.mx == mx and info.my == my then info.bInUse = true return rt end end -- Add new local rt = dxCreateRenderTarget( mx, my ) if rt then outputDebugString( "creating new RT " .. tostring(mx) .. " x " .. tostring(mx) ) RTPool.list[rt] = { bInUse = true, mx = mx, my = my } end return rt end and the .fx code: // // Example shader - blurH.fx // // Horizontal blur // //--------------------------------------------------------------------- // blurH settings //--------------------------------------------------------------------- float sBloom : BLOOM = 1; texture sTex0 : TEX0; float2 sTex0Size : TEX0SIZE; //--------------------------------------------------------------------- // Include some common stuff //--------------------------------------------------------------------- #include "mta-helper.fx" //----------------------------------------------------------------------------- // Static data //----------------------------------------------------------------------------- static const float Kernel[13] = {-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6}; static const float Weights[13] = { 0.002216, 0.008764, 0.026995, 0.064759, 0.120985, 0.176033, 0.199471, 0.176033, 0.120985, 0.064759, 0.026995, 0.008764, 0.002216}; //static const float Weights[13] = { 0.2270270270, 0.3162162162, 0.0702702703, 0.064759, 0.120985, 0.176033, 0.199471, 0.176033, 0.120985, 0.064759, 0.026995, 0.008764, 0.002216}; //--------------------------------------------------------------------- // Sampler for the main texture //--------------------------------------------------------------------- sampler Sampler0 = sampler_state { Texture = (sTex0); MinFilter = Linear; MagFilter = Linear; MipFilter = Linear; }; //--------------------------------------------------------------------- // Structure of data sent to the vertex shader //--------------------------------------------------------------------- struct VSInput { float3 Position : POSITION0; float4 Diffuse : COLOR0; float2 TexCoord : TEXCOORD0; }; //--------------------------------------------------------------------- // Structure of data sent to the pixel shader ( from the vertex shader ) //--------------------------------------------------------------------- struct PSInput { float4 Position : POSITION0; float4 Diffuse : COLOR0; float2 TexCoord: TEXCOORD0; }; //------------------------------------------------------------------------------------------ // VertexShaderFunction // 1. Read from VS structure // 2. Process // 3. Write to PS structure //------------------------------------------------------------------------------------------ PSInput VertexShaderFunction(VSInput VS) { PSInput PS = (PSInput)0; // Calculate screen pos of vertex PS.Position = MTACalcScreenPosition ( VS.Position ); // Pass through color and tex coord PS.Diffuse = VS.Diffuse; PS.TexCoord = VS.TexCoord; return PS; } //------------------------------------------------------------------------------------------ // PixelShaderFunction // 1. Read from PS structure // 2. Process // 3. Return pixel color //------------------------------------------------------------------------------------------ float4 PixelShaderFunction(PSInput PS) : COLOR0 { float4 Color = 0; float2 coord; coord.y = PS.TexCoord.y; for(int i = 0; i < 7; ++i) { coord.x = PS.TexCoord.x + Kernel[i]/sTex0Size.x; coord.y = PS.TexCoord.y + Kernel[i]/sTex0Size.y; Color += tex2D(Sampler0, coord.xy) * Weights[i] * sBloom; } Color = Color * PS.Diffuse; Color.a = 1; return Color; } //------------------------------------------------------------------------------------------ // Techniques //------------------------------------------------------------------------------------------ technique blurh { pass P0 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } // Fallback technique fallback { pass P0 { // Just draw normally } }
  3. i edited the c_bloom.lua and the blurh.fx files and it works thank you very much
  4. yes, it is, i'll try it
  5. The problem is that the effect is only one-way. The gaussian blur effect benefits both directions is required. A vertical and a horizontal accordingly.
  6. Can you show me how can I do it? There is a graphic of the team, but unfortunately he can not make that transparent to the blur. (I do not want to blur an image, but the player's camera. Such an HDR effect, but it is only 2D)
  7. I expressed myself badly almost everything I can do whatever I want in lua, but I do not know the .fx file prepared
  8. I want to make it in-game, not outside.
×
×
  • Create New...