Wysłany: 2015-02-24, 16:50
THEGizmo
Modeler/Uczeń Lua
Wiek: 27 Na forum: 4141 dni Posty: 255
Nick w MP: THEGizmo
Piwa : 3072
Witam mam o to taki problem bo zrobi?em nowa walut? lecz jak w??cza zas?b nie wida? tej waluty o to kod nie wiem co mam zle za pomoc
-- funkcje
local enableBlips = true
local renderNorthBlip = true
local alwaysRenderMap = false -- true = always render map , false = only render when in interior world 0 ( radar will stay , only the map will stop rendering )
-- Wymiary i rozmiary mapy blipu --
local worldW , worldH = 3072 , 3072 -- map image dimensions - if map image changed , please edit appropriately
local blip = 15 -- Blip size , pixels relative to 1366x768 resolution
------------------------------------------------------------------------------------
-- rozmiar tla mapy --
local sx , sy = guiGetScreenSize ()
local rt = dxCreateRenderTarget ( 290 , 175 )
local xFactor , yFactor = sx / 1850 , sy / 1350
local yFactor = xFactor -- rozmiar tla x , y --
-- Przydatne funkcje --
function findRotation ( x1 , y1 , x2 , y2 )
local t = - math . deg ( math . atan2 ( x2 - x1 , y2 - y1 ))
if t < 0 then t = t + 360 end ;
return t ;
end
function getPointFromDistanceRotation ( x , y , dist , angle )
local a = math . rad ( 90 - angle );
local dx = math . cos ( a ) * dist ;
local dy = math . sin ( a ) * dist ;
return x + dx , y + dy ;
end
function drawRadar ()
showPlayerHudComponent ( "radar" , false )
showPlayerHudComponent ( "area_name" , false ) --- Nazwa ulicy --
showPlayerHudComponent ( "money" , false ) -- kasa --
showPlayerHudComponent ( "vehicle_name" , false ) -- nazwa pojazdu --
if ( not isPlayerMapVisible ()) then
local mW , mH = dxGetMaterialSize ( rt )
local x , y = getElementPosition ( localPlayer )
local X , Y = mW / 2 -( x /( 6000 / worldW )), mH / 2 +( y /( 6000 / worldH ))
local camX , camY , camZ = getElementRotation ( getCamera ())
dxSetRenderTarget ( rt , true )
if alwaysRenderMap or getElementInterior ( localPlayer ) == 0 then
dxDrawRectangle ( 0 , 0 , mW , mH , 0xFF7CA7D1 ) -- render background
dxDrawImage ( X - worldW / 2 , mH / 5 + ( Y - worldH / 2 ), worldW , worldH , "image/world.jpg" , camZ , ( x /( 6000 / worldW )), -( y /( 6000 / worldH )), tocolor ( 255 , 255 , 255 , 255 ))
end
dxSetRenderTarget ()
dxDrawRectangle (( 10 )* xFactor , sy -(( 200 + 10 ))* yFactor , ( 300 )* xFactor , ( 184 )* yFactor , tocolor ( 0 , 0 , 0 , 175 ))
dxDrawImage (( 10 + 5 )* xFactor , sy -(( 200 + 5 ))* yFactor , ( 300 - 10 )* xFactor , ( 175 )* yFactor , rt , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 150 ))
local rx , ry , rz = getElementRotation ( localPlayer )
local lB = ( 15 )* xFactor
local rB = ( 15 + 290 )* xFactor
local tB = sy -( 205 )* yFactor
local bB = tB + ( 175 )* yFactor
local cX , cY = ( rB + lB )/ 2 , ( tB + bB )/ 2 +( 35 )* yFactor
local toLeft , toTop , toRight , toBottom = cX - lB , cY - tB , rB - cX , bB - cY
for k , v in ipairs ( getElementsByType ( "blip" )) do
local bx , by = getElementPosition ( v )
local actualDist = getDistanceBetweenPoints2D ( x , y , bx , by )
local maxDist = getBlipVisibleDistance ( v )
if actualDist <= maxDist and getElementDimension ( v )== getElementDimension ( localPlayer ) and getElementInterior ( v )== getElementInterior ( localPlayer ) then
local dist = actualDist /( 6000 /(( worldW + worldH )/ 2 ))
local rot = findRotation ( bx , by , x , y )- camZ
local bpx , bpy = getPointFromDistanceRotation ( cX , cY , math . min ( dist , math . sqrt ( toTop ^ 2 + toRight ^ 2 )), rot )
local bpx = math . max ( lB , math . min ( rB , bpx ))
local bpy = math . max ( tB , math . min ( bB , bpy ))
local bid = getElementData ( v , "customIcon" ) or getBlipIcon ( v )
local _ , _ , _ , bcA = getBlipColor ( v )
local bcR , bcG , bcB = 255 , 255 , 255
if getBlipIcon ( v ) == 0 then
bcR , bcG , bcB = getBlipColor ( v )
end
local bS = getBlipSize ( v )
dxDrawImage ( bpx -( blip * bS )* xFactor / 2 , bpy -( blip * bS )* yFactor / 2 , ( blip * bS )* xFactor , ( blip * bS )* yFactor , "image/blip/" .. bid .. ".png" , 0 , 0 , 0 , tocolor ( bcR , bcG , bcB , bcA ))
end
end
if renderNorthBlip then
local rot = - camZ + 180
local bpx , bpy = getPointFromDistanceRotation ( cX , cY , math . sqrt ( toTop ^ 2 + toRight ^ 2 ), rot ) -- get position
local bpx = math . max ( lB , math . min ( rB , bpx ))
local bpy = math . max ( tB , math . min ( bB , bpy )) -- cap position to screen
local dist = getDistanceBetweenPoints2D ( cX , cY , bpx , bpy ) -- get distance to the capped position
local bpx , bpy = getPointFromDistanceRotation ( cX , cY , dist , rot ) -- re - calculate position based on new distance
if bpx and bpy then --if position was obtained successfully
local bpx = math . max ( lB , math . min ( rB , bpx ))
local bpy = math . max ( tB , math . min ( bB , bpy )) -- cap position just in case
dxDrawImage ( bpx -( blip * 2 )/ 2 , bpy -( blip * 2 )/ 2 , blip * 2 , blip * 2 , "image/blip/4.png" , 0 , 0 , 0 ) -- draw north ( 4 ) blip
end
end
dxDrawImage ( cX -( blip * 2 )* xFactor / 2 , cY -( blip * 2 )* yFactor / 2 , ( blip * 2 )* xFactor , ( blip * 2 )* yFactor , "image/player.png" , camZ - rz , 0 , 0 )
end
end
addEventHandler ( "onClientRender" , root , drawRadar )
dxDrawText ( "" .. getPlayerMoney ( localPlayer ).. " Zl" , ( 1065 / w )* sx , ( 160 / h )* sy , ( 1340 / w )* sx , ( 178 / h )* sy , tocolor ( 0 , 100 , 0 , 255 ), 1.5 , "pricedown" , "left" , "top" , false , false , true , false , false )
addEventHandler ( "onClientResourceStop" , resourceRoot , function()
showPlayerHudComponent ( "radar" , true )
showPlayerHudComponent ( "area_name" , true ) --- Nazwa ulicy --
showPlayerHudComponent ( "money" , true ) -- kasa --
showPlayerHudComponent ( "vehicle_name" , true ) -- nazwa pojazdu --
end )
o to ta waluta jest ju? wklejona tabeli powy?ej
Kod: dxDrawText(""..getPlayerMoney(localPlayer).." Zl", (1065/w)*sx, (160/h)*sy, (1340/w)*sx, (178/h)*sy, tocolor(0, 100, 0, 255), 1.5, "pricedown", "left", "top", false, false, true, false, false)
Wysłany: 2015-02-24, 18:13
Novovix
xNinja powraca
Wiek: 26 Na forum: 4870 dni Posty: 240
Nick w MP: xNinja
Piwa : 452
Nie wy?wietla si? bo nie masz eventu dodanego ..
addEventHandler ( "onClientRender" ...
Wysłany: 2015-02-24, 18:24
THEGizmo
Modeler/Uczeń Lua
Wiek: 27 Na forum: 4141 dni Posty: 255
Nick w MP: THEGizmo
Piwa : 3072
A mo?esz wklei? mi to tam gdzie to ma by? bo co? jak zrobi?em i mi nie styka jako?..
Wysłany: 2015-02-24, 18:38
Novovix
xNinja powraca
Wiek: 26 Na forum: 4870 dni Posty: 240
Nick w MP: xNinja
Piwa : 452
?ap
function kasa ()
dxDrawText ( "" .. getPlayerMoney ( localPlayer ).. " Zl" , ( 1065 / w )* sx , ( 160 / h )* sy , ( 1340 / w )* sx , ( 178 / h )* sy , tocolor ( 0 , 100 , 0 , 255 ), 1.5 , "pricedown" , "left" , "top" , false , false , true , false , false )
end
addEventHandler ( "onClientRender" , root , kasa )
Wysłany: 2015-02-24, 18:43
THEGizmo
Modeler/Uczeń Lua
Wiek: 27 Na forum: 4141 dni Posty: 255
Nick w MP: THEGizmo
Piwa : 3072
Lipa nadal nie ma ...
Podpis
Modeler Corporation Sp. Z.O.O
Wysłany: 2015-02-24, 18:44
Novovix
xNinja powraca
Wiek: 26 Na forum: 4870 dni Posty: 240
Nick w MP: xNinja
Piwa : 452
B??dy w debugu?
[ Dodano : 2015-02-24, 18:49 ]
Zmie? pozycje i sprawd? bo mo?liwe, ?e za ekranem ..
Wysłany: 2015-02-24, 18:51
THEGizmo
Modeler/Uczeń Lua
Wiek: 27 Na forum: 4141 dni Posty: 255
Nick w MP: THEGizmo
Piwa : 3072
Dobra Dzia?a Zmieni?em To co M?wi?e?. Dzi?ki ?ap
Wysłany: 2015-02-25, 18:21
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4395 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Tagi: nowa :: waluta :: hud
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: