Jump to content

pa3ck

Members
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    7

Posts posted by pa3ck

  1. Can you not use getRealTime timestamp and calculate the time that way? 

     

    You might need to adjust it a bit for local time, since client side it will return the client's PC time rather than the server time, but you can adjust that before a race begins. 

  2. There are couple of questions that need to be answered first... you only mention client side, so you don't care whether the blinkers are same for everyone? If so, you can use XML or JSON string in a client file - remember that fromJSON takes a string and converts it into a LUA table and toJSON converts a LUA table to a string that you can store in a file, once you converted the string back to LUA table, you can handle it as any other table.

  3. Hi, I think the best option would be to use an image instead of dx function.. you can still create the arrow and text with dx functions, but the base gradient would be an image. If you really want to use pure dx, I put together some code that would create the same gradient effect using dxGetTexturePixelsdxSetPixelColorinterpolateBetween

    See code below:

    addEventHandler ("onClientResourceStart", resourceRoot, 
        function () 
            texture = dxCreateTexture (300, 25)
            local pixels = dxGetTexturePixels (texture)
            for i=0,300 do	 
    			local progress = 100 / 300 * i / 100
    			local r, g, b = interpolateBetween ( 255, 0, 0, 255, 255, 0, progress, "Linear")
                for j=0,25 do
                    dxSetPixelColor (pixels, i, j, r, g, b, 255)
                end
            end
            dxSetTexturePixels (texture, pixels)
    		texture2 = dxCreateTexture (600, 25)
            local pixels2 = dxGetTexturePixels (texture2)
            for i=0,300 do	 
    			local progress = 100 / 300 * i / 100
    			local r, g, b = interpolateBetween ( 255, 255, 0, 0, 255, 0, progress, "Linear")
                for j=0,25 do
                    dxSetPixelColor (pixels2, i, j, r, g, b, 255)
                end
            end
            dxSetTexturePixels (texture2, pixels2)
    	end)
    
    addEventHandler ("onClientRender", root,
        function ()
             dxDrawImage (300, 300, 300, 25, texture)
    		 dxDrawImage (600, 300, 300, 25, texture2)
        end)
    	
    	
    	
    	

    If you need explanation let me know, I can go into detail, but I think it's pretty straight forward. 

  4. Akkor most kinek is vannak szövegértelmezési problémai? Én azt mondtam, hogy azok az emberek rontják a közösséget, nem a srácról állítottam. Máskor inkább olvasd el figyelmesebben. Kötekedés lenne, ha megkérdezem, hogy ő pontosan mit is tenne egy szerver készítéshez? Ha igen akkor ne tudd meg mekkora beefet fog kapni másoktól.. :D

  5. Én értelmezem félre? Én nem értelmeztem semmit félre barátom, én csak érdeklődtem.. A közösség viszont elmondom neked miért romlott meg az elmúlt pár évben. Mindenki saját szervert akar, pedig se a tudása se a képessége nem engedi, azt hiszi, hogy ha egy havi 1500 forintos VPS-t biztosit akkor minden meg van oldva, illetve egy 0 profittal rendelkező szerver x százalékát juttatás címszó alatt ígérget, de sok szerencsét, biztos vagyok benne, hogy találni fogsz fejlesztőket. 

  6. Szia. Tehát keresel programozót, web fejlesztőt, designert illetve modellezőt. Magyarul minden pozícióra keresel embert, ami azt jelenti, hogy te semmit nem nyújtasz. Miért jönne akárki is hozzád,  mit tudsz TE hozzá tenni a projecthez? 

    • Haha 1
  7. 8 hours ago, sanyisasha said:

    [redacted]

    Here you can find tons of RP gamemodes :)
    It's hungarian language, but better then owl mod :D (Btw you can find the 2016 Owl gaming mod in it)

    Good job linking bunch of leaked resources...

  8. In the first instance, you set it on the window element, not the button, that's why it only worked when you clicked on the window and nothing else. Using 

    getResourceRootElement(getThisResource())

    OR

    resourceRoot

    is advised, since you only want to hook the event to the GUI being created by this resource anyway. 

    • Thanks 1
  9. You probably have some resource running that sets back the alpha of the player. In your first code you set it every 3 seconds even when it's already 50, then it's being set back, that is why it flickers every 3 seconds. In Lysanders code it sets it every 1 second that is why it flickers even faster. Search for the keyword setElementAlpha in your resources folder using Notepad++ or similar. 

    • Thanks 1
  10. Show the function / event where you set the timer. If that's all the code you have, do this:

     

    setTimer(function( )
        for k, thePlayer in ipairs(getElementsByType("player")) do
          if getElementData(thePlayer, "asd.asd") then
              outputChatBox("asd", thePlayer, 255, 255, 255, true)
          end
        end
    end, 1000*3, 0)

    Keep in mind this will always loop through all players. If you want to only run it for X players, you should tie it to an event / function and pass the in the player element as explained in the previous replies. 

  11. 1. dbPoll will always return true as long as the statement returned without an error, even though it's empty, which means your first if statement will always be true (unless DB error happens)

    2. Since you are using LIMIT 1, there's no need to use loop, it's impossible to return multiple rows. 

    3. dbPoll returns a table with the following structure (only 1 row in your case):

    {
        { colname1=value1, colname2=value2, ... },
        { colname1=value3, colname2=value4, ... },
        ...
    }

    Try this: 

    if res[1]["Name"] then
      outputChatBox("User is registered")
    else
      outputChatBox("User is not registered")
    end

    4. fromJson(toJson(res)) - what are you trying to achieve there? Is your data saved as JSON object in DB? Either way, converting to then back from JSON is pointless. 

  12. Megértem, hogy egyedi szervert akarsz, de ennyi pénzért nem fogsz találni minőségi munkát, szerintem inkább gondolkozz egy kész módon és ahhoz tedd hozzá a saját ötleteid. Olcsóbb és gyorsabb, nincs olyan RP szerver ami nem az alapból elérhető Valhalla vagy egy bizonyos lengyel RP alapot használ.

  13. setElementData is meant to be temporary, so if a player rejoins, their elementData is cleared, if you restart the server all elementData is cleared, so yes, it is normal. 

    • Like 1
    • Thanks 1
  14. It's not clear what you're trying to do and what your problem is. So you want the leader to be able to add / kick players, but you don't know who the leader is? What is wrong with your code? Any errors? Which "if" statement does the execution fail at? 

  15. It's some sort of a pseudo code, but it should give you an idea.. As @Shayf said, setTimer doesn't really go well with animations, it will be slow and clunky.

    local inRenderHealth = 0
    local renderStart = getTickCount()
    
    function drawHealth()
      
      local playerHealth = Math.ceil ( getElementHealth ( localPlayer ) )
      
      if(inRenderHealth ~= playerHealth )
        renderStart = getTickCount()
      end
      
      local now = getTickCount()
      local endTime = renderStart + 500
      local elapsedTime = now - renderStart
      local duration = endTime - renderStart
      local progress = elapsedTime / duration
      local inRenderHealth, _, _ = interpolateBetween ( inRenderHealth, 0, 0, playerHealth, 0, 0, progress, "Linear")
      
      dxDrawRectangle ( 0, 0, inRenderHealth * 4, 20 )
    end

     

    • Like 1
×
×
  • Create New...