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

Wysłany: 2015-12-11, 15:30


GamerHD11







Wiek: 24
Na forum: 4402 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

M?j problem jest taki, ?e gdy ko?cz? prac? i id? po drugi kurs to po klikni?ciu przycisku "Zatrudnij Si?" auto si? nie pojawia. Pomocy.


Client:

local marker = createMarker(642.66235, 1238.53381, 10.66666, "cylinder", 2, 0, 0, 255, 200)
znak = createBlip(642.66235, 1238.53381, 10.66666, 52)

        okno = guiCreateWindow(753, 244, 408, 594, "Praca Przewo?nika Ropy", false)
        guiWindowSetSizable(okno, false)

        opis = guiCreateMemo(9, 25, 389, 365, "Praca polega na dowo?eniu paliwa na stacji poprzez wydobycie i za?adowanie do auta ropy, prze?adunek ropy z samochodu do poci?gu, przew?z paliwa poci?giem do Koncernu Naftowego, ponowny przyjazd do zbiornika z rop? i przew?z przerobionej ropy na benzyne do stacji paliw. Za jeden taki kurs dostaje si? od 90 do 110 $, a tak?e wzbogaca si? dystrybutor z paliwem od 150 do 300 litr?w paliwa.", false, okno)
        guiMemoSetReadOnly(opis, true)
        btnzat = guiCreateButton(11, 405, 387, 59, "Zatrudnij si?", false, okno)
        btnzwol = guiCreateButton(11, 483, 387, 63, "Zwolnij si?", false, okno)
        zamknij = guiCreateButton(347, 564, 51, 20, "X", false, okno)
    guiSetVisible(okno, false)

function showGUI(hitElement)
if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
if not guiGetVisible(okno) then
if not getPedOccupiedVehicle(localPlayer) then
guiSetVisible(okno, true)
showCursor(true)
end
end
end
end
addEventHandler("onClientMarkerHit", marker, showGUI)

function hideGUI()
guiSetVisible(okno, false)
showCursor(false)
end
addEventHandler("onClientGUIClick", zamknij, hideGUI)

function acceptJob()
if getElementData(localPlayer, "pracador") == "Brak" then
blip = createBlip(422.26938, 1448.28503, 6.20239, 41)
marker1 = createMarker(422.26938, 1448.28503, 5.20239, "cylinder", 4, 0, 255, 0, 200)
addEventHandler("onClientMarkerHit", marker1, getRope)
guiSetVisible(okno, false)
showCursor(false)
setElementData(localPlayer, "pracador", "Przewoziciel Ropy")
triggerServerEvent("zatrudnijSie",localPlayer, localPlayer, auto)
outputChatBox("Wejd? do pojazdu i wjed? w marker, kt?ry oznaczony jest na mapie.", 255, 255, 255)
else
outputChatBox("Posiadasz ju? aktywn? prac? dorywcz?.", 255, 255, 255)
end
end
addEventHandler("onClientGUIClick", btnzat, acceptJob)

function exitJob()
guiSetVisible(okno, false)
showCursor(false)
setElementData(localPlayer, "pracador", "Brak")
outputChatBox("Zako?czy?e? prac?: Przewoziciela Ropy.", 255, 255, 255)
end
addEventHandler("onClientGUIClick", btnzwol, exitJob)

function getRope(hitElement)
if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
auto = getPedOccupiedVehicle(localPlayer)
outputChatBox("?adowanie Ropy........", 255, 255, 255)
setElementFrozen(auto, true)
rnd = math.random(30, 65)
setElementData(localPlayer, "iloscropy", rnd)
ropa = getElementData(localPlayer, "iloscropy")
setTimer(function()
setElementFrozen(auto, false)
destroyElement(marker1)
destroyElement(blip)
blip1 = createBlip(601.58234, 1242.83191, 11.71875, 41)
marker2 = createMarker(601.58234, 1242.83191, 10.71875, "cylinder", 4, 0, 255, 0, 200)
addEventHandler("onClientMarkerHit", marker2, reloadRope)
outputChatBox("Ropa zosta?a za?adowana w ilo?ci: "..ropa.." Litr?w.", 255, 255, 255)
outputChatBox("Jed? do zbiornika ropy, aby prze?adowa? surowiec mineralny z cysterny do Poci?gu. Oznaczony jest blipem na mapie.", 255, 255, 255)
end, 5000, 1)
end
end

function reloadRope(hitElement)
auto = getPedOccupiedVehicle(localPlayer)
if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
if auto then
setElementFrozen(auto, true)
outputChatBox("Wejd? w marker oraz kliknij przycisk PRZE?ADUJ aby by?o mo?liwe prze?adowanie ropy.", 255, 255, 255)
marker3 = createMarker(601.67200, 1249.83032, 10.71875, "cylinder", 1, 0, 255, 255, 200)
addEventHandler("onClientMarkerHit", marker3, showGUIRope)
end
end
end

okno1 = guiCreateWindow(762, 327, 355, 513, "Zbiornik Ropy", false)
guiWindowSetSizable(okno1, false)
btnprze = guiCreateButton(10, 227, 327, 73, "Prze?aduj", false, okno1)
memo1 = guiCreateMemo(9, 29, 328, 112, "Po prze?adowaniu Ropy jed? do koncernu naftowego aby przerobi? rop? na paliwo, kt?re dowieziesz potem na stacj?.", false, okno1)

guiMemoSetReadOnly(memo1, true)
guiSetVisible(okno1, false)

function showGUIRope(hitElement)
if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
if not guiGetVisible(okno1) then
guiSetVisible(okno1, true)
showCursor(true)
end
end
end

function reloadingRope()
auto = getPedOccupiedVehicle(localPlayer)
if not auto then
setElementFrozen(localPlayer, true)
outputChatBox("Prze?adowywanie Ropy.......", 255, 255, 255)
setTimer(function()
destroyElement(marker2)
destroyElement(marker3)
destroyElement(blip1)
marker4 = createMarker(741.12970, 1985.70349, 4.34257, "cylinder", 5, 0 ,255, 0, 200)
addEventHandler("onClientMarkerHit", marker4, paliwo)
blip2 = createBlip(741.12970, 1985.70349, 5.34257, 41)
setElementFrozen(localPlayer, false)
guiSetVisible(okno1, false)
showCursor(false)
triggerServerEvent("createTrain", localPlayer, localPlayer, pociag)
outputChatBox("Jed? do koncernu naftowego aby przerobi? rop?.", 255, 255, 255)
end, 5000, 1)
end
end
addEventHandler("onClientGUIClick", btnprze, reloadingRope)

function paliwo(hitElement)
auto = getPedOccupiedVehicle(localPlayer)
if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
if auto then
destroyElement(marker4)
destroyElement(blip2)
marker5 = createMarker(577.21191, 1269.77368, 11.59429, "cylinder", 5, 0, 255, 0, 200)
addEventHandler("onClientMarkerHit", marker5, przeladuj2)
blip3 = createBlip(636.90680, 1253.74304, 11.64016, 41)
outputChatBox("Paliwo jest ju? gotowe i za?adowane na tw?j poci?g. Jed? do zbiornika, aby prze?adowa? paliwo do cysterny.", 255, 255, 255)
end
end
end

function przeladuj2(hitElement)
if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
if auto then
destroyElement(marker5)
destroyElement(blip3)
triggerServerEvent("zaladunekPaliwa", localPlayer, localPlayer, auto1)
outputChatBox("Jed? na stacj? paliw, aby dostarczy? paliwo do dystrybutora.", 255, 255, 255)
marker6 = createMarker(23.25203, 1175.06689, 18.40798, "cylinder", 3, 0 ,255, 0, 200)
addEventHandler("onClientMarkerHit", marker6, addFuel)
blip4 = createBlip(23.25203, 1175.06689, 19.40798, 41)
end
end
end

function addFuel(hitElement)
if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
if auto then
auto = getPedOccupiedVehicle(localPlayer)
outputChatBox("Roz?adowywanie paliwa na stacje paliw. Prosz? czeka? 15 sekund.", 255, 255, 255)
setElementFrozen(auto, true)
setTimer(function()
rnd = math.random(45, 65)
setElementFrozen(auto, false)
givePlayerMoney(rnd)
destroyElement(marker6)
destroyElement(blip4)
outputChatBox("Po zako?czonym kursie otrzyma?e? "..rnd.." $ oraz doda?e? do dystrybutora "..ropa.." L.", 255, 255, 255)
triggerServerEvent("endDestroy", localPlayer, localPlayer)
setElementData(localPlayer, "iloscropy", 0)
setElementData(localPlayer, "pracador", "Brak")
end, 15000, 1)
end
end
end



Server:

addEvent("zatrudnijSie", true)
addEventHandler("zatrudnijSie", getRootElement(), function(thePlayer)
auto = createVehicle(573, 636.90680, 1253.74304, 11.64016)
warpPedIntoVehicle(thePlayer, auto)
setElementData(auto, "fuel", 60)
setElementData(auto, "przebieg", 0)
end)

addEvent("createTrain", true)
addEventHandler("createTrain", getRootElement(), function(thePlayer)
pociag = createVehicle(538, 577.21191, 1269.77368, 11.59429)
setElementData(pociag, "fuel", 60)
setElementData(pociag, "przebieg", 0)
setElementCollisionsEnabled(pociag, false)
warpPedIntoVehicle(thePlayer, pociag)
end)

addEvent("zaladunekPaliwa", true)
addEventHandler("zaladunekPaliwa", getRootElement(), function(thePlayer)
destroyElement(pociag)
auto1 = createVehicle(573, 580.13721, 1218.68896, 11.71127)
setElementData(auto1, "fuel", 60)
setElementData(auto1, "przbieg", 0)
warpPedIntoVehicle(thePlayer, auto1)
end)

addEvent("endDestroy", true)
addEventHandler("endDestroy", getRootElement(), function(thePlayer)
destroyElement(auto1)
setElementPosition(thePlayer, 619.47595, 1227.50684, 11.71875)
end)

function destroyVehicle(vehicle, seat, jacked)
if ( getVehicleID (vehicle) == 573 ) then
if ( getVehicleID(vehicle) == 538 ) then
destroyElement(vehicle)
end
end
end
addEventHandler("onPlayerVehicleExit", getRootElement(), destroyVehicle)


[ Dodano: 2015-12-12, 20:25 ]
Pomo?e kto? ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-13, 10:17


krisu477







Wiek: 25
Na forum: 4978 dni
Posty: 54
Nick w MP: Krisek

Piwa: 7

Respekt: 70

jakie? b??dy? wszystko inne si? pojawia?

Postaw piwo autorowi tego posta
 

 
Tagi: koniec :: pracy
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