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

Wysłany: 2020-05-11, 15:32


RAPsy







Wiek: 26
Na forum: 2489 dni
Posty: 11
Nick w MP: Cieciu

Piwa: 15

Respekt: 45,3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-11, 16:24


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Pr?bujesz por?wna? nieistniej?ce dane z liczbami etc. Wklej kod i wska? te linijki z b??d?w.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-11, 21:02


RAPsy







Wiek: 26
Na forum: 2489 dni
Posty: 11
Nick w MP: Cieciu

Piwa: 15

Respekt: 45,3

Kod:

local function deleteElements(text, color)
guiGridListClear(data.gridlist[1])
showCursor(not isCursorShowing(), false)
guiSetVisible(data.window[1], not guiGetVisible(data.window[1]))

if text and color then
outputChatBox(text, color[1], color[2], color[3], true)
end
end

local function checkPlayerVehicle(player)
local vehicle = player.vehicle
if vehicle and vehicle.controller == player then
if vehicle:getData("vehicle:id") and vehicle.model == 482 or vehicle.model == 413 then
return true
end
end
return false, outputChatBox("Tw?j pojazd nie jest pojazdem dostawczym albo prywatnym!", 255, 0, 0, true)
end

_fadeCamera = fadeCamera
local function fadeCamera(option, player)
if player:getData("player:premium") then timestamp = 6000 else timestamp = 10000 end
local vehicle = player.vehicle

if option == "commencement" then
_fadeCamera(false, 1, 0, 0, 0)
addEventHandler("onClientRender",root,render)
setElementData(player,"player:hud_visible",true)
showChat(false)
vehicle.frozen = not vehicle.frozen

Timer(function()
_fadeCamera(true, 1)
vehicle.frozen = not vehicle.frozen
renderstop()
showChat(true)
setElementData(player,"player:hud_visible",false)
end, timestamp, 1)
elseif option == "end" then
_fadeCamera(false, 1, 0, 0, 0)
addEventHandler("onClientRender",root,render2)
setElementData(player,"player:hud_visible",true)
showChat(false)
vehicle.frozen = not vehicle.frozen

Timer(function()
_fadeCamera(true, 1)
vehicle.frozen = not vehicle.frozen
vehicle:setData("vehicle:desc",false)
triggerServerEvent("remove3DTextFromElement", root, vehicle)
renderstop2()
showChat(true)
setElementData(player,"player:hud_visible",false)
local data = player:getData("player:order")
if data then
outputChatBox("Otrzymujesz "..data.received.." + 1 score pracy!", 0, 255, 0, true)
end
triggerServerEvent("iyw_kurier:give_cash", resourceRoot, string.gsub(data.received, "PLN", ""))

if isElement(sphere) and isElement(blip) then
blip:destroy()
sphere:destroy()
end

player:setData("player:order", false)
end, timestamp, 1)
end
end

addEventHandler("onClientMarkerHit", resourceRoot, function(player, dimension)
if player == localPlayer and dimension then
if source:getData("marker:loading") then
local vehicle = player.vehicle
if not vehicle or vehicle.controller ~= player then return false end

if not player:getData("player:order") then
if checkPlayerVehicle(player) then
for i,v in ipairs(data.order) do
guiGridListAddRow(data.gridlist[1])
guiGridListSetItemText(data.gridlist[1], i-1, 1, i, false, false)
guiGridListSetItemText(data.gridlist[1], i-1, 2, v[1], false, false)
guiGridListSetItemText(data.gridlist[1], i-1, 3, string.format("%.00f PLN", v[2]), false, false)
guiGridListSetItemText(data.gridlist[1], i-1, 4, tonumber(v[3]), false, false)
end

showCursor(not isCursorShowing(), false)
guiSetVisible(data.window[1], not guiGetVisible(data.window[1]))
guiSetText(data.window[1], "Praca spedytora - ilo?? score: "..player:getData("player:scorespedytor").."")
end
end
end
end
end)

addEventHandler("onClientMarkerLeave", resourceRoot, function(player, dimension)
if player == localPlayer and dimension then
if source:getData("marker:loading") then
local vehicle = player.vehicle
if not vehicle then return false end

if guiGetVisible(data.window[1]) then
deleteElements(_,_)
end
end
end
end)

addEventHandler("onClientVehicleExit", root, function(player, seat)
if player == localPlayer and seat then
if player:getData("player:order") then
player:setData("player:order", false)
outputChatBox("Opu?ci?e?(a?) pojazd maj?c aktywny kurs, praca zostaje przerwana.", 255, 0, 0, true)
if isElement(sphere) or isElement(blip) then
sphere:destroy()
blip:destroy()
end
end
end
end)

addEventHandler("onClientGUIClick", resourceRoot, function(button, state)
if button == "left" and state == "up" then
if source == data.button[1] then
local selected = guiGridListGetSelectedItem(data.gridlist[1]) or -1
if selected < 0 then return false, outputChatBox("Najpierw zaznacz towar!", 255, 0, 0, true) end

local id = guiGridListGetItemText(data.gridlist[1], selected, 1)
local name = guiGridListGetItemText(data.gridlist[1], selected, 2)
local money = guiGridListGetItemText(data.gridlist[1], selected, 3)
local score = guiGridListGetItemText(data.gridlist[1], selected, 4)
local v = getPedOccupiedVehicle (localPlayer)

if (tonumber(localPlayer:getData("player:scorespedytor")) >= tonumber(score)) then
randomResult = math.random (1, #data.marker)

local position = {getElementPosition(localPlayer)}
if getDistanceBetweenPoints3D(position[1], position[2], position[3], data.marker[randomResult][1], data.marker[randomResult][2], data.marker[randomResult][3]) <= 20 then
outputChatBox("Wylosowano bliski marker, sp?buj ponownie!", 255, 0, 0, true)
else
fadeCamera("commencement", localPlayer)
deleteElements("Podj??e? zlecenie o nazwie "..string.lower(name)..", udaj si? do punktu na mapie oznaczonym blipem 'C'!", {0, 255, 0})
localPlayer:setData("player:order", {["name"] = string.lower(name), ["received"] = money})
v:setData("vehicle:desc","Praca spedytora\nZa?adunek: "..name.."")
triggerServerEvent("add3DTextForElement", root, v,{0,0,0},"Praca spedytora\nZa?adunek: "..name.."",{255,255,255,255},"czcionka4",1.0,30,1)
sphere = ColShape.Sphere(data.marker[randomResult][1], data.marker[randomResult][2], data.marker[randomResult][3], 3.50)
blip = createBlipAttachedTo(sphere, 0, 6, 255, 0, 0, 255, 0, 99999.0)
end

addEventHandler("onClientColShapeHit", resourceRoot, function(player, dimension)
if player == localPlayer and dimension then
if source == sphere then
fadeCamera("end", player)
end
end
end)
else
return false, outputChatBox("Nie posiadasz tyle punkt?w! ("..score.." score)", 255, 0, 0, true)
end
elseif source == data.button[2] then
deleteElements(_,_)
end
end
end)

mojeW,mojeH = 1366, 768
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)

function render()
dxDrawImage(433*w, 259*h, 500*w, 200*h, "img/zaladunek.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
end

function render2()
dxDrawImage(433*w, 259*h, 500*w, 200*h, "img/rozladunek.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
end

function renderstop()
removeEventHandler("onClientRender",root,render)
end

function renderstop2()
removeEventHandler("onClientRender",root,render2)
end


[ Dodano: 2020-05-11, 21:03 ]
Kod:

guiSetText(data.window[1], "Praca spedytora - ilo?? score: "..player:getData("player:scorespedytor").."") (((((((( LINJKA 89 )))))))))))))


Kod:

if (tonumber(localPlayer:getData("player:scorespedytor")) >= tonumber(score)) then ((((((LINJKA 134))))))))


Ostatnio zmieniony przez RAPsy 2020-05-11, 21:05, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-11, 21:05


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Nie masz element daty "player:scorespedytor".

Dodaj warunek "or 0" obok pobierania albo po prostu ustawiaj graczowi gdzie? tak? konkretn? element dat?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-11, 21:06


RAPsy







Wiek: 26
Na forum: 2489 dni
Posty: 11
Nick w MP: Cieciu

Piwa: 15

Respekt: 45,3

"Wilq" napisał/a:

Nie masz element daty "player:scorespedytor".

Dodaj warunek "or 0" obok pobierania albo po prostu ustawiaj graczowi gdzie? tak? konkretn? element dat?.


w jakiej linijce

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-12, 08:28


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Linijce 89 i 134, bo chyba w tych b??d by? tak?

Postaw piwo autorowi tego posta
 

 
Tagi: nie :: dziala :: praca :: spedytora
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » nie dziala praca spedytora Odpowiedz do tematu

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