Jump to content

h4x7o0r

Members
  • Posts

    203
  • Joined

  • Last visited

Posts posted by h4x7o0r

  1. And don't say to me that this has nothing to do with it, because this how you animate things.......

    Thanks for you reply but either u haven't read the posts above either you didn't get what i asked for.

    As i said before:

    "What i need is to know how can i create the conditions in order to replicate this accordion effect ?"

    I can create animations by myself but the if statements involved for creating the functionality is what i'm missing.

    Anyways that seems too complicated for me so if someone wants to create what i need for a fair price, just pm me.

  2. Thanks for your reply .:HyPeX:. but i think it's not what i need but i appreciate your effort.

    Anyone who can create this for me for a fair price ? Need a pretty skilled scripter as long as some other scripters already tried to help me with this and failed.

    Thanks in advance.

  3. Thanks a lot guys for your time trying to help me.

    SDK, yeah that's a good view over the entire script, thanks a lot i'll try to fix this and adapt to my needs.

    HyPeX, well sincerely i have no clue what's this all code about but thanks anyway for your time.

  4. Line 32 in his code returned nil. I think it's because of typo.

     local searchForANicks = executeSQLQuery("SELECT `nicks` from `aliases` WHERE `serial`=?", targetSerial) -- checking 
    --> 
    local searchForANicks = executeSQLQuery("SELECT `nicks` FROM `aliases` WHERE `serial`=?", targetSerial) -- checking 
      
    

  5. Thanks mate, i'm getting already cursor position. Your idea with GUI's seems great but at this moment, my problem isn't animation.

    I wanna use some IF statements to determine a rule, like when mouse is over an arena , that arena to increase its height while arenas above the decrease + move up and also arenas beyond decrease + move down.

    I don't know how to exclude the arena when mouse is over it because, for example hover == true wont work in this case. (mouse will be over an arena still when i need to shrink and move others, that's why hover==false isn't executed).

  6. Hey there guys,

    I spent already enough days just to figure it out how can i create a nice vertical accordion animated menu.

    Here's a link with the live animation (just because it's pretty complicated to explain, vertical one) :

    http://goo.gl/rmoLSz

    So here's what i tried so far. This is the way rooms are organized :

    Arenas = {} 
      
    Arenas.Paianjen= {} 
    Arenas.Paianjen.unique = 1  
    Arenas.Paianjen.x = coloana1 
    Arenas.Paianjen.y = randul1 
    Arenas.Paianjen.mouseY = randul1 
    Arenas.Paianjen.size = lungime 
    Arenas.Paianjen.height = inaltime 
    Arenas.Paianjen.moveLock = false 
    Arenas.Paianjen.Element = getElementByID("Paianjen") 
      
    Arenas.Bondar= {} 
    Arenas.Bondar.unique = 2 
    Arenas.Bondar.x = coloana1 
    Arenas.Bondar.y = randul1 
    Arenas.Bondar.mouseY = randul1 
    Arenas.Bondar.size = lungime 
    Arenas.Bondar.height = inaltime 
    Arenas.Bondar.moveLock = false 
    Arenas.Bondar.Element = getElementByID("Bondar") 
      
    Arenas.Hiena= {} 
    Arenas.Hiena.unique = 3 
    Arenas.Hiena.x = coloana1 
    Arenas.Hiena.y = randul1 
    Arenas.Hiena.mouseY = randul1 
    Arenas.Hiena.size = lungime 
    Arenas.Hiena.height = inaltime 
    Arenas.Hiena.moveLock = false 
    Arenas.Hiena.Element = getElementByID("Hiena") 
      
    Arenas.Amfibie= {} 
    Arenas.Amfibie.unique = 4 
    Arenas.Amfibie.x = coloana1 
    Arenas.Amfibie.y = randul1 
    Arenas.Amfibie.mouseY = randul1 
    Arenas.Amfibie.size = lungime 
    Arenas.Amfibie.height = inaltime 
    Arenas.Amfibie.moveLock = false 
    Arenas.Amfibie.Element = getElementByID("Amfibie") 
      
    for i, arena in pairs(Arenas) do 
        local r, g, b = getColorFromString(getElementData(arena.Element, "color")) 
        arena.Color = tocolor(r, g, b, 255) 
      
    dxDrawRectangle ( arena.x, arena.y, arena.size, arena.height, arena.Color, true) 
      
    hover = mouseCheck(mx, my, arena.x, arena.x+arena.size, arena.mouseY, arena.mouseY+arena.height) 
      
        if hover == true and arena.moveLock == false then 
            --animation when mouse is over arena 
              arena.moveLock = true 
        elseif hover == false and arena.moveLock == true then  
            --animation when mouse isn't over arena 
            arena.moveLock = false 
        end 
    end 
      
    function mouseCheck(mx, my, x1, x2, y1, y2) 
    if mx < x1 or mx > x2 then return false end 
    if my < y1 or my > y2 then return false end 
    return true 
    end 
      
      
    

    These are the variables needed for the animation:

      
    DefaultArenaHeight : 70 --Default arena height when mouse isn't over 
    MaxArenaHeight = 200 --Maximum arena height when mouse is over and arena's increasing it's height 
    NumArenas : 4 -- Number of all arenas 
    DiffArenas : MaxArenaHeight - DefaultArenaHeight  -- Difference between maximum height and default height, so 200 - 70 = 130  
    RaportArenas: DiffArenas / NumArenas -- Here's the shrinking value for all arenas but the one mouse is OVER it. 
      
    

    What i need is to know how can i create the conditions in order to replicate this accordion effect ?

    i think i need to "detect" somehow when the cursor is hovering over an arena, that arena then has to change it's size (from 70 => 200) while the other ones are decreasing the height ( 70 -> RaportArenas ).

    Also the arenas above the one mouse is over, they should be moving up while shrinking, as for the arenas under the one the mouse is hovering on, they sould move down while shrinking. Kinda complicated to explain.

    Hope isn't that ambiguous, i tried to simplify as much as i could.

    Thanks in advance.

  7. Hey there,

    How can i detect if an element is broken or not ? like glass panes, some wooden platforms etc.

    I tried using IsElementOnScreen (and other functions) but it's returning false if the element isn't in near when map starts.

    Is there any event or any method to detect that ?

    Thanks in advance.

  8. Hehe already fixed it. That "error'" was because of the distance between the car and the object, (has been calculated the dfference between car and center of the object which was a little bit high than i assumed).

    Anyways thanks a lot for your help,

    All the best.

  9. Hey there,

    I don't know how can i change the alpha of an object gradually.

    so considering i'm having an object and my car at different height one from another. Then i specify if the difference between my car height and that object height is higher than 4, that objects alpha to be changed progressive from 255 to 150.

    At the moment, it's just a rough alpha changing like when it's > than 4 the alpha's 150.

    How can i create that transition ?

    Thanks a lot and hope isn't that ambiguous.

  10. Try to use something like this. (not tested)

    alse use .png's for transparency.

             
     local function getCameraRotation () 
            px, py, pz, lx, ly, lz = getCameraMatrix() 
            local rotz = 6.2831853071796 - math.atan2 ( ( lx - px ), ( ly - py ) ) % 6.2831853071796 
            local rotx = math.atan2 ( lz - pz, getDistanceBetweenPoints2D ( lx, ly, px, py ) ) 
            --Convert to degrees 
            rotx = math.deg(rotx) 
            rotz = math.deg(rotz)       
            return rotz 
        end 
          
        --Created rendertarget 
          
          
            addEventHandler("onClientRender",root, 
                function( ) 
                    showPlayerHudComponent( "all", false ) 
                    showPlayerHudComponent("crosshair", true) 
                    local px ,py, pz = getElementPosition( localPlayer ) 
                    local playerZone =  getZoneName( px ,py, pz )     
                    local mapX = px / ( 6000 / 6000 ) + ( 6000 / 2 ) - ( width  / 2 ) 
                    local mapY = py / ( -6000 / 6000 ) + ( 6000 / 2 ) - ( height  / 2 ) 
                    local rotation = getCameraRotation() 
                    if rendertar then 
                    dxSetRenderTarget(rendertar) 
                    dxDrawImageSection( 0, 0, width, height, mapX, mapY, width , height , "map.jpg", rotation, 0, 0, tocolor( 255, 255, 255, 255 ), false ) 
                    dxSetRenderTarget() 
                    else 
                        outputChatBox(rendertar) 
                    end 
                    dxDrawImage(posX, screeny - posY, width, height, rendertar) 
                    dxDrawImage( posX + width / 2, screeny - posY + height / 2, 10, 10, "files/me.png" ) 
          
            function findRotation( x1, y1, x2, y2 ) 
            local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) 
            if t < 0 then 
                t = t + 360 
            end 
            return t 
        end 
          
        end) 
    

  11. What i want is to that mask work as an alphamap.

    An alpha map image is basically a transparency map, it has the information of what areas of the image under it are hidden.

    In a alpha map black means transparent, and white visible.

    Example: Click

    So just to summarize all, i have a couple of visual elements (dxdrawimage' ones) at the same position on the screen (lets say:

    renderzone1:

    position x : 100

    position y : 200

    width: 200

    height: 150.

    What i need to do is to set a frame/mask/alphamap over that all elements on the screen and the same position with width : 400 and height: 300.

    So if any of the elements (renderzone1) under the mask are moving outside renderzone1 the underneath elements to not be visible.

    some part of codes:

        finalAlpha = 210 
            mask=dxCreateTexture('img/mask.png') 
            shader=dxCreateShader('shader.fx') 
        renderTarget = dxCreateRenderTarget( 310, 250, false ) 
            dxSetShaderValue(shader,'finalAlpha',finalAlpha/255) 
            dxSetShaderValue(shader,'maskTex0',mask) 
        outputChatBox('Textures loaded.',false,255,0,0) 
      
    

    and also the shader

     --shader.fx 
      
    texture tex0;       // texture 
    texture maskTex0;   // mask 
    float finalAlpha; 
      
    sampler sBase = sampler_state {  
        Texture = (tex0); 
        MinFilter = Linear; 
        MagFilter = Linear; 
        AddressU = Clamp; 
        AddressV = Clamp;  
    }; 
    sampler sAlpha = sampler_state { Texture = (maskTex0); }; 
      
    float4 ps( float2 Base : TEXCOORD0 ) : COLOR 
    { 
        float4 color; 
        float4 alpha; 
        color = tex2D( sBase, Base.xy ); 
        alpha = tex2D( sAlpha, Base.xy ); 
        color.a = alpha.r*finalAlpha; 
        return color; 
    } 
      
    technique mask 
    { 
        pass p0 
        { 
            AlphaBlendEnable = TRUE; 
            DestBlend = INVSRCALPHA; 
            SrcBlend = SRCALPHA; 
            VertexShader = null; 
            PixelShader = compile ps_2_0 ps(); 
        } 
    } 
      
    

    All good after this now all i need to do is to link things together.

  12. Hey guys, i need your help.

    What i'm trying to do is to create a mask like over a rectangle so that just a part of the rectangle to be visible.

    I tried a lot of possibilities but looks like it's kinda tricky.

    So what i did so far was to :

    create the texture for mask/ the shader /and the rendertarget. after that i setshadervalues and then tried to figure it out how to put all things together. What's the correct syntax considering all I mentioned before ?

    Thanks in advance.

  13. Thanks for your reply Bons.

    Tried clientside this way :

      
            addEventHandler ("onClientMapStarting", root,  
        function() 
    if exports.race:getTimePassed() > tonumber(0) then     
       -- ERROR: call : failed to call race:getTimePassed() [string '?'] 
       -- ERROR: attempt to compare a number with a boolean 
      outputChatBox ("Test") 
    end 
    end  
    )  
    

    but anyways, the important part is how can i set all players frozen until some of the team players will press a key?

    Thanks in advance.

  14. Thanks for your reply. Actually i tried to make something, tried so many changes but without any luck

    Here's what i've tried already :

      
    -- client-side 
       function onClientRaceStateChanging ( newStateName, oldStateName) 
            if newStateName == "GridCountdown" then 
               triggerServerEvent ( "test", getRootElement(), thePlayer) 
            end 
        end 
        addEvent( "onPlayersReady", true ) 
        addEventHandler( "onPlayersReady", getRootElement(), onClientRaceStateChanging ) 
      
    

      
    -- serverside 
      
        addEvent ("test", true) 
        addEventHandler("onPlayerReady", getRootElement(), 
        function test ( thePlayer)  
        local connectedPlayers = getElementsByType ( "player" ) 
        for i, aPlayer in ipairs(connectedPlayers) do 
        bindKey ( aPlayer, "r", "down", "Toggle freeze status", toggleFreezeStatus ) 
        end 
        end ) 
         
    function toggleFreezeStatus ( thePlayer ) 
        if getPedOccupiedVehicle ( thePlayer ) then 
            local playerVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local currentFreezeStatus = isElementFrozen ( playerVehicle ) 
            local newFreezeStatus = not currentFreezeStatus 
            setElementFrozen ( playerVehicle, newFreezeStatus ) 
        end 
    end 
      
    

    Tried using a toggle for the moment (e.g from wiki) so i can see if things are triggered but no luck.

  15. Hey there , i need your help guys.

    Considering there are two team and a global rule : no more than 2 players alive.

    how can i set all players from vehicles frozen after countdown ends, (if there are more than 2 players alive for e.g) until some of alive players will press a key so after round starts they will be killed. I'll give u an example so i will make things clearer.

    Example:

    Rule: no more than 2 players alive.

    Team1 has 3 players

    Team2 has 4 players

    Round starts: All players are frozen until 1 player from team1 and 2 players from team2 will press a key. After that, players that pressed "the key" will be killed and round will continue with equal number of alive players from each team.

    Thanks a lot for your time reading this

    and waiting for your help.

×
×
  • Create New...