Jump to content

[HELP] Radar Blip


WASSIm.

Recommended Posts

Posted (edited)

hi guys

Download: https://community.multitheftauto.com/index.php?p= ... ls&id=3003

i have problem blip color bleu PLIS HELP

CLIENT

local mapSize=3000 --dimensions of radar map included in res, change it if you change the map 
local white2=tocolor(255,255,255,200)
local lastOffX,lastrid=0,0
local radioStartAt=0
local startsetnewr
local newWep
local moneydiff
local moneydiffchangetime=0
local moneychangestr=''
local lastmoney=0
local moneychangetime
local wslot=0
local doflash, overrideflash
local lastwanchange=getTickCount()
local lastwanlvl=0
local weapon=0
local wepswitchtime
local airmode
local roundAreas={}
local radioGoRight
local oldRadio=0
local newRadio=0
local normCol=tocolor(255,255,255,255)
local black=tocolor(0,0,0,255)
local blipTimer
local moneydiff
local areas={}
local blips
local lastcurr=0
local hp=180
local armor=0
local areaTimer
local hpTimer
local dmgTab={}
local elemData={}
local players={}
local blipimages={}
local zoomticks=getTickCount()
local raceMode
local vehicle
local parachute
local vehSwitchTime=0
local showTime=0
local fps=0
local frames,lastsec=0,0
local showTime=0
local madeByHUD={}
local markedvehicles={}
local markedpickups={}
local doFPS = true
local welcomeMsg = true
 
function onStart()
    getValues()
    roundAreas=getElementData(root,'roundareadata') or {}
    setElementData(root,'roundareadata',nil)
    wslot=getPedWeaponSlot(localP)
    weapon=getPedWeapon(localP,wslot)
    moneychangetime=getTickCount()
    wepswitchtime=getTickCount()
    blips = getElementsByType('blip')
    getBlips()
    for _,v in ipairs(blips) do
        if not elemData[v] then
            elemData[v]={}
        end
        elemData[v][1]=getElementData(v,'blipText')
        elemData[v][2]=getElementData(v,'customBlipPath')
    end
    areaTimer=setTimer(getRadarAreas,5000,0)
    hpTimer=setTimer(refreshHP,100,0)
    bindKey(toogleHUDKey,'down',toogleHUD)
    bindKey('radio_next','down',radioSwitch,true)
    bindKey('F4','down',showSettings,true)
    bindKey('radio_previous','down',radioSwitch,false)
    bindKey('fire','down',weaponFire) --melee and rpg/greande trigger
    bindKey(showAllKey,'down',showAll)
    local dxinfo=dxGetStatus()
    if dxinfo['VideoMemoryFreeForMTA']<=10 then
        outputChatBox('Sorry, your video memory is [almost] full.',false,255,0,0)
        outputChatBox('IVhud can\'t draw weapon icons and radar with no video memory aviable.',false,255,0,0)
        outputChatBox('Change your MTA settings or visit MTA forums for more help.',false,255,0,0)
        doDrawRadar,doDrawHUD=false,false
    elseif not dxinfo then
        outputChatBox( 'IVhud is not fully compatible with this MTA version.',false,255,0,0)
        outputChatBox( 'Download MTA 1.1 or higher.',false,255,0,0)
        doDrawRadar,doDrawHUD=false,false
    else
        hudrendertarg=dxCreateRenderTarget(256,300,true)
        weptarg=dxCreateRenderTarget(256,256,true)
        texture=dxCreateTexture('images/radar.jpg')
        mask=dxCreateTexture('images/mask2.png')
        shader=dxCreateShader('shader.fx')
        renderImage=dxCreateRenderTarget(size2,size2,false)
        newtarg=dxCreateRenderTarget(size*3,size*3,false)
        dxSetShaderValue(shader,'finalAlpha',finalAlpha/255)
        dxSetShaderValue(shader,'maskTex0',mask)
    end
    --posTab=generateRectanglesInRing(size,0.1*size)
    doGui()
    doDependableValReCalc()
    reDelDefaultHUD()
    addEventHandler('onClientRender',root,renderFrame)
    if welcomeMsg then
        outputChatBox('IVhud #909090 loaded! Press F4 for settings.',10,30,140,true)
    end
end
 
function onStop()
    saveSettings()
    setElementData(root,'roundareadata',roundAreas)
    for _,v in ipairs(getElementsByType("blip",resourceRoot)) do
        destroyElement(v)
    end
    killTimer(hpTimer)
    killTimer(areaTimer)
    if not raceMode then
        showPlayerHudComponent('radar',true)
        showPlayerHudComponent('radio',true)
    end
    showPlayerHudComponent('money',true)
    showPlayerHudComponent('ammo',true)
    showPlayerHudComponent('weapon',true)
    showPlayerHudComponent('clock',true)
    showPlayerHudComponent('armour',true)
    showPlayerHudComponent('health',true)
    showPlayerHudComponent('vehicle_name',true)
    showPlayerHudComponent('area_name',true)
    showPlayerHudComponent('breath',true)
end
 
function onRaceStart()
    reDelDefaultHUD()
    setTimer(reDelDefaultHUD,300,1)
    if not raceMode then
        raceMode=true
        if isTimer(hpTimer) then
            killTimer(hpTimer)
        end
    end
end
 
function onRaceStop()
    if raceMode then
        raceMode=false
        if not isTimer(hpTimer) then
            hpTimer=setTimer(refreshHP,100,0)
        end
    end
end
 
function vehEnter(veh,seat)
    entering=true
    worthDrawingRadio=true
    newRadio=getRadioChannel()
    oldRadio=newRadio
    radioSwitchTime=getTickCount()
    vehSwitchTime=getTickCount()
    setElementData(source,'vehicleSeat',seat,true)
end
 
function vehExit()
    newRadio=getRadioChannel()
    oldRadio=getRadioChannel()
    radioSwitchTime=0
    setElementData(source,'vehicleSeat',false,true)
end
 
function getRadarRadius () --function from customblips resource
    if not vehicle then
        return minDist
    else
        if getVehicleType(vehicle) == 'Plane' then
            return maxDist
        end
        local speed = ( getDistanceBetweenPoints3D(0,0,0,getElementVelocity(vehicle)) )
        if speed <= minVel then
            return minDist
        elseif speed >= maxVel then
            return maxDist
        end
        local streamDistance = speed - minVel
        streamDistance = streamDistance * ratio
        streamDistance = streamDistance + minDist
        return math.ceil(streamDistance)
    end
end
 
function getRot() --function extracted from customblips resource
    local camRot
    local cameraTarget = getCameraTarget()
    if not cameraTarget then
        local px,py,_,lx,ly = getCameraMatrix()
        camRot = getVectorRotation(px,py,lx,ly)
    else
        if vehicle then
            if getControlState'vehicle_look_behind' or ( getControlState'vehicle_look_left' and getControlState'vehicle_look_right' ) or ( getVehicleType(vehicle)~='Plane' and getVehicleType(vehicle)~='Helicopter' and ( getControlState'vehicle_look_left' or getControlState'vehicle_look_right' ) ) then
                camRot = -math.rad(getPedRotation(localP))
            else
                local px,py,_,lx,ly = getCameraMatrix()
                camRot = getVectorRotation(px,py,lx,ly)
            end
        elseif getControlState('look_behind') then
            camRot = -math.rad(getPedRotation(localP))
        else
            local px,py,_,lx,ly = getCameraMatrix()
            camRot = getVectorRotation(px,py,lx,ly)
        end
    end
    return camRot
end
 
function refreshElementData(name)
    local etype=getElementType(source)
    if etype=='blip' and elemData[source] then
        if name=='blipText' then
            elemData[source][1]=getElementData(source,name)
        elseif name=='customBlipPath' then
            elemData[source][2]=getElementData(source,name)
        end
    elseif etype=='player' and name=='vehicleSeat' then
        if not players[source] then
            players[source]=getElementData(source,name)
        end
    end
end
 
function getRadarAreas()
    areas=getElementsByType('radararea')
end
 
function ultilizeDamageScreen(attacker,weapon,_,loss)
    refreshHP()
    local type=getElementType(attacker)
    local slot=type~='vehicle' and getPedWeaponSlot(attacker) or false
    if attacker and attacker~=source and not (slot==8 or (slot==7 and weapon~=38)) then --if we can find rotation of attacker, and its not using explosive weapon
        local px1,py1=getElementPosition(source)
        local px2,py2=getElementPosition(attacker)
        dmgTab[#dmgTab+1]={getTickCount(),math.deg(getVectorRotation(px1,py1,px2,py2)),math.min(25.5*loss,255)} --1st:attack time 2nd: rotation 3rd: how opaque it should be, reaches max on 10hp hit
    else --in case its just dmg, not one with direction
        local len=#dmgTab
        for n=1,12 do
            dmgTab[len+n]={getTickCount(),30*n,math.min(25.5*loss,255)}
        end
    end
    if #dmgTab>18 then --we dont want dx overloading
        repeat
            table.remove(dmgTab,1)
        until #dmgTab<18
    end
end
 
Edited by Guest
Posted
What is the bug?

is blip color bleu

And you want it which color?

normal color

Well, the script draws blips with their color, check if your blip has blue color when created it.

how ? i dont know !

Posted

Replace this line:

dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,v[3],v[4],v[5],v[6],0,0,v[7],false) 

with:

dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,v[3],v[4],v[5],v[6],0,0,tocolor(255,255,255),false) 

Posted
Replace this line:
dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,v[3],v[4],v[5],v[6],0,0,v[7],false) 

with:

dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,v[3],v[4],v[5],v[6],0,0,tocolor(255,255,255),false) 

thx thx thx very much you are the best friend :D

and 1 problem simple is blip very small

Posted
dxDrawImage(size*SIZEHERE+v[1]-x,size*SIZEHERE+v[2]-y,v[3],v[4],v[5],v[6],0,0,tocolor(255,255,255),false) 

play with this a bit

elemData[v][1]=getElementData(v,'blipText') 
        elemData[v][2]=getElementData(v,'customBlipPath') 

Posted
dxDrawImage(size*SIZEHERE+v[1]-x,size*SIZEHERE+v[2]-y,v[3],v[4],v[5],v[6],0,0,tocolor(255,255,255),false) 

play with this a bit

elemData[v][1]=getElementData(v,'blipText') 
        elemData[v][2]=getElementData(v,'customBlipPath') 

thx for crash script xD

just i want fix size blip is very very small

Posted

I didn't try it..

dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,2,2,v[5],v[6],0,0,tocolor(255,255,255),false) 

Tell me what is the Results.

Posted
I didn't try it..
dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,2,2,v[5],v[6],0,0,tocolor(255,255,255),false) 

Tell me what is the Results.

not work

Posted

Replace this

dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,v[3],v[4],v[5],v[6],0,0,tocolor(255,255,255),false) 

With this

local sizeX = 20 
local sizeY = 20 
dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,v[3]+sizeX,v[4]+sizeY,v[5],v[6],0,0,tocolor(255,255,255),false) 

You can change the size Now : )

Posted
Replace this
dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,v[3],v[4],v[5],v[6],0,0,tocolor(255,255,255),false) 

With this

local sizeX = 20 
local sizeY = 20 
dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,v[3]+sizeX,v[4]+sizeY,v[5],v[6],0,0,tocolor(255,255,255),false) 

You can change the size Now : )

thx i replace and change this

                       local sizeX = 20 
                                   local sizeY = 20 
                                   dxDrawImage(size*1.4+v[1]-x,size*1.4+v[2]-y,v[3]+sizeX,v[4]+sizeY,v[5],v[6],0,0,tocolor(255,255,255),false) 

its work now

Posted (edited)

1- because your code is Already at ( 255, 255, 255 ) == white !!

2- You can change it -_-"

look at sizeX and sizeY then Change the Values From 20 to anything !!

Edited by Guest
Posted
1- because your code is Already at ( 255, 255, 255 ) == white !!

2- You can change it -_-"

look at sizeX and sizeY then Change the Values From 20 to anything !!

( 255, 255, 255 ) and sizeX and sizeY for other blip i downt want color blip player white and big size

Posted

Change this :

thx i replace and change this
                       local sizeX = 20 
                                   local sizeY = 20 
                                   dxDrawImage(size*1.4+v[1]-x,size*1.4+v[2]-y,v[3]+sizeX,v[4]+sizeY,v[5],v[6],0,0,tocolor(255,255,255),false) 

its work now

To this :

for _, v in ipairs ( getElementsByType ( "blip" ) ) do 
    Red, Green, Blue = getBlipColor ( v ) 
end 
local sizeX = 10 
local sizeY = 10 
dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,v[3]+sizeX,v[4]+sizeY,v[5],v[6],0,0,tocolor(Red, Green, Blue),false) 

Try it and tell me the Results .

Posted
Change this :
thx i replace and change this
                       local sizeX = 20 
                                   local sizeY = 20 
                                   dxDrawImage(size*1.4+v[1]-x,size*1.4+v[2]-y,v[3]+sizeX,v[4]+sizeY,v[5],v[6],0,0,tocolor(255,255,255),false) 

its work now

To this :

for _, v in ipairs ( getElementsByType ( "blip" ) ) do 
    Red, Green, Blue = getBlipColor ( v ) 
end 
local sizeX = 10 
local sizeY = 10 
dxDrawImage(size*1.5+v[1]-x,size*1.5+v[2]-y,v[3]+sizeX,v[4]+sizeY,v[5],v[6],0,0,tocolor(Red, Green, Blue),false) 

Try it and tell me the Results .

All Blip Red :(

Posted
iR, iB, iG = getPlayerNametagColor( localPlayer ) 
dxDrawImage( size*1.5+v[1]-x, size*1.5+v[2]-y, v[3]+sizeX, v[4]+sizeY, v[5], v[6], 0, 0, tocolor( iR, iB, iG, 255 ), false ) 

Posted

That doesn't make any sense 3ɑsн8 ɑʟsнɾq.

@wassmas: The problem is not on the HUD script, is on the creation of the blips, with the original HUD, it get's the color of the blip, which is what you put when created it.

Posted
iR, iB, iG = getPlayerNametagColor( localPlayer ) 
dxDrawImage( size*1.5+v[1]-x, size*1.5+v[2]-y, v[3]+sizeX, v[4]+sizeY, v[5], v[6], 0, 0, tocolor( iR, iB, iG, 255 ), false ) 

all blip is hide

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...