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

Wysłany: 2017-03-04, 00:08


pelikantPL







Wiek: 31
Na forum: 4111 dni
Posty: 2
Nick w MP: PisiuToZiomal



Respekt: 50

Witam ! Mam problem ot?? mam prace StreetView kt?ra nie dodaje saldo na koncie to wyskakuje w debugscript : http://imgur.com/a/dQ59h

Kod:

server:

Kod:

local b=createElement("text")
setElementData(b,"name","PRACA: Kierowca StreetView\nZAROBEK:\nGRACZ 3500-8000PLN | PREMIUM 8000-13000 PLN\nOPIS: Identyfikowanie mapy")
setElementPosition(b,-1990.65,957.23,45.45)

local zone = createColCuboid(-1989.4969482422, 949.93933105469, 44.349185943604, 5.9, 8.3, 4.5)

createBlip(-1990.14,951.21,45.45, 46,2,0,0,0,0,0,275)

local m1 = createMarker(-1990.65,957.23,45.45-1, "cylinder", 1.5, 35, 142, 35)
vehs = {}


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("Praca w trakcie przygotowania.", el)
return
end

if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("* Parking zaj?ty czekaj a? wyjedzie!",el) return end

local x,y,z = getElementPosition(el)
local bus = createVehicle(400, -1986.77, 955.08, 45.17, 0.0, 0.0, 180.1)

setElementData(bus,"vehicle:desc","Kierowca StreevView\n! Prosz? Zachowa? Ostro?no?? !")
setElementData(bus, "zrespilGracz", el)
setElementData(bus, "vehicle:fuel", 100)
setElementData(bus, "vehicle:mileage", math.random(12978,109237))
setVehiclePlateText(bus, " PRACA" )
setVehicleColor(bus, 0, 96, 255 )

setVehicleHandling(bus,"maxVelocity", 100.00) -- 40 + 10 = 50km/h

warpPedIntoVehicle(el, bus)
removePreviousVehicles(el)
triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)
setVehicleHandling(bus,"maxVelocity", 100.00) -- 40 + 10 = 50km/h

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)

addEventHandler("onPlayerVehicleExit",resourceRoot,function()
destroyElement(source)
end)

addEventHandler("onElementDestroy",resourceRoot,function()
if getElementType(source) == "vehicle" then
if veh_obj[source] then destroyElement(veh_obj[source]); veh_obj[source] = nil end
end
end)

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


client:

Kod:

local districtsBus = {

{-1986.92, 935.31, 45.30},
{-2002.48, 924.51, 45.30},
{-2008.31, 887.55, 45.30},
{-2008.17, 834.59, 45.30},
{-2007.89, 759.92, 45.30},
{-1984.33, 728.10, 45.30},
{-1913.74, 727.53, 45.30},
{-1895.93, 758.23, 45.30-0.2},
{-1895.81, 814.11, 35.51-0.4},
{-1895.44, 867.77, 35.02},
{-1895.12, 909.97, 35.02},
{-1868.51, 920.64, 35.02},
{-1814.47, 920.15, 24.74},
{-1790.50, 957.41, 24.73},
{-1790.08, 1042.79, 31.16-1},
{-1790.48, 1092.34, 45.30},
{-1747.34, 1100.14, 45.29},
{-1710.80, 1122.96, 44.09-0.8},
{-1710.91, 1170.81, 25.47-0.5},
{-1738.79, 1191.10, 24.98},
{-1806.16, 1190.50, 24.97},
{-1864.76, 1181.62, 44.22-0.8},
{-1941.06, 1181.27, 45.30},
{-1968.86, 1134.57, 50.21-0.4},
{-1969.36, 1079.88, 55.57},
{-1929.44, 1051.48, 50.92-0.3},
{-1888.07, 1040.56, 45.18-0.3},
{-1898.95, 973.68, 35.02},
{-1911.91, 934.74, 35.03-0.2},
{-1957.99, 934.49, 43.10-0.4},
{-1979.58, 941.75, 45.45-0.2},
{-1980.02, 955.66, 45.45-0.1},

}

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("* Zako?czy?e?(a?) prac?.")
else

local kasa = math.random(8000,13000)

showMarker()
playSoundFrontEnd(12)
if getElementData(el,"player:premium") then
outputChatBox("Otrzymujesz "..kasa.." PLN za zidentyfikowanie punktu.")
setElementData(el,"player:reputation", getElementData(el,"player:reputation")+math.random(0,1))
triggerServerEvent("givePlayerMoney", localPlayer, kasa)
else

local kasa2 = math.random(3500,8000)

outputChatBox("* Zidentyfikowa?e?(a?) punkt z drogi i otrzymujesz PLN.")
setElementData(el,"player:reputation", getElementData(el,"player:reputation")+math.random(0,1))
triggerServerEvent("givePlayerMoney", localPlayer, kasa2)
outputChatBox("Otrzymujesz "..kasa2.." PLN za zidentyfikowanie punktu.")
end
end
end

function showMarker()
if jobMarker and isElement(jobMarker) then
--outputChatBox("* Sprz?tn??e?(a?) ?mieci z drogi i otrzymujesz 16 PLN.")
--if getElementData(localPlayer,"player:premium") then
--outputChatBox("* Sprz?tn??e?(a?) ?mieci z drogi i otrzymujesz 32 PLN.",localPlayer)
--triggerServerEvent("givePlayerMoney", localPlayer, 32, 0)
--else
--outputChatBox("* Sprz?tn??e?(a?) ?mieci z drogi i otrzymujesz 16 PLN.",localPlayer)
--triggerServerEvent("givePlayerMoney", localPlayer, 16, 0)
destroyElement(jobMarker)
jobMarker = nil
end

jobTarget = jobTarget + 1
jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 1.75, 255, 255, 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("* Rozpocz??e?(a?) prac?.")
jobVehicle = veh
jobTarget = 0
showMarker()
end)

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

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
if seat == 0 then
if plr == localPlayer then
finishJob()
outputChatBox("* Zako?czy?e?(a?) prac?.")
end
end
end)


Za pomoc zimne :arrow: :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-04, 11:01


DylemaT929

Nikt






Wiek: 28
Na forum: 4182 dni
Posty: 340
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

usu? to

local kasa = math.random(8000,13000) 


a to zmien na


triggerServerEvent("givePlayerMoney", localPlayer, kasa) 

na

triggerServerEvent("givePlayerMoney", localPlayer, 10)



potem


outputChatBox("Otrzymujesz "..kasa.." PLN za zidentyfikowanie punktu.") 


na

outputChatBox("Otrzymujesz 20 PLN za zidentyfikowanie punktu.")


NIe wiem czy daje ci dwa razy wi?cej wi?c jest 10 PLN a otrzymasz 20PLN. Zobacz czy dzia?a

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-04, 12:26


pelikantPL







Wiek: 31
Na forum: 4111 dni
Posty: 2
Nick w MP: PisiuToZiomal



Respekt: 50

Ale ja chcia?bym ?eby premium dostawa?o wi?cej i ?eby dostawa? np 8000-8463-9345-10345 :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-04, 12:47


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

DylemaT929, B??d jest w dodawaniu reputacji....

local districtsBus = { 

{-1986.92, 935.31, 45.30}, 
{-2002.48, 924.51, 45.30}, 
{-2008.31, 887.55, 45.30}, 
{-2008.17, 834.59, 45.30}, 
{-2007.89, 759.92, 45.30}, 
{-1984.33, 728.10, 45.30}, 
{-1913.74, 727.53, 45.30}, 
{-1895.93, 758.23, 45.30-0.2}, 
{-1895.81, 814.11, 35.51-0.4}, 
{-1895.44, 867.77, 35.02}, 
{-1895.12, 909.97, 35.02}, 
{-1868.51, 920.64, 35.02}, 
{-1814.47, 920.15, 24.74}, 
{-1790.50, 957.41, 24.73}, 
{-1790.08, 1042.79, 31.16-1}, 
{-1790.48, 1092.34, 45.30}, 
{-1747.34, 1100.14, 45.29}, 
{-1710.80, 1122.96, 44.09-0.8}, 
{-1710.91, 1170.81, 25.47-0.5}, 
{-1738.79, 1191.10, 24.98}, 
{-1806.16, 1190.50, 24.97}, 
{-1864.76, 1181.62, 44.22-0.8}, 
{-1941.06, 1181.27, 45.30}, 
{-1968.86, 1134.57, 50.21-0.4}, 
{-1969.36, 1079.88, 55.57}, 
{-1929.44, 1051.48, 50.92-0.3}, 
{-1888.07, 1040.56, 45.18-0.3}, 
{-1898.95, 973.68, 35.02}, 
{-1911.91, 934.74, 35.03-0.2}, 
{-1957.99, 934.49, 43.10-0.4}, 
{-1979.58, 941.75, 45.45-0.2}, 
{-1980.02, 955.66, 45.45-0.1}, 

} 

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("* Zako?czy?e?(a?) prac?.") 
else 

local kasa = math.random(8000,13000)
local reputacja = getElementData(el,"player:reputation")

showMarker() 
playSoundFrontEnd(12) 
if getElementData(el,"player:premium") then 
outputChatBox("Otrzymujesz "..kasa.." PLN za zidentyfikowanie punktu.") 
setElementData(el,"player:reputation", reputacja+1) 
triggerServerEvent("givePlayerMoney", localPlayer, kasa) 
else 

local kasa2 = math.random(3500,8000) 

outputChatBox("* Zidentyfikowa?e?(a?) punkt z drogi i otrzymujesz PLN.") 
setElementData(el,"player:reputation", reputacja+1) 
triggerServerEvent("givePlayerMoney", localPlayer, kasa2) 
outputChatBox("Otrzymujesz "..kasa2.." PLN za zidentyfikowanie punktu.") 
end 
end 
end 

function showMarker() 
if jobMarker and isElement(jobMarker) then 
--outputChatBox("* Sprz?tn??e?(a?) ?mieci z drogi i otrzymujesz 16 PLN.") 
--if getElementData(localPlayer,"player:premium") then 
--outputChatBox("* Sprz?tn??e?(a?) ?mieci z drogi i otrzymujesz 32 PLN.",localPlayer) 
--triggerServerEvent("givePlayerMoney", localPlayer, 32, 0) 
--else 
--outputChatBox("* Sprz?tn??e?(a?) ?mieci z drogi i otrzymujesz 16 PLN.",localPlayer) 
--triggerServerEvent("givePlayerMoney", localPlayer, 16, 0) 
destroyElement(jobMarker) 
jobMarker = nil 
end 

jobTarget = jobTarget + 1 
jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 1.75, 255, 255, 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("* Rozpocz??e?(a?) prac?.") 
jobVehicle = veh 
jobTarget = 0 
showMarker() 
end) 

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

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat) 
if seat == 0 then 
if plr == localPlayer then 
finishJob() 
outputChatBox("* Zako?czy?e?(a?) prac?.") 
end 
end 
end)


Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Tagi: bug :: pracą
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Bug z pracą 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