Jump to content

Duda con Useful Function


Alexs

Recommended Posts

En la pagina dice:
Someone please write isElementInPhotograph, it will be used instead of making a hard-coded function

Nadie la hizo aun.

ahh Ok, y como se utiliza "getPlayersInPhotograph" Como por ejemplo, para matar a los jugadores en la foto?

Link to comment
Yo diria que hay que ejecutarla con el evento: onClientPlayerWeaponFire.

No estoy seguro si la camara ejecuta ese evento igual.

Ok, y otra cosa, creo que el Source Code esta mal escrito:

function getPlayersInPhotograph() 
    local players = {} 
    local nx, ny, nz = getPedWeaponMuzzlePosition(localPlayer) 
  
    for _, v in ipairs(getElementsByType"player") do 
  
                -- Determine whether the player is even on the screen, or the client is the player. 
        if (v ~= localPlayer) and (isElementOnScreen(v)) then 
            local veh = getPedOccupiedVehicle(v) 
            local px, py, pz = getElementPosition(v) 
            local _, _, _, _, hit = processLineOfSight(nx, ny, nz, px, py, pz) -- Check if there is a collision between the "camera viewpoint" and the player 
            local continue = false 
  
            if (hit == v) or (hit == veh) or (not veh) then -- If it collides with the player itself, the client or the players vehicle, continue to add player to the list. 
                continue = true 
            else -- This checks if the player's head is visible, but not the entire body 
                local bx, by, bz = getPedBonePosition(v, -- s8) --> -- Get the head position of the player 
                local _, _, _, _, hit = processLineOfSight(nx, ny, nz, px, py, pz) -- Check if there is a collision between the "camera viewpoint" and player head. 
  
                if hit == v then 
                    continue = true 
                end 
            end 
  
            if continue then 
                table.insert(players, v) 
            end 
        end 
    end 
  
    return players 
end 

Le faltan los () a getElementsByType o no son necesarios?

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...