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

Wysłany: 2017-02-12, 19:27


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

mam taki problem ze je?li jeden gracz wyjdzie z pojazdu to wszystkim si? k?czy egzamin prosz? o pomoc


addEventHandler("onClientVehicleExit"resourceRoot, function(playerseat) 
if seat == 0 then 
triggerServerEvent("egzaminOblany"localPlayerusunOstatniCheckpoint() 
checkpoint false 
SAVEVEH false 
end 
end


oraz po wjechaniu w ostatni punkt nie zalicza go oraz nie da si? sk?czy? prawka

client

--kolejne wspolrzedne punktow 
local trasa = { 
{2153.40,1657.54,-24},
{2086.02,1646.77,-24},
{2070.08,1658.95,-24},
{2102.94,1769.58,-24},
{2135.84,1771.76,-24},
{2319.09,1771.38,-24},
{2324.68,1715.58,-24},
{2324.94,1619.08,-24},
{2364.87,1610.64,-24},
{2423.14,1608.72,-24},
{2425.32,1530.12,-24},
{2420.69,1476.69,-24},
{2375.75,1475.26,-24},
{2364.86,1443.63,-24},
{2361.96,1377.73,-24},
{2242.83,1375.49,-24},
{2224.81,1358.10,-24},
{2225.17,1208.03,-24},
{2230.50,1192.52,-24},
{2336.95,1191.37,-24},
{2344.92,1061.70,-24},
{2342.70,978.59,-22},
{2267.40,975.43,-24},
{2141.10,976.28,-24},
{2071.49,982.21,-24},
{2074.53,1026.78,-24},
{2157.94,1096.99,-24},
{2189.63,1192.25,-24},
{2189.73,1361.30,-24},
{2160.40,1375.83,-24},
{2078.08,1376.38,-24},
{2069.42,1442.86,-24},
{2069.94,1548.09,-24},
{2073.35,1640.74,-24},
{2137.71,1652.74,-24},
{2158.08,1674.95,-24},
}--{xyz}, prosze pamietac o przecinkudziekuje 

--nasze kategorie oraz ceny 
local kategorie = { 
{"A"100}, 
{"B"0}, 
{"C"150},    
{"D"300},
{"D+E"500},
} 

--gui 
mojeW,mojeH 640480 
sW,sH guiGetScreenSize() 
widthheight = (sW/mojeW), (sH/mojeHlocal guiprawko = {} 
guiprawko[1] = guiCreateWindow(150*width65*height321*width309*height"Prawo Jazdy"falseguiWindowSetSizable(guiprawko[1], falseguiprawko[2] = guiCreateLabel(61*width62*height204*width37*height"Zdawanie prawa jazdy\n Na serwerze San Andreas Life"falseguiprawko[1]) 
guiLabelSetHorizontalAlign(guiprawko[2], "left"trueguiprawko[3] = guiCreateGridList(45*width113*height236*width132*heightfalseguiprawko[1]) 
guiprawko[4] = guiGridListAddColumn(guiprawko[3], "Kategoria"0.5guiprawko[5] = guiGridListAddColumn(guiprawko[3], "Koszt (PLN)"0.5local row guiGridListAddRow (guiprawko[3]) 
guiGridListSetItemText (guiprawko[3], rowguiprawko[4], "Kategoria A"falsefalseguiGridListSetItemText (guiprawko[3], rowguiprawko[5], kategorie[1][2], falsefalselocal row guiGridListAddRow (guiprawko[3]) 
guiGridListSetItemText (guiprawko[3], rowguiprawko[4], "Kategoria B"falsefalseguiGridListSetItemText (guiprawko[3], rowguiprawko[5], kategorie[2][2], falsefalselocal row guiGridListAddRow (guiprawko[3]) 
guiGridListSetItemText (guiprawko[3], rowguiprawko[4], "Kategoria C"falsefalseguiGridListSetItemText (guiprawko[3], rowguiprawko[5], kategorie[3][2], falsefalselocal row guiGridListAddRow (guiprawko[3]) 
guiGridListSetItemText (guiprawko[3], rowguiprawko[4], "Kategoria D"falsefalseguiGridListSetItemText (guiprawko[3], rowguiprawko[5], kategorie[4][2], falsefalselocal row guiGridListAddRow (guiprawko[3]) 
guiGridListSetItemText (guiprawko[3], rowguiprawko[4], "Kategoria C+E"falsefalseguiGridListSetItemText (guiprawko[3], rowguiprawko[5], kategorie[5][2], falsefalseguiprawko[6] = guiCreateButton(10*width255*height122*width44*height"Anuluj"falseguiprawko[1]) 
guiprawko[7] = guiCreateButton(190*width255*height121*width44*height"Dalej"falseguiprawko[1]) 
guiSetVisible(guiprawko[1], falseaddEvent("showGUIPrawko"trueaddEventHandler("showGUIPrawko"getRootElement(), 
function(abcdeguiSetVisible(guiprawko[1], trueshowCursor(trueend) 

function onPrawkoZamknij() 
guiSetVisible(guiprawko[1], falseshowCursor(falseend 
addEventHandler ("onClientGUIClick"guiprawko[6], onPrawkoZamknijfalse) 

function onPrawkoDalej() 
local rowcolumn guiGridListGetSelectedItem(guiprawko[3]) 
if row ~= -1 then 
local text guiGridListGetItemText (guiprawko[3], rowguiprawko[4]) 
local cena guiGridListGetItemText (guiprawko[3], rowguiprawko[5]) 
if tonumber(cena) <= getPlayerMoney(localPlayerthen 
if text == "Kategoria A" then 
triggerServerEvent("egzaminPrawaJazdy"localPlayer"A"cena) 
elseif text == "Kategoria B" then 
triggerServerEvent("egzaminPrawaJazdy"localPlayer"B"cena) 
elseif text == "Kategoria C" then 
triggerServerEvent("egzaminPrawaJazdy"localPlayer"C"cena) 
elseif text == "Kategoria C+E" then 
triggerServerEvent("egzaminPrawaJazdy"localPlayer"C+E"cena) 
elseif text == "Kategoria D" then 
triggerServerEvent("egzaminPrawaJazdy"localPlayer"D"cenaend 
else 
outputChatBox("Nie posiadasz wystarczaj?co pieni?dzy."230230230trueend 
end 
end 
addEventHandler ("onClientGUIClick"guiprawko[7], onPrawkoDalejfalse) 

--egzamin 
addEvent("startEgzamin"trueaddEventHandler("startEgzamin"getRootElement(), 
function(vehonPrawkoZamknij() 

SAVEVEH veh --zapisuje sobie moj pojazd 
checkpoint 1 
stworzNowyCheckpoint() 

addEventHandler("onClientVehicleExit"resourceRoot, function(playerseat) 
if seat == 0 then 
triggerServerEvent("egzaminOblany"localPlayerusunOstatniCheckpoint() 
checkpoint false 
SAVEVEH false 
end 
end) 


--4. sek po respie auta mozna dopiero oblac dla bezpieczenstwa przy respawnie 
setTimer(function() 
fixVehicle(SAVEVEHaddEventHandler("onClientVehicleCollision"SAVEVEHonVehicleCollisionend40001end) 

function stworzNowyCheckpoint(source) 
if isElement(punktthen
removeEventHandler("onClientMarkerHit"punktonCheckpointHit)

destroyElement(punktdestroyElement(blipend 

punkt createMarker (trasa[checkpoint][1], trasa[checkpoint][2], trasa[checkpoint][3] + 33"checkpoint"30255255150)
setMarkerTarget(punkttrasa[checkpoint+1][1], trasa[checkpoint+1][2], trasa[checkpoint+1][3] + 33blip createBlipAttachedTo(punkt12)

addEventHandler("onClientMarkerHit"punktonCheckpointHitend 

function usunOstatniCheckpoint() 
if isElement(punktthen 
removeEventHandler("onClientMarkerHit"punktbliponCheckpointHitdestroyElement(punkt)
destroyElement(blip)
end 
end 

function onCheckpointHit(hitElement) 
if localPlayer == hitElement then 
checkpoint checkpoint if checkpoint #trasa then 
triggerServerEvent("egzaminZdany"localPlayerzakonczEgzamin() 
else 
stworzNowyCheckpoint() 
end 
end 
end 

function onVehicleCollision(elementloss) 
if loss 50 then 
triggerServerEvent("egzaminOblany"localPlayerzakonczEgzamin() 
end 
end 

function zakonczEgzamin() 
removeEventHandler("onClientVehicleCollision"SAVEVEHonVehicleCollisionusunOstatniCheckpoint() 
checkpoint false 
SAVEVEH false 
end 


prosz? o pomoc :D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-13, 10:15


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

polaczkos, resourceRoot dzia?a na wszystkie elementy kt?re zosta?y stworzone w ca?ym zasobie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-13, 10:36


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

to na co to zamieni? na samo root ?

oraz czemu nie da sie zak?czy? egzaminu po wjechaniu w ostatni punkt nic sie nie dzieje a po wejchceniu w przed ostatni wyskakuje;



Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-13, 10:48


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

polaczkos, musisz zrobi? ten skrypt na tablice, ?eby ka?dy gracz mia? przypisany samoch?d i wtedy zamiast resourceRoot element tabeli gracza. Spr?buj
if checkpoint >= #trasa then


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-13, 11:03


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

teraz po wjechaniu w przed ostatni punkt prawko si? kaczy

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-13, 11:05


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

polaczkos,
if checkpoint == #trasa + 1 then


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-13, 11:11


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

powr?ci? ten sam b?ad w debugscript 3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-13, 14:45


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

zrob elementdate postepu prawa jazdy i potem


function show()
local pkt getElementData(localPlayer"prawko:postep")
local hm trasa[pkt]

if not hm then
zakonczEgzamin()
  return
end

punkt createMarker(hm[1], hm[2], hm[3], "checkpoint",3,0,255,255,170)
setElementData punkt"prawko:zdajacy"getPlayerName(localPlayer) )

    if trasa[pkt+1then
        hm trasa[pkt+1]
        setMarkerTarget(punkthm[1], hm[2], hm[3])
    end
end
Po wjechaniu w marker jesli nie ma nastepnego to konczy egzamin. Co do wsiadania:


addEventHandler("onClientVehicleExit"root, function(playerseat) 
if seat == 0 then 
triggerServerEvent("egzaminOblany"localPlayerusunOstatniCheckpoint() 
checkpoint false 
SAVEVEH false 
end 
end


Je?li nie zadzia?a to nadawaj elementdate nicku gracza ktory rozpoczal prawko

i potem

addEventHandler("onClientVehicleExit"resourceRoot, function(playerseat) 
if seat == 0 then 
if getElementData(source"kogo") == getPlayerName(localPlayerthen
triggerServerEvent("egzaminOblany"localPlayerusunOstatniCheckpoint() 
checkpoint false 
SAVEVEH false 
end
end 
end


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-13, 15:00


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

gdzie to mam wstawi?

function show()
local pkt getElementData(localPlayer"prawko:postep")
local hm trasa[pkt]

if not hm then
zakonczEgzamin()
  return
end

punkt createMarker(hm[1], hm[2], hm[3], "checkpoint",3,0,255,255,170)
setElementData punkt"prawko:zdajacy"getPlayerName(localPlayer) )

    if trasa[pkt+1then
        hm trasa[pkt+1]
        setMarkerTarget(punkthm[1], hm[2], hm[3])
    end
end

bo nie rozumiem

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-13, 16:01


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Zamieni? funkcj? stworzNowyCheckpoint na to co poda?em.

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-13, 18:05


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

no i teraz po rozpocze?ni pojawia sie pojazd i nic po za tym nie ma

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-14, 13:43


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Zamie? nazw? funkcji zamiast 'show' daj tam t? swoj? nazwe stworzNowyCheckPoint czy jak tam by?o.

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-14, 14:42


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

dalej nie dzia?a teraz wyglada to tak


--kolejne wspolrzedne punktow 
local trasa = { 
{2153.40,1657.54,10.59},
{2086.02,1646.77,10.45},
{2070.08,1658.95,10.44},
{2102.94,1769.58,10.44},
{2135.84,1771.76,10.44},
{2319.09,1771.38,10.48},
{2324.68,1715.58,10.54},
{2324.94,1619.08,10.51},
{2364.87,1610.64,10.44},
{2423.14,1608.72,10.67},
{2425.32,1530.12,10.59},
{2420.69,1476.69,10.61},
{2375.75,1475.26,10.48},
{2364.86,1443.63,10.44},
{2361.96,1377.73,10.53},
{2242.83,1375.49,10.55},
{2224.81,1358.10,10.52},
{2225.17,1208.03,10.53},
{2230.50,1192.52,10.59},
{2336.95,1191.37,10.45},
{2344.92,1061.70,10.44},
{2342.70,978.59,10.43},
{2267.40,975.43,10.44},
{2141.10,976.28,10.49},
{2071.49,982.21,10.41},
{2074.53,1026.78,10.35},
{2157.94,1096.99,12.49},
{2189.63,1192.25,10.78},
{2189.73,1361.30,10.43},
{2160.40,1375.83,10.44},
{2078.08,1376.38,10.43},
{2069.42,1442.86,10.44},
{2069.94,1548.09,10.45},
{2073.35,1640.74,10.44},
{2137.71,1652.74,10.46},
{2158.08,1674.95,10.46},
}--{xyz}, prosze pamietac o przecinkudziekuje 

--nasze kategorie oraz ceny 
local kategorie = { 
{"A"100}, 
{"B"0}, 
{"C"150},    
{"D"300},
{"D+E"500},
} 

--gui 
mojeW,mojeH 640480 
sW,sH guiGetScreenSize() 
widthheight = (sW/mojeW), (sH/mojeHlocal guiprawko = {} 
guiprawko[1] = guiCreateWindow(150*width65*height321*width309*height"Prawo Jazdy"falseguiWindowSetSizable(guiprawko[1], falseguiprawko[2] = guiCreateLabel(61*width62*height204*width37*height"Zdawanie prawa jazdy\n Na serwerze IPlayGaming"falseguiprawko[1]) 
guiLabelSetHorizontalAlign(guiprawko[2], "left"trueguiprawko[3] = guiCreateGridList(45*width113*height236*width132*heightfalseguiprawko[1]) 
guiprawko[4] = guiGridListAddColumn(guiprawko[3], "Kategoria"0.5guiprawko[5] = guiGridListAddColumn(guiprawko[3], "Koszt (PLN)"0.5local row guiGridListAddRow (guiprawko[3]) 
guiGridListSetItemText (guiprawko[3], rowguiprawko[4], "Kategoria A"falsefalseguiGridListSetItemText (guiprawko[3], rowguiprawko[5], kategorie[1][2], falsefalselocal row guiGridListAddRow (guiprawko[3]) 
guiGridListSetItemText (guiprawko[3], rowguiprawko[4], "Kategoria B"falsefalseguiGridListSetItemText (guiprawko[3], rowguiprawko[5], kategorie[2][2], falsefalselocal row guiGridListAddRow (guiprawko[3]) 
guiGridListSetItemText (guiprawko[3], rowguiprawko[4], "Kategoria C"falsefalseguiGridListSetItemText (guiprawko[3], rowguiprawko[5], kategorie[3][2], falsefalselocal row guiGridListAddRow (guiprawko[3]) 
guiGridListSetItemText (guiprawko[3], rowguiprawko[4], "Kategoria D"falsefalseguiGridListSetItemText (guiprawko[3], rowguiprawko[5], kategorie[4][2], falsefalselocal row guiGridListAddRow (guiprawko[3]) 
guiGridListSetItemText (guiprawko[3], rowguiprawko[4], "Kategoria C+E"falsefalseguiGridListSetItemText (guiprawko[3], rowguiprawko[5], kategorie[5][2], falsefalseguiprawko[6] = guiCreateButton(10*width255*height122*width44*height"Anuluj"falseguiprawko[1]) 
guiprawko[7] = guiCreateButton(190*width255*height121*width44*height"Dalej"falseguiprawko[1]) 
guiSetVisible(guiprawko[1], falseaddEvent("showGUIPrawko"trueaddEventHandler("showGUIPrawko"getRootElement(), 
function(abcdeguiSetVisible(guiprawko[1], trueshowCursor(trueend) 

function onPrawkoZamknij() 
guiSetVisible(guiprawko[1], falseshowCursor(falseend 
addEventHandler ("onClientGUIClick"guiprawko[6], onPrawkoZamknijfalse) 

function onPrawkoDalej() 
local rowcolumn guiGridListGetSelectedItem(guiprawko[3]) 
if row ~= -1 then 
local text guiGridListGetItemText (guiprawko[3], rowguiprawko[4]) 
local cena guiGridListGetItemText (guiprawko[3], rowguiprawko[5]) 
if tonumber(cena) <= getPlayerMoney(localPlayerthen 
if text == "Kategoria A" then 
triggerServerEvent("egzaminPrawaJazdy"localPlayer"A"cena) 
elseif text == "Kategoria B" then 
triggerServerEvent("egzaminPrawaJazdy"localPlayer"B"cena) 
elseif text == "Kategoria C" then 
triggerServerEvent("egzaminPrawaJazdy"localPlayer"C"cena) 
elseif text == "Kategoria C+E" then 
triggerServerEvent("egzaminPrawaJazdy"localPlayer"C+E"cena) 
elseif text == "Kategoria D" then 
triggerServerEvent("egzaminPrawaJazdy"localPlayer"D"cenaend 
else 
outputChatBox("Nie posiadasz wystarczaj?co pieni?dzy."230230230trueend 
end 
end 
addEventHandler ("onClientGUIClick"guiprawko[7], onPrawkoDalejfalse) 

--egzamin 
addEvent("startEgzamin"trueaddEventHandler("startEgzamin"getRootElement(), 
function(vehonPrawkoZamknij() 

SAVEVEH veh --zapisuje sobie moj pojazd 
checkpoint 1 
stworzNowyCheckpoint() 

addEventHandler("onClientVehicleExit"resourceRoot, function(playerseat) 
if seat == 0 then 
triggerServerEvent("egzaminOblany"localPlayerusunOstatniCheckpoint() 
checkpoint false 
SAVEVEH false 
end 
end) 


--4. sek po respie auta mozna dopiero oblac dla bezpieczenstwa przy respawnie 
setTimer(function() 
fixVehicle(SAVEVEHaddEventHandler("onClientVehicleCollision"SAVEVEHonVehicleCollisionend40001end) 

function stworzNowyCheckpoint()
local pkt getElementData(localPlayer"prawko:postep")
local hm trasa[pkt]

if not hm then
zakonczEgzamin()
  return
end

punkt createMarker(hm[1], hm[2], hm[3], "checkpoint",3,0,255,255,170)
setElementData punkt"prawko:zdajacy"getPlayerName(localPlayer) )

    if trasa[pkt+1then
        hm trasa[pkt+1]
        setMarkerTarget(punkthm[1], hm[2], hm[3])
    end
end

function onCheckpointHit(hitElement) 
if localPlayer == hitElement then 
checkpoint checkpoint if checkpoint #trasa then 
triggerServerEvent("egzaminZdany"localPlayerzakonczEgzamin() 
else 
stworzNowyCheckpoint() 
end 
end 
end 

function onVehicleCollision(elementloss) 
if loss 50 then 
triggerServerEvent("egzaminOblany"localPlayerzakonczEgzamin() 
end 
end 

function zakonczEgzamin() 
removeEventHandler("onClientVehicleCollision"SAVEVEHonVehicleCollisionusunOstatniCheckpoint() 
checkpoint false 
SAVEVEH false 
end 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-14, 16:34


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Bo nie nadajesz elementdaty prawko:postep

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-14, 16:42


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

gdzie mam nada? ?

Postaw piwo autorowi tego posta
 

 
Tagi: prawko
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