Lepiej zr?b marker z prac? po stronie serwera i z tego triggerowa? gui.
Tutaj jak usun?? blip w kt?ry gracz wjedzie (kod nie jest m?j,ale jest idealnym przyk?adem jak to zrobi?):
local missionBlip
local missionPickup
local missionVehicle
local missionTank
local function finishJob(missionValue)
if isElement(missionBlip) then
destroyElement(missionBlip)
missionBlip=nil
end
if isElement(missionMarker) then
destroyElement(missionMarker)
missionMarker=nil
end
if missionValue then
setElementData(localPlayer,"player:job",false) -- -v
triggerServerEvent("dune:stopJOB", localPlayer, missionVehicle) -- element daty, zrobione po to aby gracz nie mogl brac kilka prac na raz oraz aby nie mogl brac tej samej pracy 2x
missionVehicle=nil
missionMarker=nil
missionBlip=nil
end
end
Ostatnia rzecz to zabezpieczenie skryptu przed bugowaniem. Musisz dopisa? kod w kt?rym praca si? zako?czy gdy:
-gracz zginie
-wyjdzie z serwera
-'Wasted'
-wyjdzie z pojazdu
-kiedy praca(zas?b) zostanie zastopowany.
local marker = createMarker(87.25388, 1183.62219, 18.66406 - 2.4, "cylinder", 2, 102, 72, 225)
local wm={}
wm.window=guiCreateWindow(0.25, 0.26, 0.51, 0.42, "Praca dorywcza", true)
guiWindowSetSizable(wm.window, false)
guiWindowSetMovable(wm.window, false)
guiSetVisible(wm.window, false)
wm.elo=guiCreateLabel(0.02,0.1,0.94,0.92,"Egzampul egzampul",true,wm.window)
wm.button=guiCreateButton(0.57, 0.75, 0.39, 0.20, "Rozpocznij prac?!", true, wm.window)
wm.exit=guiCreateButton(0.040, 0.75, 0.39, 0.20, "Zamknij", true, wm.window)
addEventHandler("onClientMarkerHit",marker,function(el,md)
if not md or el~=localPlayer then return end
if guiGetVisible(wm.window) == false then
guiSetVisible(wm.window, true)
showCursor(true)
end
end)
function if2()
if guiGetVisible(wm.window) == true then
guiSetVisible(wm.window, false)
showCursor(false)
end
end
addEventHandler("onClientGUIClick", wm.button, if2)
function greetingCommand ( commandName )
triggerServerEvent("onTrigger", resourceRoot)
end
addEventHandler ( "onClientGUIClick", wm.button, greetingCommand )
function if3()
if guiGetVisible(wm.window) == true then
guiSetVisible(wm.window, false)
showCursor(false)
end
end
addEventHandler("onClientGUIClick", wm.exit, if3)
--wazniejsze
tablicaZpunktami = {
{-230.23724, 1202.44141, 19.59375},
}
rnd=punkt[math.random(#tablicaZpunktami )]
pmarker=createMarker(rnd[1], rnd[2], rnd[3], "checkpoint", 3, 255, 0, 0 )
pblip=createBlip(rnd[1], rnd[2], rnd[3], 12)
local missionBlip
local missionPickup
local missionVehicle
local missionTank
local function finishJob(missionValue)
if isElement(missionBlip) then
destroyElement(missionBlip)
missionBlip=nil
end
if isElement(missionMarker) then
destroyElement(missionMarker)
missionMarker=nil
end
if missionValue then
setElementData(localPlayer,"player:job",false) -- -v
missionVehicle=nil
missionMarker=nil
missionBlip=nil
end
end
W cliencie, ale nadal nie dzia?a, teraz nawet nie tworzy blipa.
Kuksss, Jak to ma dzia?a? jak skopiowa?e? wszystko co wklei?em z poprzedniego postu? To missionVale i reszte wywal to s? locale oraz tam dalej jest funkcja kt?ra ko?czy prac? oraz niszczy markery i blipy.
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