Jump to content

Lalalu

Members
  • Posts

    202
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Lalalu

  1. Hello everyone, i was wondering if there's a way to make some models exceptions on this code, that is supposed to delete all GTA default models but i need the ints to not be deleted :/ so i want to know how can i make exceptions for some interior models..

    addEventHandler("onResourceStart", resourceRoot, function()
    
    for i=550, 20000 do
    removeWorldModel(i, 10000, 0, 0, 0)
    setOcclusionsEnabled(false)
    end
    end)

     

  2. On 12/09/2023 at 09:38, alex17" said:

    para desconponer la tabla con el for en este caso debe usar pairs en vez ipairs , tambien toma en cosideración si el uso de isLineOfSightClear es necesario ya que es en parte lo que aumentara los bajones de fps cuando haya muchos peds , asi mismo tambien le añadiria una variable que te indique si la tabla tiene elementos para que el onClientRender siga ejecutandose o debe pararse, pequeñas cositas que aligeraran la carga a los fps

    addEventHandler( "onClientElementStreamOut", root, 
        function ()
           if NPCWeapon[source] then 
              NPCWeapon[source] = nil 
           end 
          removeEventHandler("onClientRender", root, dxDrawImagenOnPed)
          addEventHandler("onClientRender", root, dxDrawImagenOnPed)
        end
    )
    
    addEventHandler("onClientElementDestroy", root, 
      function ()
           if NPCWeapon[source] then 
              NPCWeapon[source] = nil 
           end 
      end
    )
    
    function dxDrawImagenOnPed)()
       local draw = false 
       for _,PedWeapon in pairs(NPCWeapon) do
          if PedWeapon then 
             draw = true 
             local x, y, z = getElementPosition(PedWeapon)   
       	     dxDrawImageOnWeapon(PedWeapon,TagWeapon)
          end 
       end
       if not draw then 
          removeEventHandler("onClientRender", root, dxDrawImagenOnPed)
       end 
    end 

     

    Holaa, gracias por responder mi post. Disculpa, no suelo visitar frecuentemente el foro, pero acabo de testear así:

     

    local sX, sY = guiGetScreenSize ( )
    
    function dxDrawImageOnArmas (TheArmas,ImageArmas, distance,height,width,R,G,B,alpha)
    local cx, cy, cz = getCameraMatrix ( );
     local x, y, z = getPedBonePosition ( TheArmas, 6 );
      local dArmasIcon = getDistanceBetweenPoints3D( cx, cy, cz, x, y, z);
       if ( dArmasIcon < 10 ) then
        if (isLineOfSightClear(cx, cy, cz, x, y, z, true, true, false, false, true, false, false, localPlayer )) then
         local sx, sy = getScreenFromWorldPosition ( x, y, z+0.55 )
          if ( sx ) and ( sy ) then
    
          local sArmasIcon =760  / dArmasIcon;
    						
          dxDrawImage ( sx - ( sArmasIcon / 2  ), sy - ( sArmasIcon / 2 ), sArmasIcon, sArmasIcon, ImageArmas, 0, 0, 0, tocolor (R or 255, G or 255, B or 255, alpha or 255) );
          end
        end
      end
    end
    
    local Pos_Armas = {
      {117, -169.2294921875, -75.96875, 711.21716308594, 315},
      {141, -166.08984375, 1883.509765625, 724, 272},
      {245, -1591.166015625, -607.01483154297, 711.17346191406, 39},
      {207, 2073.5895996094, 88.1796875, 721.94860839844, 9},
      {117, 2560.8657226562, 1050.4641113281, 727.25622558594, 270}
    }
    
    local NPCArmas = {}
    local TagArmas = dxCreateTexture("Images/Icon.webp")
    
    for i,v1 in ipairs (Pos_Armas) do
       CrearPedArmas = createPed(v1[1],v1[2],v1[3],v1[4],v1[5])
       table.insert(NPCArmas,#NPCArmas + 1,CrearPedArmas)
       setElementFrozen ( CrearPedArmas, true ) setPedVoice(CrearPedArmas, "PED_TYPE_DISABLED", "")
       setPedAnimation( CrearPedArmas, "SMOKING", "M_SMK_LOOP",-1,true,false,false,false )	
       addEventHandler ( "onClientPedDamage",CrearPedArmas, function () cancelEvent() end)
       addEventHandler("onClientPlayerStealthKill",localPlayer, function (targetPlayer) if targetPlayer == CrearPedArmas then cancelEvent() end end)
    end
    
    addEventHandler( "onClientElementStreamIn", root, 
        function ()
            if getElementType(source) == "ped" and not NPCArmas[source] then
               NPCArmas[source] = source
            end
        end
    )
    
    addEventHandler( "onClientElementStreamOut", root, 
        function ()
           if NPCArmas[source] then 
              NPCArmas[source] = nil 
           end 
    	  removeEventHandler("onClientRender", root, dxDrawImageOnArmas)
          addEventHandler("onClientRender", root, dxDrawImageOnArmas)
        end
    )
    
    addEventHandler("onClientElementDestroy", root, 
      function ()
           if NPCArmas[source] then 
              NPCArmas[source] = nil 
           end 
      end
    )
    
    
    function dxDrawImageOnArmas()
       local draw = false 
       for _,PedArmas in pairs(NPCArmas) do
          if PedArmas then 
             draw = true 
             local x, y, z = getElementPosition(PedArmas)   
       	     dxDrawImageOnArmas(PedArmas,TagArmas)
          end 
       end
       if not draw then 
          removeEventHandler("onClientRender", root, dxDrawImageOnArmas)
       end 
    end 

     

    Pero no funciona, me aparece un error y me ocasiona muchisimo lag..

    :line 71:   stack overflow

  3. 3 hours ago, FlorinSzasz said:

    well first you should add this code to the server side (i have a copy of the code i gave you long time ago for skinInventory)

    addSkinFromBox = function(player,model) -- after model add coins / money the player used to buy the box if he used
        if model ~= nil then  
        local acc_name = getAccountName(getPlayerAccount(player))
        local query = dbQuery(connection,"SELECT username,skin FROM skins WHERE username=? AND skin=? LIMIT 1",tostring(acc_name),tonumber(model))
        local rez = dbPoll(query,-1)
            if #rez > 0 then
                outputChatBox("[SKIN_SYSTEM] You have this skin already!",player)
                -- if he pays with something give the player money back or coins or something else if you should give him.
            elseif #rez == 0 then 
                -- if he doesnt have the skin update db and insert it to db!
                dbExec(connection,"INSERT INTO skins (username,skin) VALUES (?,?)",tostring(acc_name),tonumber(model))
                outputChatBox("[SKIN_SYSTEM] You got a new Skin!",player,104,255,104)
            end 
        end 
    end 

    Also If your inventory system script is in another folder you have to add this in the meta.xml where your skininventory resource is (not the inventory resource)

    <export function="addSkinFromBox" type="server"/> 

    And in the inventory resource where is your openBox event or function use this call.

    exports["test"]:addSkinFromBox(player,model)
    -- between -> " " you put your resource name folder where your skinInventory scripts are for example my skin inventory resource is in test folder
    -- player -> you put the player variable or thePlayer or client it depends what variable you have in you inventory script.
    -- model -> the model variable or how it is named in your resource.

    AND  if your inventory script is in the same folder with skinInventory script then you only add this in your openBox event or function! ->

    addSkinFromBox(player,model)

     

    Thank you. OK ok im gonna try that

  4. 7 hours ago, FlorinSzasz said:

    Yes you can add skins from another script with a command but how your command is looking or in which way you want to use that command to add skins?

    Well, i want to achieve that with my inventory system (another script) opening a box gives you a skin and add it to the gridlist. I want to know how can I add a skin to that gridlist  from another script so i can try to use it with my inventory.

    • Like 1
  5. Hello there! thanks for visiting my post.

    Some of you helped me a lot a few months ago with a skin save list using database.

    Today, this post is to ask you if its possible to add skins to that list from another script, for example using a command from another external script.

    This is the code i'm using;

    Server side

    function myskins(thePlayer,commandName) if thePlayer then local acc = getPlayerAccount( thePlayer ) local acc_name = getAccountName( acc ) local q = dbQuery(connection,"SELECT username,skin FROM skins WHERE username=?",tostring(acc_name)) local rezult = dbPoll(q,-1) if #rezult > 0 then triggerClientEvent(thePlayer,"skin_inventory",thePlayer,rezult) end end end addCommandHandler("myskins",myskins,false,false) addEvent("ChangeSkin",true) change_skin = function(Player,skin) if source == Player and client == source then setElementModel(Player,skin) end end addEventHandler("ChangeSkin",getRootElement(),change_skin)
    
    

    Client side

    function centerWindow (center_window) local screenW, screenH = guiGetScreenSize() local windowW, windowH = guiGetSize(center_window, false) local x, y = (screenW - windowW) /2,(screenH - windowH) /2 return guiSetPosition(center_window, x, y, false) end addEvent("skin_inventory",true)
    function skin_inventory_gui(rezult) skin_list = guiCreateWindow(329, 246, 465, 381, "MY SKINS", false) centerWindow(skin_list) guiWindowSetMovable(skin_list, false) guiWindowSetSizable(skin_list, false) skins = guiCreateGridList(9, 20, 376, 351, false, skin_list) guiGridListAddColumn(skins, "Description", 0.5) guiGridListAddColumn(skins, "Model/Skin Owned", 0.5) close = guiCreateButton(389, 20, 66, 21, "X", false, skin_list) set_skin = guiCreateButton(389, 40, 66, 21, "SET SKIN", false, skin_list) guiSetProperty(close, "NormalTextColour", "FFAAAAAA") showCursor(true) for key, value in ipairs(rezult) do 
    local row = guiGridListAddRow(skins) guiGridListSetItemText (skins, row, 1, "Skin Model ->", false, true)
        guiGridListSetItemText (skins, row, 2, value.skin, false, true)
      end 
      addEventHandler ( "onClientGUIClick", close, closeinventory,false) 
     addEventHandler ( "onClientGUIClick", set_skin, closeinventory,false)
    end addEventHandler("skin_inventory",root,skin_inventory_gui) closeinventory = function(button,state) 
      if (button == "left") and (state == "up") then if source == set_skin then if (guiGridListGetSelectedItem (skins)) then local skin_to_change = guiGridListGetItemText (skins, guiGridListGetSelectedItem (skins), 2) triggerServerEvent("ChangeSkin",localPlayer,localPlayer,skin_to_change) outputChatBox("[SKIN SYSTEM] You have changed your skin",160,255,160) end end showCursor (false) guiSetVisible(skin_list,false) end end 

     

    • Like 1
  6. 6 hours ago, alex17&quot; said:

    We still don't know how your missions are working, it would be easier if you provide us with the code.
    Likewise, I leave you a small example of how you could work it, although in my opinion it would be much easier if you worked everything on the server and not on the client.

    -- Server 
    
    local day = getRealTime().monthday --- Set the server day
    
    
    addEventHandler("onPlayerLogin", root, 
       function()
    
          if getRealTime().monthday ~= day then --- When a player connects, check if the day has changed
    
             day = getRealTime().monthday --- If it is another day, save it in the variable
    
             setAccountData(getPlayerAccount(source), "isMissionCompleted", false) -- resets the player's mission data
             triggerClientEvent(source, "createMissionMarker", source) --- send a trigger to the client to create the marker
          else 
             -- If the day still does not change, check if the player has already completed the mission
             local isMissionCompleted = getAccountData(getPlayerAccount(source), "isMissionCompleted")
             if not isMissionCompleted then --- If the mission has not yet been completed, send a trigger to create the marker
                triggerClientEvent(source, "createMissionMarker", source)
             end 
          end 
       end
    )
    --- When you complete the mission, send a trigger to the server to save the data
    addEvent("onMissionCompleted", true)
    addEventHandler("onMissionCompleted", root, function()
       setAccountData(getPlayerAccount(client), "isMissionCompleted", true)
    end)
    
    
    
    -- Client 
    addEvent("createMissionMarker", true)
    addEventHandler("createMissionMarker", root, function()
        marker = createMarker(...)
    end)
    
    

     

    Thanks Im gonna try, I used to use serverside, but then when many players took the mission at the same time everything got mixed up lol

  7. 9 hours ago, alex17" said:

    If they don't show us your code it is difficult to help you, first of all, how are you working on your missions on the server or on the client?

    Sorry, it's client side. I'm using destroyElement with setTimer to destroy the markers and to create it again, but when i quit the server and join again the markers appears.

    The missions I have created work like this:
    When you hit a marker, execute the mission and immediately delete that marker, that way the mission cannot be done again until the marker appears again.

    What I'm looking for is to save that, 'cause the missions must be daily, I want to make that the marker reappears only the next day once its deleted :/

  8. Hello everyone, I need help with something, I'm creating missions for my server, I want the missions to only be done daily, I mean, the marker and ped once the mission is done disappears and appears the next day. 

    The problem is, when I destroy the ped and the marker (destroyElement) and I quit or reconnect into the server, the ped and the marker appears again.

    How can I save destroyElements and make it appears daily once it's destroyed?

  9. Thank you... like this? @alex17"

    local sX, sY = guiGetScreenSize ( )
    
    function dxDrawImageOnWeapon (TheWeapon,ImageWeapon, distance,height,width,R,G,B,alpha)
    local cx, cy, cz = getCameraMatrix ( );
     local x, y, z = getPedBonePosition ( TheWeapon, 6 );
      local dWeaponIcon = getDistanceBetweenPoints3D( cx, cy, cz, x, y, z);
       if ( dWeaponIcon < 10 ) then
        if (isLineOfSightClear(cx, cy, cz, x, y, z, true, true, false, false, true, false, false, localPlayer )) then
         local sx, sy = getScreenFromWorldPosition ( x, y, z+0.55 )
          if ( sx ) and ( sy ) then
    
          local sWeaponIcon =760  / dWeaponIcon;
    						
          dxDrawImage ( sx - ( sWeaponIcon / 2  ), sy - ( sWeaponIcon / 2 ), sWeaponIcon, sWeaponIcon, ImageWeapon, 0, 0, 0, tocolor (R or 255, G or 255, B or 255, alpha or 255) );
          end
        end
      end
    end
    
    local Pos_Weapon = {
      {310, 2442.2729492188, -1592.2652587891, 2383.9047851562, 267},
      {310, 1825.6822509766, -285.5888671875, 2399.453125, 2}
    }
    
    local NPCWeapon = {}
    local TagWeapon = dxCreateTexture("myimage.webp")
    
    for i,v in ipairs (Pos_Weapon) do
       local CrearPedWeapon = createPed(v[1],v[2],v[3],v[4],v[5])
       table.insert(NPCWeapon,#NPCWeapon + 1,CrearPedWeapon)
    end
    
    addEventHandler( "onClientElementStreamIn", root, 
        function ()
            if getElementType(source) == "ped" and not NPCWeapon[source] then
               NPCWeapon[source] = source
            end
        end
    )
    
    addEventHandler( "onClientElementStreamOut", root, 
        function ()
           if NPCWeapon[source] then 
              NPCWeapon[source] = nil 
           end 
        end
    )
    
    addEventHandler("onClientElementDestroy", root, 
      function ()
           if NPCWeapon[source] then 
              NPCWeapon[source] = nil 
           end 
      end
    )
    
    addEventHandler("onClientRender",root,function()
       for _,PedWeapon in ipairs(NPCWeapon) do
          local x, y, z = getElementPosition(PedWeapon)   
       	  dxDrawImageOnWeapon(PedWeapon,TagWeapon)
       end
    end)

     

  10. Hola, una pregunta ¿cual podría ser la mejor forma de crear varios peds sin que generen lag o disminuya el rendimiento? Cada ped tiene un icono encima (dx imagen). Si coloco muchos peds en el servidor me genera bastantes bajones de fps de 60 a 30 - 35, habrá alguna forma de mejorar el rendimiento sin tener que eliminar los peds? o alguna otra forma de crearlos? por lo general los creo todos client side, con sus dx

  11. Hello, I want to know how can I put on the same bar normal health and extra health, normal health is 100 but extra health increase constantly by levels, how can i adapt a bar for both health? that looks full and adapts to the extra health

  12. Hello, how can I create a PED that when players killed It reappears the next day or at 12 hrs? That it does not appear when you reconnect on the server, only the next day or at specific time.

  13. Hello, I want to know how can I detect when a bot dies? But, not when someone kills it, only when it dies, for example when it jumped off a cliff, or another bot killed it, i mean,  only detect when it dies in a general way and give a reward by dropping  a pickup.

  14. Hola, estoy creando un sistema de animales usando el slothbot de la comunidad, pero quisiera saber como puedo hacer para detectar cuando el bot muere (se que se puede usar onBotWasted) pero quiero que detecte cuando muera, de forma general, no necesariamente que un jugador lo mate, sino que simplemente por ejemplo haya una explosión y se queme y muera y de la recompensa, sin necesidad de detectar si alguien lo mató o no.

  15. 1 hour ago, FLUSHBICEPS said:
    -- clientside
    function setSkinFromList(button, state)
        if button == "left" and state == "up" then
            local selectedRow, selectedCol = guiGridListGetSelectedItem(skins)
            if selectedRow and selectedRow ~= -1 then
                local skinID = tonumber(guiGridListGetItemText(skins, selectedRow, 2))
                if skinID then
                    triggerServerEvent("applySkin", localPlayer, skinID)
                end
            end
        end
    end
    addEventHandler("onClientGUIDoubleClick", skins, setSkinFromList, false)
    --serverside
    function applySkinHandler(thePlayer, skinID)
        if thePlayer and skinID then
            setElementModel(thePlayer, skinID)
        end
    end
    
    addEvent("applySkin", true)
    addEventHandler("applySkin", root, applySkinHandler)

     

    thanks, but its not working with that :(

    • Like 1
  16. On 27/02/2023 at 16:46, FlorinSzasz said:

    So here is the code

    Server Side

    local connection = dbConnect("sqlite","skins.db")  -- we create the db our is called skins.db u can call it any way u want
    
    if connection then -- check for connection
        outputDebugString("Connection with SKIN database was established")
    else 
        outputDebugString("Connection with SKIN database was not established somehting went wrong")
    end 
    
    
    function db_table() -- create the table in db
        dbExec(connection,"CREATE TABLE IF NOT EXISTS skins (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,username TEXT,skin INTEGER)")
    end
    
    addEventHandler("onResourceStart",getResourceRootElement(),db_table)
    -- skin cost -- 
    local cost = 1000
    ----         -----
    
    addCommandHandler("buyskin",function(thePlayer,commandName,model)
        if thePlayer then  -- check for player
            local acc = getPlayerAccount( thePlayer ) -- get his account name
            local acc_name = getAccountName( acc ) -- get his account name 
        if model and tonumber(model) >= 0 and tonumber(model) <= 84 then     
            -- i choose to allow to buy the skins from model 0 to 84 u can change it the way u want also if u dont provide a model u get an message
            local q = dbQuery(connection,"SELECT username,skin FROM skins WHERE username=? AND skin=? LIMIT 1",tostring(acc_name),tonumber(model))
            -- we select the data from to see if we have this skin already
            local rezult = dbPoll(q,-1)
            if #rezult > 0 then --- if we have rezult then  we loop throgh rezult and check 
    
            for key,value in ipairs(rezult) do -- loop 
                    if tonumber(value.skin) == tonumber(model) then -- check if we have this skin
                        outputChatBox("[SKIN_SYSTEM] You have this skin already",thePlayer)
                    end 
                end
            else 
                if getPlayerMoney(thePlayer) >= cost then  
                    dbExec(connection,"INSERT INTO skins (username,skin) VALUES (?,?)",tostring(acc_name),tonumber(model))
                -- if player has more money or enough then we buy the skin and insert the data in db  and take his money
                        takePlayerMoney(thePlayer,cost)
                            outputChatBox("[SKIN SYSTEM] You bought a new skin!",thePlayer,104,255,104)
                    elseif getPlayerMoney(thePlayer) < cost then 
                        outputChatBox("[SKIN SYSTEM] You don have enough money to buy the skin",thePlayer)
                    end
            end
        else 
            outputChatBox("[SKIN_SYSTEM] Please provide the model u want to buy!",thePlayer) -- provide model message
            end
        end
    end)
    
    
    function myskins(thePlayer,commandName)
        if thePlayer then  --- again check for player
            local acc = getPlayerAccount( thePlayer )
            local acc_name = getAccountName( acc )
        local q = dbQuery(connection,"SELECT username,skin FROM skins WHERE username=?",tostring(acc_name))
        -- we select the data from db, by data i mean his skins and then send the table on client
        local rezult = dbPoll(q,-1)
        if #rezult > 0 then 
            for key,value in ipairs(rezult) do 
            triggerClientEvent(thePlayer,"skin_inventory",thePlayer,rezult) -- if we have rezult then we call client event skin_inventory!!
                end
            end 
        end
    end
    
    addCommandHandler("myskins",myskins,false,false)

    Client Side

     

    function centerWindow (center_window) --- a function to put the window in the center of the screen
        local screenW, screenH = guiGetScreenSize()
        local windowW, windowH = guiGetSize(center_window, false)
        local x, y = (screenW - windowW) /2,(screenH - windowH) /2
        return guiSetPosition(center_window, x, y, false)
    end
    
    addEvent("skin_inventory",true) -- we add the skin_inventory event client side so we can call it from server side
    
    function skin_inventory_gui(rezult) -- here we have our table sent from server to client 
        
        skin_list = guiCreateWindow(329, 246, 465, 381, "MY SKINS", false)
        centerWindow(skin_list)
        guiWindowSetMovable(skin_list, false)
        guiWindowSetSizable(skin_list, false)
    
        skins = guiCreateGridList(9, 20, 376, 351, false, skin_list)
        guiGridListAddColumn(skins, "Description", 0.5)
        guiGridListAddColumn(skins, "Model/Skin Owned", 0.5)
        close = guiCreateButton(389, 20, 66, 21, "X", false, skin_list)
        guiSetProperty(close, "NormalTextColour", "FFAAAAAA")
        showCursor(true)   
        for key, value in ipairs(rezult) do  -- we loop through table
        local row = guiGridListAddRow(skins) -- so for each result we get we insert a row with
        guiGridListSetItemText (skins, row, 1, "Skin Model ->", false, true)   -- this value 
        guiGridListSetItemText (skins, row, 2, value.skin, false, true) --- and skin model / id
        end 
        addEventHandler ( "onClientGUIClick", close, closeinventory,false) -- event for close function and button!!!
    end
    
    addEventHandler("skin_inventory",root,skin_inventory_gui)
    
    closeinventory = function(button,state) --- function to close the gui window
    if (button == "left") and (state == "up") then 
        showCursor (false)
        guiSetVisible(skin_list,false)
        end
    end

    So this is enough to get you started!

    Thank you @FlorinSzasz It works! by the way, how can I change or set my skin by clicking on item from the list?

  17. Hola, hago el post para preguntar si hay alguna forma de detectar cuando el jugador está mirando al SOL. Mi idea es crear un lensflare o reflejo cuando el jugador mira al sol, pero con una imagen para que no se me haga tan complicado, pero quisiera saber como detecto cuando la cámara mire al sol...  por favor.

  18. Hola que tal, estoy teniendo problemas con algo y vengo a solicitar de su ayuda o consejo. Estoy creando ciertos peds que deberían tener imágenes en su cabeza como indicadores, el problema es que los estoy creando en una tabla ya que son varios, mi situación es la siguiente: ¿Como puedo crearle la imagen a todos los peds con un solo render? Sin necesidad de crear cada ped por separado y añadirles un render individual a cada uno...  o sea un solo render para todos los peds de la tabla.

    Inserto la tabla de ejemplo con la cual creo los peds:

     

     

    local Pos_Seta = {
      {323.9013671875, 2490.8134765625, 15.484375},
      {335.341796875, 2486.669921875, 15.484375},
      {330.0751953125, 2496.310546875, 15.484375},
      {325, 2480.7265625, 15.484375}
    }
    
    for i,v in ipairs (Pos_Seta) do
      Ped_Seta = createPed(20, v[1],v[2],v[3])

     

  19. Hola a todos, una pregunta. Estoy creando una tienda y sus items se guardarán en una gridList el motivo de mi post es el siguiente... supongamos están a la venta 5 items:

    • Arma 1   • Arma 2   • Arma 3 

     • Arma 4   • Arma 5

    Como hago para que por ejemplo si compro el Arma 1 salga en la lista, y si compro el Arma 5 despues salga debajo del item anterior y así. No quiero asignarles un slot de la lista especifico sino que se vaya anexando uno debajo del otro y así sucesivamente.

  20. Hello everyone. I am creating a skins store, but I would like to know how I can save each skin I buy in a list, as items since there are many skins. Is there a way to create a save system for each skin? saving it by id?  I don't know if I explain myself well.

  21. Hola que tal, necesito de vuestra ayuda para saber si es posible lo siguiente: 

    Como hago para aplicar un shader donde todos los objetos del mapa e incluso los objetos custom se vean negros totalmente de forma localplayer que solo lo vea el jugador que lo active y luego desactive si quiere, sin que este shader afecte al jugador o sea que el ped siga viéndose normal. Tengo problemas solo con la creación del shader, alguien podría ayudarme o explicarme?

  22. Hello everyone,  I need your help with something please. I'm trying to create something like pick items and stuff like that, plants, mushrooms, etc etc.

    This creates a table with Objects and Collisions. I want to know how can I delete just the collision that I hit and the object in that position as well, not the other elements in the table just the elements that I hit.

    local sx,sy = guiGetScreenSize()
    local px,py = 1280,720
    local x,y = (sx/px), (sy/py)
    
    playerSeta = getLocalPlayer()
    
    local Pos_Seta = {
      {323.9013671875, 2490.8134765625, 15.484375},
      {335.341796875, 2486.669921875, 15.484375},
      {330.0751953125, 2496.310546875, 15.484375},
      {325, 2480.7265625, 15.484375}
    }
    
    for i,v in ipairs (Pos_Seta) do
      Obj_Seta = createObject(2427, v[1],v[2],v[3]) setObjectScale(Obj_Seta, 1.5)
      Col_Seta = createColSphere (v[1],v[2],v[3], 1.5)
      Blip_Seta = createBlip(v[1],v[2],v[3], 33, 2.5, 255, 0, 0, 255, 0, 100)	
    
    addEventHandler( "onClientColShapeHit", Col_Seta,
        function(pSeta)
          if pSeta == playerSeta then
            addEventHandler('onClientRender', getRootElement(), Text_Seta)
            bindKey('F','down',StartSeta, playerSeta)
          end 
        end)
    
    addEventHandler( "onClientColShapeLeave", Col_Seta, 
        function(pSeta) 
          if pSeta == playerSeta then
            removeEventHandler('onClientRender', getRootElement(), Text_Seta)
            unbindKey('F','down',StartSeta, playerSeta)
          end
        end)
      end
    
    function StartSeta ()	
      triggerServerEvent ( "StartSeta", localPlayer)
      unbindKey('F','down',StartSeta, playerSeta)
    end		
    
    function Text_Seta ()
      dxDrawText("Use (F) to pick this item", x*481, y*483, x*800, y*501, tocolor(255, 255, 255, 255), 1.35, "default-bold", "center", "top", false, false, false, false, false)
    end

     

  23. Hello everyone, i need help with something...

     

    I have a tsunami script loaded on my server, but a few zones have holes and the tsunami doesnt include the water outside the limit of the map. I see that theres a new function to include the water outside the world map, how can I use this?

     includeOutsideWorldSea

  24. Hola, estoy teniendo problemas con algo. Estoy creando un sistema de pesca, es más que todo client-side, al entrar a un marker te sale la UI para comenzar a pescar y te crea la Caña de Pescar etc etc, para la creación de la caña estoy usando un trigger desde el client al server-side, igual para su eliminación, por ejemplo:

    ---- Client Side:
    triggerServerEvent("crear.cana", localPlayer) --- Para llamar al server y crear la caña
    
    triggerServerEvent("borrar.cana", localPlayer) --- Al momento de borrarla
    
    
    ----- Server side:
    function Crear_Cana() ---- Aquí se crea la caña de pescar
    CanaObj = createObject(1851,x,y,z,0,0,0)
    exports.pAttach:attach(CanaObj, source, 25, -0.1,-0.19,0.1,21.6,136.8,-46.8)
    end
    addEvent("crear.cana", true)
    addEventHandler("crear.cana", root, Crear_Cana)
    
    function Borrar_Cana() --- Aquí se elimina la caña de pescar
    if isElement (CanaObj) then
    destroyElement(CanaObj) 
    end
    end
    addEvent("borrar.cana", true)
    addEventHandler("borrar.cana", root, Borrar_Cana)

    Mi problema es el siguiente, supongamos que 2 jugadores entran al marker al mismo tiempo, o simplemente entran ambos para comenzar a pescar, al momento de crear o eliminar la caña se mezcla entre ambos jugadores, es decir, si un jugador termina de pescar la caña le será borrada al otro, o si el otro comienza a pescar la caña se le crea al otro jugador como si todo se conectara o mezclara con el otro jugador... agradecería si pudieran ayudarme al respecto. La creación del marker y todo decidí hacerlo client-side, usé los triggers solo para las cosas que quiero que los demás jugadores vean en el servidor, por ejemplo cuando tenga una caña o capture un pez pero sucede lo que ya mencioné anteriormente, que se mezcla la función con otros jugadores que pesquen al mismo tiempo.

×
×
  • Create New...