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

Wysłany: 2015-08-24, 10:58


markob0







Wiek: 27
Na forum: 4247 dni
Posty: 151
Nick w MP: Markob

Piwa: 939

Respekt: 98,2

Witam! Mam pewien problem poniewa?, nie wiem jak ustali? ?eby tylko graczowi kt?ry ko?czy prac? wy?wietla?a si? informacja. W tej chwili wy?wietla si? informacja ka?demu. Prosz? o pomoc.

*Kod nie nale?y do mnie

C-Side:
Kod:



destinationMarker = nil
destBlip = nil
reloadMarker = createMarker(-1790.1999511719,1434.9000244141,7.19-0.9, "corona", 3.0, 254, 0, 0, 80)

unloadingPos = { -- Wszystko jest na terenie San Fierro, ale i tak sobie sami poustawiajcie i pododawajcie punkty.
{-1805.08,999.21,24.89},
{-2016.65,970.11,45.56},
{-1955.51,1188.48,45.45},
{-1617.51,1074.92,7.19},
{-1581.15,865.56,7.60},
{-1742.3441162109,1263.7957763672,7.5272750854492},
{-1982.1995849609,1187.4477539063,45.4453125},
{-2164.7595214844,499.92376708984,35.171875},
{-2245.1525878906,100.93306732178,35.3203125},
{-2174.5046386719,-42.099849700928,35.312515258789},
{-2509.2961425781,-154.8053894043,25.6171875},
{-2612.8486328125,72.429824829102,4.3359375},
{-2628.8205566406,164.30363464355,4.328125},
{-2640.0778808594,257.89660644531,4.328125},
{-2671.9731445313,207.59413146973,4.3359375},
{-2339.3754882813,575.89239501953,27.724826812744},
{-2049.2268066406,510.87680053711,35.164112091064},
{-1967.1920166016,742.07867431641,45.4453125},
{-1723.3021240234,1041.0833740234,45.2109375},
}


function endOfWork()
if destinationMarker and isElement(destinationMarker) then
destroyElement(destinationMarker)
destinationMarker = nil
end
if destBlip and isElement(destBlip) then
destroyElement(destBlip)
destBlip = nil
end
end


function takeFurniture(he, md)
if he ~= localPlayer then return end
if not getPedOccupiedVehicle(he) then return end

local car = getPedOccupiedVehicle(he)

if getElementData(car, "pojazd_opis") == "Ladunek : 0%" then
setElementData(car, "pojazd_opis", "Ladunek : 100%")
outputChatBox("Zaladowales pojazd meblami, jedz do wskazanego punktu, oznaczonego blipem 'C'")
showDestination()
end
end
addEventHandler("onClientMarkerHit", reloadMarker, takeFurniture)

function showDestination()
local rand = math.random(1, #unloadingPos)
local destMarker = unloadingPos[rand]
destinationMarker = createMarker(destMarker[1], destMarker[2], destMarker[3], "cylinder", 2.5, 255, 0, 0, 130)
destBlip = createBlipAttachedTo(destinationMarker, 12)
addEventHandler("onClientMarkerHit", destinationMarker, unloadFurniture)
end

function unloadFurniture(he, md)
if he ~= localPlayer then return end
if not getPedOccupiedVehicle(he) then return end

local cash = math.random(15, 30)
local carr = getPedOccupiedVehicle(he)

if getElementData(carr, "pojazd_opis") == "Ladunek : 100%" then
outputChatBox("Dojechales do celu! Wroc do magazynu po nowa przesylke!")
setElementData(carr, "pojazd_opis", "Ladunek : 0%")
triggerServerEvent("givePlayerMoney", resourceRoot, cash)
endOfWork()
else
outputChatBox("Twoje auto nie jest zaladowane!")
end
end



addEvent("courier_job", true)
addEventHandler("courier_job", resourceRoot, function()
takeFurniture(he, md)
end)

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
if seat == 0 then
if getElementData(source, "pojazd_opis") == "Ladunek : 0%" or getElementData(source, "pojazd_opis") == "Ladunek : 100%" then
endOfWork()
setElementData(plr, "graczPraca", false)
triggerServerEvent("checkCars", resourceRoot)
outputChatBox("Zakonczyles prace jako kurier!")
end
end
end)

addEventHandler("onClientPlayerQuit", resourceRoot, function()
setElementData(source, "graczPraca", false)
end)

addEventHandler("onClientPlayerWasted", resourceRoot, function()
setElementData(source, "graczPraca", false)
outputChatBox("Zginales podczas dorywczej pracy! Musisz zaczac od nowa!")
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
setElementData(localPlayer, "graczPraca", false)
end)



S-Side:
Kod:




vehiclePos = {
{-1796.9000244141,1417.4000244141,7.4000000953674,0,0,224}, --224
{-1796.9000244141,1422.1999511719,7.4000000953674,0,0,224},
{-1796.5999755859,1426.5,7.4000000953674,0,0,224},
{-1778.8000488281,1419.6999511719,7.4000000953674,0,0,130.99548339844}, ---- 130.99548339844
{-1778.8000488281,1424.8000488281,7.4000000953674,0,0,130.99548339844},
}

for k, v in pairs(vehiclePos) do
car = createVehicle(440, v[1], v[2], v[3], v[4], v[5], v[6])
setElementFrozen(car, true)
setElementData(car, "pojazd_paliwo", 100)
setElementData(car, "przebieg", math.random(100, 300))
setElementData(car, "pojazd_opis", "Ladunek : 0%")
setVehicleEngineState(car, false)
end

addEventHandler("onVehicleEnter", resourceRoot, function(plr, seat)
if seat == 0 then
if getElementData(plr, "graczPraca") == false then
setElementData(plr, "graczPraca", true)
setElementFrozen(source, false)
outputChatBox("Rozpoczales prace jako kurier, powodzenia!", plr)
triggerClientEvent(plr, "courier_job", resourceRoot)
else
outputChatBox("Aktualnie rozpocze?e? gdzie indziej juz prace!", plr)
end
end
end)


function checkVeh()
for k, v in pairs(getElementsByType("vehicle", resourceRoot)) do
if not getVehicleController(v) then
respawnVehicle(v)
setElementFrozen(v, true)
setElementData(car, "pojazd_opis", "Ladunek : 0%")
end
end
end
addEvent("checkCars", true)
addEventHandler("checkCars", resourceRoot, checkVeh)


addEvent("givePlayerMoney", true)
addEventHandler("givePlayerMoney", resourceRoot, function(ile)
givePlayerMoney(client, ile)
end)



Ostatnio zmieniony przez marcin778 2018-04-28, 20:24, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-24, 12:12


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Wydaje mi si? ?e nie wy?wietla si? ka?demu , lecz je?eli 1 osoba ko?czy prace to ko?czy j? ka?demu co na niej pracuje :)

Te? mam ten problem

PS: Z?y dzia? , napisz to w dziale lua.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-24, 12:55


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

C-side





destinationMarker nil 
destBlip nil 
reloadMarker createMarker(-1790.1999511719,1434.9000244141,7.19-0.9"corona"3.02540080unloadingPos = { -- Wszystko jest na terenie San Fierroale i tak sobie sami poustawiajcie i pododawajcie punkty. 
{-1805.08,999.21,24.89}, 
{-2016.65,970.11,45.56}, 
{-1955.51,1188.48,45.45}, 
{-1617.51,1074.92,7.19}, 
{-1581.15,865.56,7.60}, 
{-1742.3441162109,1263.7957763672,7.5272750854492}, 
{-1982.1995849609,1187.4477539063,45.4453125}, 
{-2164.7595214844,499.92376708984,35.171875}, 
{-2245.1525878906,100.93306732178,35.3203125}, 
{-2174.5046386719,-42.099849700928,35.312515258789}, 
{-2509.2961425781,-154.8053894043,25.6171875}, 
{-2612.8486328125,72.429824829102,4.3359375}, 
{-2628.8205566406,164.30363464355,4.328125}, 
{-2640.0778808594,257.89660644531,4.328125}, 
{-2671.9731445313,207.59413146973,4.3359375}, 
{-2339.3754882813,575.89239501953,27.724826812744}, 
{-2049.2268066406,510.87680053711,35.164112091064}, 
{-1967.1920166016,742.07867431641,45.4453125}, 
{-1723.3021240234,1041.0833740234,45.2109375}, 
} 


function endOfWork() 
if destinationMarker and isElement(destinationMarkerthen 
destroyElement(destinationMarkerdestinationMarker nil 
end 
if destBlip and isElement(destBlipthen 
destroyElement(destBlipdestBlip nil 
end 
end 


function takeFurniture(hemd) 
if he ~= localPlayer then return end 
if not getPedOccupiedVehicle(hethen return end 

local car getPedOccupiedVehicle(he) 

if getElementData(car"pojazd_opis") == "Ladunek : 0%" then 
setElementData(car"pojazd_opis""Ladunek : 100%"outputChatBox("Zaladowales pojazd meblami, jedz do wskazanego punktu, oznaczonego blipem 'C'"plrshowDestination() 
end 
end 
addEventHandler("onClientMarkerHit"reloadMarkertakeFurniture) 

function showDestination() 
local rand math.random(1#unloadingPos) 
local destMarker unloadingPos[randdestinationMarker createMarker(destMarker[1], destMarker[2], destMarker[3], "cylinder"2.525500130destBlip createBlipAttachedTo(destinationMarker12addEventHandler("onClientMarkerHit"destinationMarkerunloadFurnitureend 

function unloadFurniture(hemd) 
if he ~= localPlayer then return end 
if not getPedOccupiedVehicle(hethen return end 

local cash math.random(1530local carr getPedOccupiedVehicle(he) 

if getElementData(carr"pojazd_opis") == "Ladunek : 100%" then 
outputChatBox("Dojechales do celu! Wroc do magazynu po nowa przesylke!"plrsetElementData(carr"pojazd_opis""Ladunek : 0%"triggerServerEvent("givePlayerMoney"resourceRootcashendOfWork() 
else 
outputChatBox("Twoje auto nie jest zaladowane!"plrend 
end 



addEvent("courier_job"trueaddEventHandler("courier_job"resourceRoot, function() 
takeFurniture(hemdendaddEventHandler("onClientVehicleExit"resourceRoot, function(plrseat) 
if seat == 0 then 
if getElementData(source"pojazd_opis") == "Ladunek : 0%" or getElementData(source"pojazd_opis") == "Ladunek : 100%" then 
endOfWork() 
setElementData(plr"graczPraca"falsetriggerServerEvent("checkCars"resourceRootoutputChatBox("Zakonczyles prace jako kurier!"plrend 
end 
endaddEventHandler("onClientPlayerQuit"resourceRoot, function() 
setElementData(source"graczPraca"falseendaddEventHandler("onClientPlayerWasted"resourceRoot, function() 
setElementData(source"graczPraca"falseoutputChatBox("Zginales podczas dorywczej pracy! Musisz zaczac od nowa!"plrendaddEventHandler("onClientResourceStop"resourceRoot, function() 
setElementData(localPlayer"graczPraca"falseend


Postaw piwo autorowi tego posta
 

 
Tagi: powiadomienie :: zakończe
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