Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2016-01-13, 20:17


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4471 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Witam jak zrobi? aby marker tworzy? si? za markerem np mam tabele


local pkt = {
{x,y,z},
{x,y,z},
{x,y,z},
{x,y,z},
{x,y,z},
}


i co dalej ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-13, 20:21


Emm

***** ***






Wiek: 32
Na forum: 4021 dni
Posty: 3191
Nick w MP: Emm

Piwa: 6171

Respekt: 1580
Respekt: 1580Respekt: 1580


   Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .

Więcej informacji znajdziesz w Wikipedii MTA:

destroyElement


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-13, 21:00


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

BlackTen, pisane na szybko:
tablica = {}
tablica[1] = {x=0000, y=0000, z=000}
tablica[2] = {x=0000, y=0000, z=000}
tablica[3] = {x=0000, y=0000, z=000}
tablica[4] = {x=0000, y=0000, z=000}
tablica[5] = {x=0000, y=0000, z=000}

data = {}
data.start = 1
data.koniec = 5
marker = {}

function createmarker (plr)
local nextm = data.start + 1
if isElement(marker[data.start]) then
    destroyElement(marker[data.start])
end
marker[nextm] = createMarker( tablica[nextm].x, tablica[nextm].y, tablica[nextm].z)
setElementData(marker[nextm], "Tablica", true)
end

function MarkerHit( hitElement, matchingDimension ) 
    local data = getElementData(source, "Tablica")
    if data == true then
        createmarker ( hitElement)
    end
end
addEventHandler( "onMarkerHit", getRootElement(), MarkerHit )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-13, 21:04


#404







Wiek: 27
Na forum: 4913 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%

markerrozpocznij =.....
local pkt = {
{x,y,z},
{x,y,z},
{x,y,z},
{x,y,z},
{x,y,z},
}

postep = nil
addEventHandler("onMarkerHit", resourceRoot, function(he)
    if source == markerrozpocznij then
        postep = 1
        createMarker(pkt[1][1], pkt[1][2],pkt[1][3]) -- funkcja pogl?dowa, nie b?dzie dzia?a?, musisz j? sobie uzupe?ni?
    return end
    
destroyElement(source)
    if postep == #pkt then
        outputChatBox("Nie ma marker?w, przynie? w wiaderku z tesco",he)
    return end
    
    postep = postep + 1
    outputChatBox("Kolejny marker... Numer markera: "..postep,he)
    createMarker(pkt[postep][1], pkt[postep][2],pkt[postep][3],....) -- funkcja pogl?dowa, masz j? sobie sam zrobi?, tu s? jedynie podane koordynaty jak maj? wygl?da?

end
)

Co? na takiej zasadzie powinno dzia?a?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-14, 20:11


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4471 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Dobra, a gdzie teraz wczepi? event "zdajemy"???

local screenW, screenH = guiGetScreenSize()
addEvent("pokazgui", true)
addEvent("showmarker", true)
rozpocznij = guiCreateLabel(0.37, 0.63, 0.09, 0.03, "Rozpocznij", true)
        guiSetFont(rozpocznij, "default-bold-small")
        guiLabelSetHorizontalAlign(rozpocznij, "center", false)
        guiLabelSetVerticalAlign(rozpocznij, "center")
zamknij = guiCreateLabel(0.54, 0.63, 0.09, 0.03, "Zamknij", true)
        guiSetFont(zamknij, "default-bold-small")
        guiLabelSetHorizontalAlign(zamknij, "center", false)
        guiLabelSetVerticalAlign(zamknij, "center")    
guiSetVisible(zamknij,false)
guiSetVisible(rozpocznij,false)


function panelek ()
dxDrawRectangle(screenW * 0.3667, screenH * 0.3231, screenW * 0.2667, screenH * 0.3546, tocolor(1, 0, 0, 213), false)
dxDrawText("Prawo Jazdy KAT.B", screenW * 0.3734, screenH * 0.3009, screenW * 0.6281, screenH * 0.3472, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false)
dxDrawRectangle(screenW * 0.3734, screenH * 0.6370, screenW * 0.0854, screenH * 0.0315, tocolor(75, 75, 75, 150), false)
dxDrawRectangle(screenW * 0.5427, screenH * 0.6370, screenW * 0.0854, screenH * 0.0315, tocolor(75, 75, 75, 150), false)
end

addEventHandler("pokazgui",root,function()
addEventHandler("onClientRender",getRootElement(),panelek)
guiSetVisible(zamknij,true)
guiSetVisible(rozpocznij,true)
end)
function zamknijgui () 

if source ~= zamknij then return end  
removeEventHandler("onClientRender",getRootElement(),panelek)
guiSetVisible(zamknij,false)
guiSetVisible(rozpocznij,false)
showCursor (false,true) 
end 
addEventHandler("onClientGUIClick",getRootElement (),zamknijgui)

function kursrozpocznij () 
if source ~= rozpocznij then return end 
removeEventHandler("onClientRender",getRootElement(),panelek)
guiSetVisible(zamknij,false)
guiSetVisible(rozpocznij,false)
showCursor (false,true) 
triggerServerEvent ("guiokno", getRootElement (), localPlayer)
end 
addEventHandler("onClientGUIClick",getRootElement (),kursrozpocznij)

local pkt = {
 {2417.2331542969, -79.035232543945, 26.002973556519},
 {2372.0991210938, -79.478996276855, 26.125484466553},
 {2346.1342773438, -49.069610595703, 25.853168487549},
 {2345.8073730469, 21.681623458862, 25.854248046875},
 {2345.7736816406, 81.438507080078, 25.853691101074},
 {2345.7368164063, 146.43305969238, 25.854440689087},
 {2345.6967773438, 219.18629455566, 25.854410171509},
 {2345.6499023438, 309.29412841797, 25.854284286499},
 {2357.1022949219, 389.71673583984, 26.93369102478},
 {2417.5541992188, 367.65045166016, 31.513900756836},
 {2351.4497070313, 328.67919921875, 32.183601379395},
 {2270.6594238281, 326.32922363281, 32.182834625244},
 {2196.685546875, 326.77667236328, 32.338756561279},
 {2114.3835449219, 324.29718017578, 33.580631256104},
 {2011.1400146484, 316.44934082031, 33.911827087402},
 {1903.0015869141, 302.99618530273, 29.772113800049},
 {1782.5864257813, 279.51010131836, 18.87929725647},
 {1701.9427490234, 336.61239624023, 27.783664703369},
 {1709.7124023438, 404.93893432617, 30.112461090088},
 {1741.9912109375, 497.42742919922, 28.662105560303},
 {1777.1417236328, 600.71099853516, 21.719720840454},
 {1803.6614990234, 727.30603027344, 13.254385948181},
 {1811.1231689453, 821.58575439453, 10.219032287598},
 {1880.6876220703, 834.08520507813, 8.1158170700073},
 {1998.9357910156, 832.07177734375, 6.2525153160095},
 {2068.4453125, 909.95635986328, 7.8422141075134},
 {2069.7590332031, 1041.068359375, 10.108655929565},
 {2069.7387695313, 1147.3248291016, 10.197438240051},
 {2052.4365234375, 1167.8764648438, 10.193109512329},
 {2046.3386230469, 1066.0352783203, 10.191068649292},
 {2045.6447753906, 913.21185302734, 8.0277557373047},
 {1982.1676025391, 848.93157958984, 6.2444462776184},
 {1869.8475341797, 848.74011230469, 8.4755983352661},
 {1787.1302490234, 792.78204345703, 10.798931121826},
 {1765.9714355469, 659.7392578125, 17.735042572021},
 {1722.1925048828, 508.12838745117, 28.529132843018},
 {1675.8895263672, 374.62683105469, 29.713924407959},
 {1644.9573974609, 271.92807006836, 29.679567337036},
 {1608.6959228516, 224.68032836914, 29.533222198486},
 {1555.9885253906, 263.42776489258, 22.298435211182},
 {1644.3923339844, 286.66525268555, 20.621784210205},
 {1753.4522705078, 259.79861450195, 17.752384185791},
 {1883.9116210938, 274.69174194336, 27.428770065308},
 {1991.8439941406, 292.82580566406, 33.609767913818},
 {2163.1530761719, 310.91461181641, 32.728614807129},
 {2275.0339355469, 300.27471923828, 32.172561645508},
 {2341.8967285156, 256.54406738281, 25.85638999939},
 {2342.5463867188, 164.63026428223, 25.854839324951},
 {2342.0764160156, 29.464233398438, 25.854402542114},
 {2341.7922363281, -60.245761871338, 25.854934692383},
 {2373.5432128906, -77.700736999512, 26.117639541626},
 {2442.2861328125, -77.999168395996, 26.001930236816},
}

postep = nil
addEventHandler("onMarkerHit", resourceRoot, function(he)
        postep = 1
        createMarker(pkt[1][1], pkt[1][2],pkt[1][3],"checkpoint",2,0,255,0)
    
destroyElement(source)
    if postep == #pkt then
        local auto = getPedOccupiedVehicle(localPlayer)
        local hp = getElementHealth(auto)
        if hp >= 900 then
        triggerServerEvent("prawko.zdal",localPlayer,localPlayer)
        else
        triggerServerEvent("prawko.oblal",localPlayer,localPlayer)
        end
    end
    
    postep = postep + 1
    createMarker(pkt[postep][1], pkt[postep][2],pkt[postep][3],"checkpoint",2,0,255,0)

end
)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-16, 11:00


_Haze

Peace Yo!






Wiek: 25
Na forum: 4326 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

ja polecam funkcje
Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition

latwiej si? robi

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-16, 11:55


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

BlackTen, trigger 'zdajemy' ma Ci ustawiac 'postep' na 1, stworzyc pierwszy marker ewentualnie blip te?, stworzyc auto, warpn?? Ci? do niego.

Kombinuj... Jak Ci sie nie chce szukac, a tych tematow tutaj bylo milion w tej sprawie, watpie, ze komus sie znow bedzie chcialo ten kawalek kodu przepisywac..

TO jest g?ra 20 linijek, metod? pr?b i b??dow, uda Ci sie :)

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Tagi: marker :: markerem
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku