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

Wysłany: 2016-02-16, 22:01


Snapig

Amator LUA






Wiek: 28
Na forum: 3934 dni
Posty: 43
Nick w MP: Rother

Piwa: 129

Respekt: 50

Ostrzeżeń: 20%
A wiec tak, potrzebuje pomocy w skrypcie na prace. Poniewaz chcialbym by na F11 lub na Mini-mapce pokazywal mi sie $ prac. Teraz latwiej, pomozcie jaki kod dodac do skryptu i gdzie by pokazywalo znaczkiem $ prace :>> kod
Client
 
local districtsBus = {
{
-1985.46484375, 72.0615234375, 27.953262329102},
{-1987.7734375, 66.0009765625, 28.20802116394},
{-1982.232421875, 61.4873046875, 28.397748947144},
{-1975.87890625, 54.33984375, 28.820150375366},
{-1979.0498046875, 42.4169921875, 30.257034301758},
{-1987.0859375, 44.1552734375, 30.382406234741},
{-1992.884765625, 42.53515625, 31.611793518066},
{-1986.7724609375, 39.0703125, 31.022226333618},
{-1983.4111328125, 35.2568359375, 31.097345352173},
{-1978.9111328125, 29.7802734375, 31.77773475647},
{-1976.244140625, 40.6865234375, 30.465520858765},
{-1967.7197265625, 50.033203125, 29.339172363281},
{-1963.4794921875, 60.6533203125, 28.409980773926},
{-1963.546875, 66.1484375, 28.088659286499},
{-1968.9736328125, 67.52734375, 28.111268997192},
{-1968.015625, 73.3701171875, 27.749971389771},
{-1980.62890625, 71.923828125, 27.959045410156},
{-1992.4296875, 69.5458984375, 28.074096679688},
{-1993.462890625, 64.068359375, 28.889764785767},
{-1989.5576171875, 56.416015625, 29.259981155396},
{-1982.267578125, 59.7333984375, 28.471450805664},
{-1984.201171875, 73.5771484375, 27.889549255371},

}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
if jobMarker and isElement(jobMarker) then
destroyElement(jobMarker)
jobMarker = nil
end

if jobTarget and isElement(jobTarget) then
destroyElement(jobTarget)
jobTarget = nil
jobTarget = 0

end

triggerServerEvent("destroyVeh", localPlayer)

end


function busDriver(el, md)
if el ~= localPlayer or not md then return end
if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end

if jobTarget == #districtsBus then
finishJob()
playSoundFrontEnd(5)
outputChatBox("[Informacja] Zako?czy?e?/a? prac? kosiarek!")
else
showMarker()
playSoundFrontEnd(12)
triggerServerEvent("givePlayerMoney", localPlayer, 5, 0)
end
end

function showMarker()
if jobMarker and isElement(jobMarker) then
destroyElement(jobMarker)
jobMarker = nil
end

jobTarget = jobTarget + 1
jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4, 0, 0, 255)

if districtsBus[jobTarget+1] then
ile = districtsBus[jobTarget+1]
setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
end

addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
outputChatBox("[Informacja] Rozpocz??e?/a? prac? kosiarek!")
jobVehicle = veh
jobTarget = 0
showMarker()
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
if jobVehicle and getElementData(localPlayer, "gracz_praca") then
setElementData(localPlayer, "gracz_praca", false)
end
end)

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
if seat == 0 then
if plr == localPlayer then
finishJob()
outputChatBox("[Informacja] Zako?czy?e? prac?")
end
end
end) 


Server


local m1 = createMarker(-1998.69, 70.68, 28.62, "cylinder", 4.0, 255, 0, 0)
vehs = {}

addEvent("givePlayerMoney", true)
addEventHandler("givePlayerMoney", getRootElement(),function(ile)
givePlayerMoney(source, tonumber(ile))
end)

function removePreviousVehicles(plr)
for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
local sby = getElementData(v, "zrespilGracz")
if sby and sby == plr and getPedOccupiedVehicle(plr) ~= v then
destroyElement(v)
end
end
end

addEventHandler("onMarkerHit", m1, function(el, md)
if getElementData(el, "zrespilGracz") then
outputChatBox("[Informacja] Praca w trakcie poprawek", el)
return
end

if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end

local x,y,z = getElementPosition(el)
local bus = createVehicle(572, x,y,z,-1992.3388671875, 75.3896484375, 27.813388824463)

setElementData(bus, "zrespilGracz", el)
setElementData(bus, "pojazd_paliwo", 50)
setElementData(bus, "pojazd_przebieg", 100)

warpPedIntoVehicle(el, bus)
removePreviousVehicles(el)
triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)

vehs[el] = bus
end)

addEvent("STOPJobBus", true)
addEventHandler("STOPJobBus", resourceRoot, function()
local pojazd = getPedOccupiedVehicle(localPlayer)
if pojazd then
destroyElement(pojazd)
end
end)

addEvent("destroyVeh", true)
addEventHandler("destroyVeh", getRootElement(),
function()
if vehs[source] then
if isElement(vehs[source]) then destroyElement(vehs[source]) end
end
end) 


Ostatnio zmieniony przez Snapig 2016-02-16, 22:03, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-16, 22:02


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 | .
Dodaj to do kodu:
local blip = createBlip(-1998.69, 70.68, 28.62, 52)

Oboj?tnie czy dasz po stronie servera, czy clienta.

Podpis

Użytkownik: 20.10.2015r
GTAO Member: 06.03.2016r
Support-Team: 20.01.2016r
Moderator: 30.03.2016r
Mod-Team: 08.10.2016r
Vice Admin: 04.05.2018r
Administrator: 03.05.2022r


! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-16, 22:05


Snapig

Amator LUA






Wiek: 28
Na forum: 3934 dni
Posty: 43
Nick w MP: Rother

Piwa: 129

Respekt: 50

Ostrzeżeń: 20%
Emm, a chcialbym sie jeszcze zapytac o 2 sprawy bo nie chce robic kolejnych watkow (spam). A wiec tak ta linijka moze byc na srodku na poczatku na koncu i nie trzeba do tego end ?. KOlejne jak zrobic (jest to po stronie c (kordy)) by te kordy pokazywaly sie losowa. Okej z gory thx

Podpis
Jeżeli Ci pomogłem daj Piwko ;piwo;
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-16, 22:35


mlodasnygo







Wiek: 17
Na forum: 4114 dni
Posty: 205

Piwa: 518

Respekt: 161,8
Respekt: 161,8Respekt: 161,8

1.Ta linijka z blipem (znacznikiem) moze byc nawet w innym pliku :D
2.Nawet tego nie oplaca sie przerabiac, gdyz ten caly kod jest zrobiony wlasnie pod to "od markera do markera" :mrgreen:

Pozdrawiam ;) ;)

A i nie trzeba ?adnego end u :)

Podpis
600 dni - 10 marca 2017
:piwo: 500 piw :piwo: - 10 marca 2017
Postaw piwo autorowi tego posta
 

 
Tagi: znacznik :: (praca)
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