Jump to content

Duda con Useful Function


Alexs

Recommended Posts

Posted

Hola a Todos, quería saber si alguien sabe sobre la Useful Function

isElementInPhotograph 

Se supone revisa si un elemento esta en una fotografía, pero no se el Source Code o los argumentos. Alguien lo conoce?

Posted

En la pagina dice:

Someone please write isElementInPhotograph, it will be used instead of making a hard-coded function

Nadie la hizo aun.

Posted
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?

Posted
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?

Posted
No se necesitan ;).

He malgastado mi vida escribiendolos :'( Ok, intentare eso del onClientWeaponFire y aviso si resulto o si envio algun error.

Posted
Yo uso los parentesis porque me parece que queda mejor.

Yo los use por que tu los usabas, de todas formas si no afectan, los seguiré usando, se ve mas ordenado. Gracias :D

  • Recently Browsing   0 members

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