Wysłany: 2019-02-09, 17:32
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
Witam, jak zrobi?, aby po wjechaniu autem w marker pokazywa? si? 3dtext na mapie w wyznaczonym miejscu? Najlepiej bylo by po wpisaniu komendy
Dzi?kuj? za pomoc
Daje repe i piwka !
Wysłany: 2019-02-09, 18:06
BlueCry
ŚĆRIPTER LUJA
Wiek: 25 Na forum: 4006 dni Posty: 78
Nick w MP: BlueCry
Piwa : 2176
Tutaj masz kod, po wjechaniu w marker i po wpisaniu komendy /text3 tworzy si? 3dtext w miejscu w kt?rym jeste?.
local Marker = createMarker ( - 2702.90 ,- 277.74 , 7.19 , "cylinder" , 1.5 , 255 , 255 , 0 , 170 )
function MarkerHit ( hitElement , matchingDimension ) -- define MarkerHit function for the handler
local elementType = getElementType ( hitElement ) -- get the hit element 's type
setElementData(hitElement, "textgut", true)
end
addEventHandler( "onMarkerHit", Marker, MarkerHit )
function markerLeave( leaveElement, matchingDimension )
if getElementType( leaveElement ) == "player" then
setElementData(leaveElement, "textgut", false)
end
end
addEventHandler( "onMarkerLeave", Marker, markerLeave )
function text ( playerSource, commandName )
if ( playerSource ) then
if getElementData(playerSource, "textgut") then
local x, y, z = getElementPosition ( playerSource )
local text=createElement(' text ')
setElementPosition(text, x, y, z)
setElementData(text,"name","Text jaki chcesz")
outputChatBox ( "Stworzy?e? 3dtext", playerSource )
end
end
end
addCommandHandler ( "text3", text )
Więcej szczegółów
Wystawiono 1 piw(a):sebik2303
Wysłany: 2019-02-09, 18:35
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
db3 od setelementdaty jest w linijce 19
Wysłany: 2019-02-09, 18:43
BlueCry
ŚĆRIPTER LUJA
Wiek: 25 Na forum: 4006 dni Posty: 78
Nick w MP: BlueCry
Piwa : 2176
"sebik2303" napisał/a :db3 od setelementdaty jest w linijce 19
Po kt?rej stronie doda?e?? Po stronie klienta czy serwera?
[ Dodano : 2019-02-09, 18:57 ]
Tworzy?em to po stronie serwera, wi?c dodaj po stronie serwera.
Wysłany: 2019-02-09, 23:03
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
Dobra to dzia?a a jak zrobi? aby to sie usun??o po wyjechaniu z tego markera lub chocia? po wpisaniu komy???
[ Dodano : 2019-02-09, 23:47 ]
I r?wnie? dlaczego jak daje np local przeb=getElementData (playerSource, "vehicle:mileage") to wywala errora i nie dzia?a
Wysłany: 2019-02-10, 09:41
BlueCry
ŚĆRIPTER LUJA
Wiek: 25 Na forum: 4006 dni Posty: 78
Nick w MP: BlueCry
Piwa : 2176
Tutaj masz kod kt?ry usuwa napis po wyjechaniu:
local Marker = createMarker ( - 2702.90 ,- 277.74 , 7.19 , "cylinder" , 1.5 , 255 , 255 , 0 , 170 )
function MarkerHit ( hitElement , matchingDimension )
local elementType = getElementType ( hitElement )
--if getElementData ( hitElement , "stworzyltext" ) == 1 then
--return end
setElementData ( hitElement , "stworzyltext" , 0 )
end
addEventHandler ( "onMarkerHit" , Marker , MarkerHit )
function text3 ( playerSource , commandName )
if ( playerSource ) then
local x , y , z = getElementPosition ( playerSource )
local text = createElement ( 'text' )
setElementPosition ( text , x , y , z )
setElementData ( text , "name" , "Text jaki chcesz" )
outputChatBox ( "Stworzy?e? 3dtext" , playerSource )
setElementData ( playerSource , "stworzyltext" , 1 )
end
end
addCommandHandler ( "text3" , text3 )
function markerLeave ( leaveElement , matchingDimension )
if getElementType ( leaveElement ) == "player" then
if getElementData ( leaveElement , "stworzyltext" ) == 1 then setElementData ( playerSource , "stworzyltext" , 0 )
restartResource ( getThisResource ())
else return
end
end
end
addEventHandler ( "onMarkerLeave" , Marker , markerLeave )
A co do errora jak dodajesz local przeb to poka? kod, bo inaczej nie wiem co jest ?le.
Wysłany: 2019-02-10, 10:13
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Restartowanie skryptu? Po co je?li mo?na po prostu usun?? ten element.
Gotowy kod:
local Marker = createMarker ( - 2702.90 ,- 277.74 , 7.19 , "cylinder" , 1.5 , 255 , 255 , 0 , 170 )
local text
function MarkerHit ( hitElement , matchingDimension )
if getElementType ( hitElement ) == "player" then
setElementData ( hitElement , "stworzyltext" , 0 )
end
end
addEventHandler ( "onMarkerHit" , Marker , MarkerHit )
function text3 ( playerSource , commandName )
if getElementType ( playerSource ) == "player" then
if isElement ( text ) then
destroyElement ( text )
text = nil
end
local x , y , z = getElementPosition ( playerSource )
text = createElement ( 'text' )
setElementPosition ( text , x , y , z )
setElementData ( text , "name" , "Text jaki chcesz" )
outputChatBox ( "Stworzy?e? 3dtext" , playerSource )
setElementData ( playerSource , "stworzyltext" , true )
end
end
addCommandHandler ( "text3" , text3 )
function markerLeave ( leaveElement , matchingDimension )
if getElementType ( leaveElement ) == "player" then
if getElementData ( leaveElement , "stworzyltext" ) and isElement ( text ) then
removeElementData ( leaveElement , "stworzyltext" )
destroyElement ( text )
end
end
end
addEventHandler ( "onMarkerLeave" , Marker , markerLeave )
Kod lekko u?o?y?em estetycznie i poprawi?em jedn? zmienn? gracza w evencie onMarkerLeave.
Tagi: 3dtext :: wjechaniu :: marker
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: