Jump to content

MrKAREEM

Members
  • Posts

    621
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by MrKAREEM

  1. OnClientClick

    IsMouseInPosition

     

    On 10/10/2020 at 13:36, Lezlike said:

    how can I turn the clicked line color to red, or size to bigger ? How can I detect which line was clicked?

    for the color here's an example

    local r = 255
    local b = 0
    local g = 0
    
    addEventHandler("onClientRender", root,
    function()
    dxDrawLine3D ( 0, 0, 0, 0, 0, 0, tocolor ( r, b, g, alpha ))
    end)
    
    addCommandHandler('green',
    function()
    r = 0
    b = 255
    g = 0
    end)

     

  2. I bought a laptop recently and I'm facing a problem with the game,

    the problem is the low fps

    The fps rate is between 10 to 24 and it may be less.

    This problem causes me problems and I feel that I do not play the game at all.

    I do not know if the problem is due to the capabilities of the laptop or Windows because I searched for about two months

    and did not find a solution.

     

    • Laptop Capabilities:

     

    1. hp laptop 15-ra0xx
    2. processor : intel(R) Celeron(R) CPU N3060 @ 1.60GHz 1.60 GHz
    3. Ram : 4gb
    4. 64×bit
    5. windows : wnidows 10 pro

     

  3. مش شايف اخطاء بس جرب تخلي الايفينت للروت

    واتاكد ان فيه حد بيدمجك او انك وقعت من فوق سيكل وانت بتجرب السكربت

    لانك حاطط تحقق علي الاتاكر

    • Like 1
  4. in the lines 8 and 9 change getLocalPlayer() with getElementsByType('player')

     

    6 hours ago, redditing said:

    My goal is that when the player clicks on the first button, the function for this button is to change for each player in his team, but unfortunately the function changes only for the person who clicked.

    
    --client side
    local Button1 = guiCreateButton(--There are no valid arguments
    )
    
    addEventHandler("onClientGUIClick", Button1, OnTeamPlayerClickLVL1)
    
    function OnTeamPlayerClickLVL1()
      	for i, v in pairs(getPlayersInTeam(getPlayerTeam(getElementsByType('player')))) do
        	outputChatBox("U bought level 1 for your TEAM ^^", 0, 255, 0)
    
        	removeEventHandler("onClientGUIClick", Button1, OnTeamPlayerClickLVL1)
        
        	addEventHandler("onClientGUIClick", Button1, OnTeamPlayerClickLVL2)
        end
      end
    
    function OnTeamPlayerClickLVL2()
      	for i, v in pairs(getPlayersInTeam(getPlayerTeam(getElementsByType('player')))) do
        	outputChatBox("U bought level 2 for your TEAM ^^", 0, 255, 0)
    
        	removeEventHandler("onClientGUIClick", Button1, OnTeamPlayerClickLVL2)
        end
      end
    
    -- server side
    
    RED = createTeam("Red Team", 255, 0, 0)
    
    BLUE = createTeam("Blue Team", 0, 0, 255)

    Here is my code that works only for ONE person and I want for the current team

     

  5. sim você pode fazer isso usando:

    FileOpen 

     

    file fileOpen ( string filePath [, bool readOnly = false ])
    • filePath : ": resourceName / path". 'resourceName' é o nome do recurso em que o arquivo está e 'path' é o caminho do diretório raiz do recurso para o arquivo. Por exemplo, se houver um arquivo chamado 'coolObjects.txt' no recurso 'objectSearch', ele poderá ser aberto a partir de outro recurso da seguinte maneira: fileOpen (": objectSearch / coolObjects.txt"). Se o arquivo estiver no recurso atual, apenas o caminho do arquivo será necessário, por exemplo fileOpen ("coolObjects.txt").

    FileRead

    FileWrite

    FileClose

    • Thanks 1
  6. 19 hours ago, Laith. said:

    بدي اصنع مود التاكسي 

    شرح المود: انه تكتب /taxi

    و يجي لأصحاب التاكسي لوحة انه يقبل أو لا

    ممكن تعلموني كيف أو إذا في مود أعطني اياه

    حمل سكربت وشوف بيشتغل ازاي واتعلم منه لان صعب واحد يشرحلك سكربت طويل زي دا

  7. 12 minutes ago, FabianRs said:

    Creo que así es más fácil y más "económico" que andar tomando a todos los jugadores del sv cada vez que alguien habla por el chat customizado.

    addCommandHandler("lchat",
    function(player,cmd,...)
    local msg = table.concat( {...}, " " )
    if msg then
    local x,y,z = getElementPosition(player)
    local name = getPlayerName(player)
    for k,v in ipairs(getElementsByType("player")) do
    local pos = Vector3(getElementPosition(v))
    if getDistanceBetweenPoints3D ( x, y, z, pos.x, pos.y, pos.z ) < 20 then
    outputChatBox( "* "..name..": "..msg, v, 200, 250, 200, true )
    end
    end
    end
    end
    )
    
    addEventHandler("onPlayerJoin", root,
        function()
            bindKey(source, "U", "down", "chatbox", "lchat") 
        end
    )

    es mas facil es más fácil a menos que cree formas de colls

  8. 2 hours ago, FabianRs said:

    Puedes empezar asi...

    
    --SERVER SIDE
    addCommandHandler("lchat",
        function(player,cmd,...)
    	    local msg = table.concat( {...}, " " )
            if msg then
    		    local x,y,z = getElementPosition(player)
                local sp = createColSphere( x, y, z, 20 )
    			setTimer( destroyElement, 100, 1, sp )
    			local name = getPlayerName(player)
    			for k,v in ipairs(getElementsWithinColShape(sp,"player")) do
                    outputChatBox( "* "..name..": "..msg, v, 200, 250, 200, true )
    		    end
    		end	
    	end
    )	
    
    addEventHandler("onPlayerJoin", root,
        function()
            bindKey(source, "U", "down", "chatbox", "lchat") 
        end
    )
    

     

    ¿Por qué creas coll? puedes recorrer todos los jugadores y usar GetDistanceBetweenPoints3D

    al crear un objeto o una coll en el servidor de esa manera, debe usar la tabla porque si otro jugador envía un mensaje, la coll será destruida por él o causará algunos errores

  9. 5 hours ago, Jercko said:

    سويت كل الي قله وظبط معي بس في مشكلة واحدة

    انا عملت Attach للعلم وركبت التكسشر عليه بس ماطلع في اللعبة والعلم لونه اسود في البرنامج

    spacer.png

    ممكن العيب في المجسم نفسه أحيانا المشكلة دي بتحصل حاول تشيله من الاتاك وتخليه في قائمة CHASSIS

  10. server :

    local chat = 'Local'
    local command = 'chat'
    
    addCommandHandler(command,
    function(player,_,...)
        if not player then return end
          if isPlayerMuted ( player ) then return outputChatBox('you are muted!',player,255,255,0) end
          local arg = {...}
    	  local count = #arg
    	  if count < 1 then return outputChatBox('the messeage must be 1 line at least!',player,255,0,0) end
          local string = table.concat( arg, " " )
    	  local r,b,g = getPlayerNametagColor(player)
    	  if r and b and g then
          outputChatBox ( '('..chat..'): '..string.format("#%.2X%.2X%.2X", r, g, b)..''..string.gsub(getPlayerName(player),'#x%x%x%x%x%x%','')..'#FFFFFF : '..string, root, 255,255,255, true )
          else
          outputChatBox ( '('..chat..'): '..string.gsub(getPlayerName(player),'#x%x%x%x%x%x%','')..' : '..string, root, 255,255,255, true )  
          end
        end)

     

  11. você pode usar a renderização do cliente e verificar se o mouse está na posição, para mudar de cor, aqui está um exemplo

    local sX, sY = guiGetScreenSize()
    local r, b, g, alpha = 0, 0, 0, 0
    local visible = false
    local state
    
    function isMouseInPosition ( x, y, width, height )
    	if ( not isCursorShowing( ) ) then
    		return false
    	end
    	local sx, sy = guiGetScreenSize ( )
    	local cx, cy = getCursorPosition ( )
    	local cx, cy = ( cx * sx ), ( cy * sy )
    	
    	return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
    end
    
    function draw()
    if visible = true then
    dxDrawRectangle(sX * 0.0154, sY * 0.3008, sX * 0.2284, sY * 0.3242, tocolor(r, b, g, alpha))
    if isMouseInPosition(sX * 0.0154, sY * 0.3008, sX * 0.2284, sY * 0.3242) then r,b,g = 255,0,0 else r,b,g = 0,0,0 end
    end
    end
    
    function fadeIN_FadeOut()
    if state == 'increase' then
    if alpha < 1 then
    alpha = alpha + 5 end
    if alpha > 254 then
    removeEventHandler('onClientRender',fadeIN_FadeOut) end
    elseif state == 'decrease' then
    if alpha > 254 then
    alpha = alpha - 5 end
    if alpha < 1 then
    removeEventHandler('onClientRender',fadeIN_FadeOut) end
    end
    end
    
    bindKey('F2','down',
      function()
        if visible == false then
          visible = true
          addEventHandler("onClientRender", root, draw)
          addEventHandler("onClientRender", root, fadeIN_FadeOut)
    	  state = 'increase'
          else
          visible = false
          removeEventHandler("onClientRender", root, draw)
    	  addEventHandler("onClientRender", root, fadeIN_FadeOut)
    	  state == 'decrease'
          end
        end)

     

    • Like 1
  12. 58 minutes ago, Hexon said:

    I think replace math.ceil to math.floor because rounding down returning a little bit real information for the player (if the player HP is 99.32 then dxDrawText display 100 but if you use .floor then displaying 99 . I think my solution is a little bit exact)

    math.floor will returns a less value if the speed 100 it will display 99 ?

×
×
  • Create New...