Jump to content

[REL] Detective vision


Dre-+-

Recommended Posts

Posted (edited)

This resource add detective vision in MTA(like Batman Arkham Asilum game)

For use this resource just use night vision or infrared goggles.

I hope you like it)

Screenshots:

4017.png

4018.png

4019.png

4020.png

https://wiki.multitheftauto.com/images/4/46/Dvision.png

For see exports go to:

Mta wiki page

Link: https://community.multitheftauto.com/index.php?p=resources&s=details&id=2074

BTW: all suggestions or bugs post in commentaries.

Edited by Guest
  • 2 weeks later...
Posted

For me, I think karlis meant:

When detective vision is active, will the GTA HUD still be visible?

But yours also make sense. He may be asking for that HUD resource that was on the bottom right. :P

P.S: Glad to see you back karlis

  • 3 weeks later...
Posted

  
aBoneList = {} 
--right leg 
aBoneList[54] = 53; 
aBoneList[53] = 52; 
aBoneList[52] = 51; 
aBoneList[51] = 1; 
--left leg 
aBoneList[44] = 43; 
aBoneList[43] = 42; 
aBoneList[42] = 41; 
aBoneList[41] = 1; 
--spine 
aBoneList[1] = 2; 
aBoneList[2] = 3; 
aBoneList[3] = 4; 
--right arm 
aBoneList[26] = 25; 
aBoneList[25] = 24; 
aBoneList[24] = 23; 
aBoneList[23] = 22; 
aBoneList[21] = 22; 
--right arm 
aBoneList[36] = 35; 
aBoneList[35] = 34; 
aBoneList[34] = 33; 
aBoneList[33] = 32; 
aBoneList[31] = 32; 
--head 
aBoneList[4] = 6; 
aBoneList[6] = 7; 
aBoneList[7] = 4; 
--torso 
aBoneList[32] = 41; 
aBoneList[22] = 51; 
-- 
  
function drawPedBones (ped) 
    if isElement(ped) then 
        for iFrom,iTo in pairs(aBoneList) do 
            local x1,y1,z1 = getPedBonePosition(ped,iFrom); 
            local x2,y2,z2 = getPedBonePosition(ped,iTo); 
            if not (x1 or x2) then 
                return; 
            end 
            local screenX1, screenY1 = getScreenFromWorldPosition ( x1,y1,z1 ); 
            local screenX2, screenY2 = getScreenFromWorldPosition ( x2,y2,z2 ); 
            local playerTeam = getPlayerTeam( ped ); 
            local red,green,blue = 0,0,0; 
            if playerTeam then 
                red,green,blue = getTeamColor ( playerTeam ) 
            end 
            if screenX1 and screenX2 then 
                dxDrawLine ( screenX1, screenY1, screenX2, screenY2, tocolor(red,green,blue,255) ); 
            end 
        end 
    end 
end 

The thing is, code is generated by humans, not by machines.

So keeping it readable is always a good idea.

Posted
  
aBoneList = {} 
--right leg 
aBoneList[54] = 53; 
aBoneList[53] = 52; 
aBoneList[52] = 51; 
aBoneList[51] = 1; 
--left leg 
aBoneList[44] = 43; 
aBoneList[43] = 42; 
aBoneList[42] = 41; 
aBoneList[41] = 1; 
--spine 
aBoneList[1] = 2; 
aBoneList[2] = 3; 
aBoneList[3] = 4; 
--right arm 
aBoneList[26] = 25; 
aBoneList[25] = 24; 
aBoneList[24] = 23; 
aBoneList[23] = 22; 
aBoneList[21] = 22; 
--right arm 
aBoneList[36] = 35; 
aBoneList[35] = 34; 
aBoneList[34] = 33; 
aBoneList[33] = 32; 
aBoneList[31] = 32; 
--head 
aBoneList[4] = 6; 
aBoneList[6] = 7; 
aBoneList[7] = 4; 
--torso 
aBoneList[32] = 41; 
aBoneList[22] = 51; 
-- 
  
function drawPedBones (ped) 
    if isElement(ped) then 
        for iFrom,iTo in pairs(aBoneList) do 
            local x1,y1,z1 = getPedBonePosition(ped,iFrom); 
            local x2,y2,z2 = getPedBonePosition(ped,iTo); 
            if not (x1 or x2) then 
                return; 
            end 
            local screenX1, screenY1 = getScreenFromWorldPosition ( x1,y1,z1 ); 
            local screenX2, screenY2 = getScreenFromWorldPosition ( x2,y2,z2 ); 
            local playerTeam = getPlayerTeam( ped ); 
            local red,green,blue = 0,0,0; 
            if playerTeam then 
                red,green,blue = getTeamColor ( playerTeam ) 
            end 
            if screenX1 and screenX2 then 
                dxDrawLine ( screenX1, screenY1, screenX2, screenY2, tocolor(red,green,blue,255) ); 
            end 
        end 
    end 
end 

The thing is, code is generated by humans, not by machines.

So keeping it readable is always a good idea.

Thanks, mate, now its really looks more better)

BTW: Do you have MTA Community profile, for i add you in creators?

Posted
  
aBoneList = {} 
--right leg 
aBoneList[54] = 53; 
aBoneList[53] = 52; 
aBoneList[52] = 51; 
aBoneList[51] = 1; 
--left leg 
aBoneList[44] = 43; 
aBoneList[43] = 42; 
aBoneList[42] = 41; 
aBoneList[41] = 1; 
--spine 
aBoneList[1] = 2; 
aBoneList[2] = 3; 
aBoneList[3] = 4; 
--right arm 
aBoneList[26] = 25; 
aBoneList[25] = 24; 
aBoneList[24] = 23; 
aBoneList[23] = 22; 
aBoneList[21] = 22; 
--right arm 
aBoneList[36] = 35; 
aBoneList[35] = 34; 
aBoneList[34] = 33; 
aBoneList[33] = 32; 
aBoneList[31] = 32; 
--head 
aBoneList[4] = 6; 
aBoneList[6] = 7; 
aBoneList[7] = 4; 
--torso 
aBoneList[32] = 41; 
aBoneList[22] = 51; 
-- 
  
function drawPedBones (ped) 
    if isElement(ped) then 
        for iFrom,iTo in pairs(aBoneList) do 
            local x1,y1,z1 = getPedBonePosition(ped,iFrom); 
            local x2,y2,z2 = getPedBonePosition(ped,iTo); 
            if not (x1 or x2) then 
                return; 
            end 
            local screenX1, screenY1 = getScreenFromWorldPosition ( x1,y1,z1 ); 
            local screenX2, screenY2 = getScreenFromWorldPosition ( x2,y2,z2 ); 
            local playerTeam = getPlayerTeam( ped ); 
            local red,green,blue = 0,0,0; 
            if playerTeam then 
                red,green,blue = getTeamColor ( playerTeam ) 
            end 
            if screenX1 and screenX2 then 
                dxDrawLine ( screenX1, screenY1, screenX2, screenY2, tocolor(red,green,blue,255) ); 
            end 
        end 
    end 
end 

The thing is, code is generated by humans, not by machines.

So keeping it readable is always a good idea.

Thanks, mate, now its really looks more better)

BTW: Do you have MTA Community profile, for i add you in creators?

Yes, like Solid said.

But I suffer from the "lonewolf" disease(just like any other scripter) which makes you stop working together with other people before you even started talking to them :)

Also, did your script detect that bones were outside the screen?

Always check those nil values.

Posted
  
aBoneList = {} 
--right leg 
aBoneList[54] = 53; 
aBoneList[53] = 52; 
aBoneList[52] = 51; 
aBoneList[51] = 1; 
--left leg 
aBoneList[44] = 43; 
aBoneList[43] = 42; 
aBoneList[42] = 41; 
aBoneList[41] = 1; 
--spine 
aBoneList[1] = 2; 
aBoneList[2] = 3; 
aBoneList[3] = 4; 
--right arm 
aBoneList[26] = 25; 
aBoneList[25] = 24; 
aBoneList[24] = 23; 
aBoneList[23] = 22; 
aBoneList[21] = 22; 
--right arm 
aBoneList[36] = 35; 
aBoneList[35] = 34; 
aBoneList[34] = 33; 
aBoneList[33] = 32; 
aBoneList[31] = 32; 
--head 
aBoneList[4] = 6; 
aBoneList[6] = 7; 
aBoneList[7] = 4; 
--torso 
aBoneList[32] = 41; 
aBoneList[22] = 51; 
-- 
  
function drawPedBones (ped) 
    if isElement(ped) then 
        for iFrom,iTo in pairs(aBoneList) do 
            local x1,y1,z1 = getPedBonePosition(ped,iFrom); 
            local x2,y2,z2 = getPedBonePosition(ped,iTo); 
            if not (x1 or x2) then 
                return; 
            end 
            local screenX1, screenY1 = getScreenFromWorldPosition ( x1,y1,z1 ); 
            local screenX2, screenY2 = getScreenFromWorldPosition ( x2,y2,z2 ); 
            local playerTeam = getPlayerTeam( ped ); 
            local red,green,blue = 0,0,0; 
            if playerTeam then 
                red,green,blue = getTeamColor ( playerTeam ) 
            end 
            if screenX1 and screenX2 then 
                dxDrawLine ( screenX1, screenY1, screenX2, screenY2, tocolor(red,green,blue,255) ); 
            end 
        end 
    end 
end 

The thing is, code is generated by humans, not by machines.

So keeping it readable is always a good idea.

Thanks, mate, now its really looks more better)

BTW: Do you have MTA Community profile, for i add you in creators?

Yes, like Solid said.

But I suffer from the "lonewolf" disease(just like any other scripter) which makes you stop working together with other people before you even started talking to them :)

Also, did your script detect that bones were outside the screen?

Always check those nil values.

Ok, added in special thanks)

Posted

  
aBoneList = {} 
--right leg 
aBoneList[54] = 53; 
aBoneList[53] = 52; 
aBoneList[52] = 51; 
aBoneList[51] = 1; 
--left leg 
aBoneList[44] = 43; 
aBoneList[43] = 42; 
aBoneList[42] = 41; 
aBoneList[41] = 1; 
--spine 
aBoneList[1] = 2; 
aBoneList[2] = 3; 
aBoneList[3] = 4; 
--right arm 
aBoneList[26] = 25; 
aBoneList[25] = 24; 
aBoneList[24] = 23; 
aBoneList[23] = 22; 
aBoneList[21] = 22; 
--right arm 
aBoneList[36] = 35; 
aBoneList[35] = 34; 
aBoneList[34] = 33; 
aBoneList[33] = 32; 
aBoneList[31] = 32; 
--head 
aBoneList[4] = 6; 
aBoneList[6] = 7; 
aBoneList[7] = 4; 
--torso 
aBoneList[32] = 41; 
aBoneList[22] = 51; 
-- 
  
  
aBoneFarList = {} 
--right leg 
aBoneFarList [54] = 51; 
--left leg 
aBoneFarList [44] = 41; 
--spine 
aBoneFarList [1] = 4; 
--right arm 
aBoneFarList [26] = 22; 
--right arm 
aBoneFarList [36] = 32; 
--head 
aBoneFarList [6] = 7; 
--torso 
aBoneFarList [32] = 41; 
aBoneFarList [22] = 51; 
-- 
function drawPedBones (ped) 
    local aList = {}; 
    if isElement(ped) then 
        local x,y,z = getCameraMatrix(); 
        local px,py,pz = getElementPosition(ped); 
        local fDistance = getDistanceBetweenPoints3D(x,y,z,px,py,pz); 
        if fDistance < 50 then 
            aList = aBoneList; 
        elseif fDistance < 300 then 
            aList = aBoneFarList; 
        end 
        for iFrom,iTo in pairs(aList) do 
            local x1,y1,z1 = getPedBonePosition(ped,iFrom); 
            local x2,y2,z2 = getPedBonePosition(ped,iTo); 
            if not (x1 or x2) then 
                return; 
            end 
            local screenX1, screenY1 = getScreenFromWorldPosition ( x1,y1,z1 ); 
            local screenX2, screenY2 = getScreenFromWorldPosition ( x2,y2,z2 ); 
            local playerTeam = getPlayerTeam( ped ); 
            local red,green,blue = 0,0,0; 
            if playerTeam then 
                red,green,blue = getTeamColor ( playerTeam ) 
            end 
            if screenX1 and screenX2 then 
                dxDrawLine ( screenX1, screenY1, screenX2, screenY2, tocolor(red,green,blue,255) ); 
            end 
        end 
    end 
end 

Uses less GFX speed - all DX funktions have the drawback that they are pushed through the pipe, which is the bottleneck of a GFX card.

Posted
  
aBoneList = {} 
--right leg 
aBoneList[54] = 53; 
aBoneList[53] = 52; 
aBoneList[52] = 51; 
aBoneList[51] = 1; 
--left leg 
aBoneList[44] = 43; 
aBoneList[43] = 42; 
aBoneList[42] = 41; 
aBoneList[41] = 1; 
--spine 
aBoneList[1] = 2; 
aBoneList[2] = 3; 
aBoneList[3] = 4; 
--right arm 
aBoneList[26] = 25; 
aBoneList[25] = 24; 
aBoneList[24] = 23; 
aBoneList[23] = 22; 
aBoneList[21] = 22; 
--right arm 
aBoneList[36] = 35; 
aBoneList[35] = 34; 
aBoneList[34] = 33; 
aBoneList[33] = 32; 
aBoneList[31] = 32; 
--head 
aBoneList[4] = 6; 
aBoneList[6] = 7; 
aBoneList[7] = 4; 
--torso 
aBoneList[32] = 41; 
aBoneList[22] = 51; 
-- 
  
  
aBoneFarList = {} 
--right leg 
aBoneFarList [54] = 51; 
--left leg 
aBoneFarList [44] = 41; 
--spine 
aBoneFarList [1] = 4; 
--right arm 
aBoneFarList [26] = 22; 
--right arm 
aBoneFarList [36] = 32; 
--head 
aBoneFarList [6] = 7; 
--torso 
aBoneFarList [32] = 41; 
aBoneFarList [22] = 51; 
-- 
function drawPedBones (ped) 
    local aList = {}; 
    if isElement(ped) then 
        local x,y,z = getCameraMatrix(); 
        local px,py,pz = getElementPosition(ped); 
        local fDistance = getDistanceBetweenPoints3D(x,y,z,px,py,pz); 
        if fDistance < 50 then 
            aList = aBoneList; 
        elseif fDistance < 300 then 
            aList = aBoneFarList; 
        end 
        for iFrom,iTo in pairs(aList) do 
            local x1,y1,z1 = getPedBonePosition(ped,iFrom); 
            local x2,y2,z2 = getPedBonePosition(ped,iTo); 
            if not (x1 or x2) then 
                return; 
            end 
            local screenX1, screenY1 = getScreenFromWorldPosition ( x1,y1,z1 ); 
            local screenX2, screenY2 = getScreenFromWorldPosition ( x2,y2,z2 ); 
            local playerTeam = getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam( ped ); 
            local red,green,blue = 0,0,0; 
            if playerTeam then 
                red,green,blue = getTeamColor ( playerTeam ) 
            end 
            if screenX1 and screenX2 then 
                dxDrawLine ( screenX1, screenY1, screenX2, screenY2, tocolor(red,green,blue,255) ); 
            end 
        end 
    end 
end 
 

Uses less GFX speed - all DX funktions have the drawback that they are pushed through the pipe, which is the bottleneck of a GFX card.

I dont really understand how, but your code add more 4~6 fps, thanx)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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