Wysłany: 2017-11-11, 21:31
Szydlo
Stance Works
Wiek: 25 Na forum: 3585 dni Posty: 343
Nick w MP: Szydlo
Piwa : 4
Witam, chcia?bym zrobi? sw?j nametag, i mam taki problem ?e jak to zrobi? wymy?li?em co? takiego: robie dxDrawa, i b?dzie on mia? x,y,z+10. No ale chyba tak nie mo?na. Oraz chcia?bym zrobi? takiego markera w 3D: https://imgur.com/6s8KMhH
Więcej szczegółów
Wystawiono 1 piw(a):nagrywki12
Wysłany: 2017-11-11, 21:41
neku^
Wiek: 24 Na forum: 3522 dni Posty: 461
Nick w MP: neku^
Piwa : 1186
Co do nametag'ow, najlepiej pobra? pozycj? szyji gracza i do tej warto?ci doda? w pozycji Z z 2 albo 3.
Co do markerow to jest to chyba
Wysłany: 2017-11-11, 21:43
Szydlo
Stance Works
Wiek: 25 Na forum: 3585 dni Posty: 343
Nick w MP: Szydlo
Piwa : 4
A nametag mog? za pomoc? dxdraw?
[ Dodano : 2017-11-11, 21:44 ]
Dobra w wiki jest przyk?ad nametagu
Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Wysłany: 2017-11-11, 21:45
neku^
Wiek: 24 Na forum: 3522 dni Posty: 461
Nick w MP: neku^
Piwa : 1186
Oczywi?cie ale jako x oraz y dajesz warto?? zwr?cona przez funkcje getPedBonePosition p??niej dajesz getScreenFromWorldPosition i zwr?cona warto?? dajesz do dxDrawText i podnosisz troch? ?eby nametag nie by? w szyji
Wysłany: 2017-11-11, 21:47
Szydlo
Stance Works
Wiek: 25 Na forum: 3585 dni Posty: 343
Nick w MP: Szydlo
Piwa : 4
Na wiki jest taki przyk?ad i to jest nametag:
addEventHandler ( "onClientRender" , root ,
function( )
local px , py , pz , tx , ty , tz , dist
px , py , pz = getCameraMatrix ( )
for _ , v in ipairs ( getElementsByType 'player' ) do
tx , ty , tz = getElementPosition ( v )
dist = math . sqrt ( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 )
if dist < 30.0 then
if isLineOfSightClear ( px , py , pz , tx , ty , tz , true , false , false , true , false , false , false , localPlayer ) then
local sx , sy , sz = getPedBonePosition ( v , 5 )
local x , y = getScreenFromWorldPosition ( sx , sy , sz + 0.3 )
if x then
dxDrawText ( getPlayerName ( v ), x , y , x , y , tocolor ( 150 , 50 , 0 ), 0.85 + ( 15 - dist ) * 0.02 , "bankgothic" )
end
end
end
end
end
)
Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Wysłany: 2017-11-11, 21:49
neku^
Wiek: 24 Na forum: 3522 dni Posty: 461
Nick w MP: neku^
Piwa : 1186
Nom, czyli to co m?wi?em getPedBonePosition getScreenFromWorldPosition
Wysłany: 2017-11-11, 21:57
Szydlo
Stance Works
Wiek: 25 Na forum: 3585 dni Posty: 343
Nick w MP: Szydlo
Piwa : 4
Dobra a jak usun?? ten nametag co daje mta?
[ Dodano : 2017-11-11, 22:01 ]
I ten chcia?bym wykry? kiedy gracz pisze (kiedy ma w??czone T).
Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Wysłany: 2017-11-11, 22:07
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Wysłany: 2017-11-11, 22:11
Szydlo
Stance Works
Wiek: 25 Na forum: 3585 dni Posty: 343
Nick w MP: Szydlo
Piwa : 4
dxDrawMaterialLine3D to chyba nie jest mi si? tak zdaje. Chyba da si? jako? podmieni? tekstur? oryginalnego markera. Co? takiego by?a na Drift Paradise bo mam gamemode.
Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Wysłany: 2017-11-11, 22:14
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Nie ma czego? takiego jak "podmiana markera", trzeba pisa? w?asny system przy pomocy tego co poda? dbn69 ,
Wysłany: 2017-11-11, 22:15
Szydlo
Stance Works
Wiek: 25 Na forum: 3585 dni Posty: 343
Nick w MP: Szydlo
Piwa : 4
Dobra i mam kolejne problemy. Mam sobie nametag, i gdy si? oddalam od osoby to wtedy nametag si? zwi?ksza, a ja nie chce ?eby si? zwi?ksza?. Kolejny problem jest taki ?e chce mie? tekst zawsze po ?rodku bo gdy mam np nick "Szydlo" to jest po?rodku ale gdy mam nick "[1]Szydlo2" to wtedy ju? nie jest.
[ Dodano : 2017-11-11, 22:16 ]
I mam tutaj taki kod na marker:
-- & #1054;трисовка маркеров
local screenSize = Vector2 ( guiGetScreenSize ())
local MARKER_ANIMATION_SPEED = 0.008
-- & #1048;конка на земле
local MARKER_ICON_SIZE = 6
local MARKER_ANIMATION_SIZE = 0.3
local MARKER_TEXT_SIZE = 5
local MARKER_TEXT_ANIMATION_SIZE = 0.1
local MARKER_TEXT_OFFSET = Vector3 ( 0 , 0 , 2 )
local markersToDraw = {}
-- & #1058;екст на экране
local screenTextFont
local screenTextBottomOffset = 60
-- & #1052;аркер, в котором сейчас находится игрок
local currentMarker
local markerKey = "g"
local markerTypes = {}
markerTypes . garage = {
color = { 212 , 0 , 40 },
icon = "assets/garage_icon.png" ,
text = "assets/garage_text.png" ,
string = "markers_garage_text"
}
markerTypes . city = {
color = { 212 , 0 , 40 },
icon = "assets/city_icon.png" ,
text = "assets/city_text.png" ,
string = "markers_city_text"
}
markerTypes . showroom = {
color = { 212 , 0 , 40 },
icon = "assets/showroom_icon.png" ,
text = "assets/showroom_text.png" ,
string = "markers_showroom_text"
}
markerTypes . house = {
color = { 212 , 0 , 40 },
icon = "assets/house_floor.png" ,
iconSize = 1 ,
text = "assets/house_icon.png" ,
string = "markers_house_enter_text"
}
markerTypes . stripclub = {
color = { 212 , 0 , 40 },
icon = "assets/house_floor.png" ,
iconSize = 1 ,
text = "assets/strip_icon.png" ,
string = "markers_strip_enter_text"
}
markerTypes . race = {
color = { 255 , 255 , 255 },
icon = "assets/race_icon.png" ,
iconSize = 12.5 ,
text = "assets/race_text.png" ,
string = "markers_race_enter_text" ,
noPaint = true
}
markerTypes . tofu = {
color = { 255 , 255 , 255 },
icon = "assets/race_icon.png" ,
iconSize = 12.5 ,
string = "markers_tofu_text" ,
noPaint = true
}
markerTypes .exit = {
color = { 212 , 0 , 40 },
text = "assets/exit_icon.png" ,
string = "markers_house_exit_text"
}
function getMarkerProperties ( type )
return markerTypes [ type ]
end
local function dxDrawShadowText ( text , x1 , y1 , x2 , y2 , color , scale , font , alignX , alignY )
dxDrawText ( text , x1 - 1 , y1 , x2 - 1 , y2 , tocolor ( 0 , 0 , 0 , 150 ), scale , font , alignX , alignY )
dxDrawText ( text , x1 + 1 , y1 , x2 + 1 , y2 , tocolor ( 0 , 0 , 0 , 150 ), scale , font , alignX , alignY )
dxDrawText ( text , x1 , y1 - 1 , x2 , y2 - 1 , tocolor ( 0 , 0 , 0 , 150 ), scale , font , alignX , alignY )
dxDrawText ( text , x1 , y1 + 1 , x2 , y2 + 1 , tocolor ( 0 , 0 , 0 , 150 ), scale , font , alignX , alignY )
dxDrawText ( text , x1 , y1 , x2 , y2 , color , scale , font , alignX , alignY )
end
local function drawScreenText ( text )
text = string . format ( exports . dpLang : getString ( text ), string . upper ( markerKey ))
local yOffset = math . sin ( getTickCount () * MARKER_ANIMATION_SPEED ) * 5
-- dxDrawText (
-- text ,
-- 10 ,
-- 10 + yOffset ,
-- screenSize . x ,
-- screenSize . y - screenTextBottomOffset + 2 + yOffset ,
-- tocolor ( 0 , 0 , 0 , 150 ),
-- 1 ,
-- screenTextFont ,
-- "center" ,
-- "bottom"
-- )
dxDrawShadowText (
text ,
0 ,
0 + yOffset ,
screenSize . x ,
screenSize . y - screenTextBottomOffset + yOffset ,
tocolor ( 255 , 255 , 255 ),
1 ,
screenTextFont ,
"center" ,
"bottom"
)
end
local function drawMarker ( marker )
local markerType = marker : getData ( "dpMarkers.type" )
local markerProperties = markerTypes [ markerType ]
if not markerProperties then
return
end
local t = getTickCount ()
local color = {
markerProperties . color [ 1 ],
markerProperties . color [ 2 ],
markerProperties . color [ 3 ],
200 + math . sin ( t * MARKER_ANIMATION_SPEED / 3 ) * 35
}
-- & #1058;екст маркера
local restrictElement = marker : getData ( "dpMarkers.restrictElement" )
local canEnter = false
if restrictElement then
if restrictElement == "vehicle" and localPlayer . vehicle then
canEnter = true
elseif restrictElement == "player" and not localPlayer . vehicle then
canEnter = true
end
else
canEnter = true
end
if ( localPlayer : isWithinMarker ( marker ) or
( localPlayer . vehicle and localPlayer . vehicle : isWithinMarker ( marker ))) and canEnter
then
if not markerProperties . noPaint then
color = {
232 + math . sin ( t * MARKER_ANIMATION_SPEED ) * 23 ,
20 + math . sin ( t * MARKER_ANIMATION_SPEED ) * 20 ,
60 + math . sin ( t * MARKER_ANIMATION_SPEED ) * 30 ,
255
}
end
local markerText = marker : getData ( "dpMarkers.text" )
if not markerText then
markerText = markerProperties . string
end
drawScreenText ( markerText )
if currentMarker ~= marker then
triggerEvent ( "dpMarkers.enter" , marker )
currentMarker = marker
end
end
local mx , my , mz = getElementPosition ( marker )
-- & #1048;конка на земле
if markerProperties . icon then
-- & #1056;азмеры иконки
local markerIconSize = MARKER_ICON_SIZE
local animationSize = MARKER_ANIMATION_SIZE
if markerProperties . iconSize then
markerIconSize = markerProperties . iconSize
animationSize = markerIconSize / MARKER_ICON_SIZE * MARKER_ANIMATION_SIZE
end
local iconSize = markerIconSize - math . sin ( t * MARKER_ANIMATION_SPEED ) * animationSize
local direction = marker : getData ( "dpMarkers.direction" )
local ox = math . cos ( direction ) * iconSize / 2
local oy = math . sin ( direction ) * iconSize / 2
dxDrawMaterialLine3D (
mx + ox ,
my + oy ,
mz ,
mx - ox ,
my - oy ,
mz ,
markerProperties . icon ,
iconSize ,
tocolor ( 255 , 255 , 255 , color [ 4 ]),
mx ,
my ,
mz + 1
)
end
if not markerProperties . text then
return
end
local textSize = MARKER_TEXT_SIZE
-- & #1042;ертикальная картинка
local textAnimationOffset = math . sin ( t * MARKER_ANIMATION_SPEED ) * MARKER_TEXT_ANIMATION_SIZE
dxDrawMaterialLine3D (
mx ,
my ,
mz + textSize / 2 + MARKER_TEXT_OFFSET . z + textAnimationOffset ,
mx ,
my ,
mz - textSize / 2 + MARKER_TEXT_OFFSET . z + textAnimationOffset ,
markerProperties . text ,
textSize ,
tocolor ( unpack ( color ))
)
end
function addMarkerToDraw ( marker )
if isElementStreamedIn ( marker ) then
markersToDraw [ marker ] = true
end
end
addEventHandler ( "onClientRender" , root , function ()
if localPlayer : getData ( "dpCore.state" ) then
return
end
for marker in pairs ( markersToDraw ) do
drawMarker ( marker )
end
end )
addEventHandler ( "onClientElementStreamIn" , root , function ()
if source : getData ( "dpMarkers.type" ) then
addMarkerToDraw ( source )
end
end )
addEventHandler ( "onClientElementStreamOut" , root , function ()
if markersToDraw [ source ] then
markersToDraw [ source ] = nil
end
end )
addEventHandler ( "onClientElementDestroy" , root , function ()
if markersToDraw [ source ] then
markersToDraw [ source ] = nil
end
end )
addEventHandler ( "onClientResourceStart" , resourceRoot , function ()
for name , markerProperties in pairs ( markerTypes ) do
if markerProperties . icon then
markerProperties . icon = dxCreateTexture ( markerProperties . icon , "dxt5" )
end
if markerProperties . text then
markerProperties . text = dxCreateTexture ( markerProperties . text , "dxt5" )
end
end
screenTextFont = exports . dpAssets : createFont ( "Roboto-Regular.ttf" , 22 )
end )
addEventHandler ( "onClientKey" , root , function ( key , state )
if key == markerKey and state then
if isMTAWindowActive () then
return false
end
if not isElement ( currentMarker ) then
return
end
if localPlayer : getData ( "dpCore.state" ) or localPlayer : getData ( "activeUI" ) then
return
end
if localPlayer : isWithinMarker ( currentMarker ) or
( localPlayer . vehicle and localPlayer . vehicle : isWithinMarker ( currentMarker ))
then
triggerEvent ( "dpMarkers.use" , currentMarker )
cancelEvent ()
end
end
end )
addEventHandler ( "onClientMarkerLeave" , resourceRoot , function ( player )
if player ~= localPlayer then
return
end
if source == currentMarker then
currentMarker = nil
end
end )
Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Wysłany: 2017-11-11, 22:16
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Co do zwi?kszania si?, to poka? kod. Je?li chodzi o d?ugo?? to i wyliczenia z tym lub mo?esz bawi? si? argumentem od dxDrawText.
Wysłany: 2017-11-11, 22:17
Szydlo
Stance Works
Wiek: 25 Na forum: 3585 dni Posty: 343
Nick w MP: Szydlo
Piwa : 4
I w tym kodzie jest
A przecie? jest to w?asny marker
[ Dodano : 2017-11-11, 22:18 ]
A je?eli chodzi o kod nametaga:
local FMain = dxCreateFont ( "files/font.ttf" , 20 )
local SMain = dxCreateFont ( "files/font.ttf" , 15 )
addEventHandler ( "onClientRender" , root ,
function( player )
local players = getElementsByType ( "player" )
for key , player in ipairs ( players ) do
setPlayerNametagShowing ( player , false )
end
local px , py , pz , tx , ty , tz , dist
px , py , pz = getCameraMatrix ( )
for _ , v in ipairs ( getElementsByType 'player' ) do
tx , ty , tz = getElementPosition ( v )
dist = math . sqrt ( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 )
if dist < 30.0 then
if isLineOfSightClear ( px , py , pz , tx , ty , tz , true , false , false , true , false , false , false , localPlayer ) then
local sx , sy , sz = getPedBonePosition ( v , 6 )
local x , y = getScreenFromWorldPosition ( sx , sy , sz + 0.3 )
if x then
dxDrawText ( "[1]" .. getPlayerName ( v ), x - 60 , y , x , y , tocolor ( 255 , 255 , 255 , 160 ), 0.85 + ( 15 - dist ) * 0.02 , FMain )
dxDrawText ( "Adminisrator" , x - 55 , y + 30 , x , y , tocolor ( 255 , 0 , 0 , 255 ), 0.85 + ( 15 - dist ) * 0.02 , SMain )
end
end
end
end
end
)
Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Wysłany: 2017-11-11, 22:21
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
0.85 + ( 15 - dist ) * 0.02 to odpowiada za powi?kszanie si?.
Je?li chodzi o markery to za pewne jest tam tworzony marker aby to jako? dzia?a?o, na miejscu tego jest marker i aby by?o ?atwiej to jest to po to by dzia?a?o jak marker normalny. By mo?na sprawdzi? czy gracz jest w markerze, gdy wchodzi/wychodzi pro?ciej tak ni? pisa? w?asne funkcje wywo?uj?ce takie zdarzenia.
Wysłany: 2017-11-11, 22:22
Szydlo
Stance Works
Wiek: 25 Na forum: 3585 dni Posty: 343
Nick w MP: Szydlo
Piwa : 4
A ten marker jest pewnie nie widzialny?
Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Tagi: nametagi
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: