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

Wysłany: 2019-01-24, 23:01


Fl!k







Wiek: 26
Na forum: 3733 dni
Posty: 162

Piwa: 18

Respekt: 50

Witam wgralem paczke NewPlace na moj serwer lecz gdy wchodze np. do pracy autobusu nie respi mi pojazdu , w magazynierze nie daje skrzyn!

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-24, 23:34


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Poka? kod, jakie? b??dy /debugscript 3, wszystkie skrypty w??czone?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-24, 23:46


Adaskokieblasko







Wiek: 23
Na forum: 3095 dni
Posty: 101

Piwa: 18

Respekt: 100
Respekt: 100

Musisz poprawi? triggery we wszystkich pracach z NewPlace'a (( sam korzysta?em z tej paczki i mia?em ten sam b??d starczy czysta zmiana nazw trigger?w ))

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-25, 15:12


Fl!k







Wiek: 26
Na forum: 3733 dni
Posty: 162

Piwa: 18

Respekt: 50

A co to ten triger?

[ Dodano: 2019-01-25, 15:17 ]
Pokaza? by? mi wz?r jak to zrobi? :D ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-25, 15:27


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8


Więcej informacji znajdziesz w Wikipedii MTA:

triggerClientEvent


Więcej informacji znajdziesz w Wikipedii MTA:

triggerServerEvent


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-25, 16:05


Fl!k







Wiek: 26
Na forum: 3733 dni
Posty: 162

Piwa: 18

Respekt: 50

Czyli ze jak? nazwe mam pozmieniac?

c.lua
--[[
    Autor: Malentas
]]

local sx, sy = guiGetScreenSize()
local px, py = sx/1440, sy/900
local okno1 = false
local ulepszenia = false

local pracodawca = createPed(17, 1053.40, 1744.49, 10.82, 360)
setElementData(pracodawca, "name", "Pracodawca")
setElementDimension(pracodawca, 0)
setElementFrozen(pracodawca, true)
local rozpoczecie = createMarker(1053.61, 1746.68, 9.92, "cylinder", 1, 255, 255, 255)
setElementData(rozpoczecie, "praca", true)
setElementDimension(rozpoczecie, 0)


addEventHandler("onClientMarkerHit", rozpoczecie, function(gracz)
    if gracz ~= localPlayer then return end
    if getPedOccupiedVehicle(localPlayer) then return end
    if getElementDimension(source) ~= getElementDimension(localPlayer) then return end
    if getElementData(localPlayer, "block:prawko") then exports["np-notyfikacje"]:noti("Posiadasz zabrane prawo jazdy kat. A, B, C", "error") return end
    if getElementData(localPlayer, "punkty") < 300 then exports["np-notyfikacje"]:noti("Nie posiadasz 700 punkt?w reputacji!", "error") return end
    if getElementData(localPlayer, "prawko_c") ~= 1 then exports["np-notyfikacje"]:noti("Nie posiadasz prawa jazdy kat.c!", "error") return end
    if getElementData(localPlayer, "pracuje") then
        if getElementData(localPlayer, "pracuje") ~= "autobusy" then exports["np-notyfikacje"]:noti("Posiadasz inn? aktywn? prace!", "error") return end
    end
    addEventHandler("onClientRender", root, guistart)
    okno1 = true
    showCursor(true)
    triggerServerEvent("pokazTopke:autobusy:source", localPlayer)
end)

local font = dxCreateFont("cz.ttf", 10)
local font2 = dxCreateFont("cz.ttf", 12)

local pracownicy = { }

local listaulepszen = {
    {"Du?y autobus", "Dzi?ki temu zarabiasz wi?cej i je?dzisz po ca?ym SA", 1000, "dolar.png"},
    {"Zarobek +5%", "Dzi?ki temu ulepszeniu zarabiasz wi?cej o 5%", 700, "dolar.png"},
}


function guistart()
    dxDrawImage(scale_x(402), scale_y(251), scale_x(637), scale_y(399), ":np-gui/grafiki/tlo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    if ulepszenia == false then
       local punkty = getElementData(localPlayer, "apunkty") or 0
       local zlecenia = getElementData(localPlayer, "azlecenia") or 0
        shadowText("Praca przewozu osob", scale_x(401), scale_y(251), scale_x(1039), scale_y(295), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        --shadowText("Wymagania:\nBRAK", scale_x(401), scale_y(295), scale_x(719), scale_y(449), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        shadowText("Kursy: "..zlecenia.."\nPunkty: "..punkty.."", scale_x(402), scale_y(510), scale_x(719), scale_y(646), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        shadowText("Top pracownicy:", scale_x(719), scale_y(295), scale_x(1036), scale_y(329), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        dxDrawImage(scale_x(415), scale_y(310), scale_x(304), scale_y(175), ":np-magazynier/grafiki/bg6.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        shadowText("Wymagania: 300 RP, Kat. C", scale_x(415), scale_y(500), scale_x(719), scale_y(548), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        if mysz(scale_x(889), scale_y(592), scale_x(139), scale_y(44)) then
           dxDrawImage(scale_x(889), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_on.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        else
           dxDrawImage(scale_x(889), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_off.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        end
        if mysz(scale_x(729), scale_y(592), scale_x(139), scale_y(44)) then
           dxDrawImage(scale_x(729), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_on.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        else
           dxDrawImage(scale_x(729), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_off.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        end
        if getElementData(localPlayer, "pracuje") == "autobusy" then
           shadowText("Zako?cz prace", scale_x(728), scale_y(591), scale_x(868), scale_y(636), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        else
           shadowText("Rozpocznij prace", scale_x(728), scale_y(591), scale_x(868), scale_y(636), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        end
        shadowText("Ulepszenia", scale_x(888), scale_y(592), scale_x(1028), scale_y(637), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        dxDrawImage(scale_x(1010), scale_y(261), scale_x(16), scale_y(16), ":guieditor/images/cross.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        shadowText("Nickname:", scale_x(729), scale_y(329), scale_x(880), scale_y(363), tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
        shadowText("Kursy:", scale_x(877), scale_y(329), scale_x(1028), scale_y(363), tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)

        for i, v in ipairs(pracownicy) do
           local dodatekY = (scale_y(37))*(i-1)
           local dodatekY2 = (scale_y(74))*(i-1)

           dxDrawRectangle(scale_x(729), scale_y(363) + dodatekY, scale_x(299), scale_y(35), tocolor(0, 0, 0, 120), false)
           shadowText(v.nick, scale_x(729), scale_y(364) + dodatekY2, scale_x(877), scale_y(398), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
           shadowText(v.liczba, scale_x(880), scale_y(364) + dodatekY2, scale_x(1028), scale_y(398), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        end
    else
        local punkty = getElementData(localPlayer, "apunkty") or 0
        shadowText("Kupno ulepszen", scale_x(401), scale_y(251), scale_x(1039), scale_y(295), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        dxDrawImage(scale_x(1011), scale_y(262), scale_x(16), scale_y(16), ":np-gui/grafiki/cofnij.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Posiadasz: "..punkty.." punkt?w", scale_x(402), scale_y(582), scale_x(1037), scale_y(648), tocolor(0, 255, 0, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        for i, v in ipairs(listaulepszen) do
            local dodatekY = (scale_y(72))*(i-1)
            local dodatekY2 = (scale_y(144))*(i-1)

            dxDrawRectangle(scale_x(417), scale_y(297)+dodatekY, scale_x(610), scale_y(70), tocolor(0, 0, 0, 120), false)
            dxDrawImage(scale_x(432), scale_y(307)+dodatekY, scale_x(50), scale_y(50), ":np-magazynier/grafiki/"..v[4].."", 0, 0, 0, tocolor(255, 255, 255, 255), false)
            shadowText(v[1], scale_x(501), scale_y(297)+dodatekY2, scale_x(874), scale_y(332), tocolor(255, 255, 255, 255), 1.00, font2, "left", "center", false, false, false, false, false)
            shadowText(v[2], scale_x(501), scale_y(332)+dodatekY2, scale_x(874), scale_y(367), tocolor(255, 255, 255, 255), 1.00, font, "left", "center", false, false, false, false, false)
            if mysz(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38)) then
                dxDrawImage(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38), ":np-gui/grafiki/button_on.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
            else
                dxDrawImage(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38), ":np-gui/grafiki/button_off.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
            end
            shadowText("Zakup", scale_x(904), scale_y(312)+dodatekY2, scale_x(1017), scale_y(350), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
            shadowText("Cena: "..v[3].."p", scale_x(781), scale_y(297)+dodatekY2, scale_x(894), scale_y(335), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        end
    end
end

addEventHandler("onClientClick", root, function(btn, state)
  if btn == "left" and state == "down" then
    if mysz(scale_x(729), scale_y(592), scale_x(139), scale_y(44)) and okno1 == true and ulepszenia == false then
        if getElementData(localPlayer, "pracuje") == "autobusy" then
            zakonczprace()
        else
            rozpocznijprace()
        end
    elseif mysz(scale_x(889), scale_y(592), scale_x(139), scale_y(44)) and okno1 == true and ulepszenia == false then
        ulepszenia = true
    elseif mysz(scale_x(1010), scale_y(261), scale_x(16), scale_y(16)) and okno1 == true and ulepszenia == false then
        removeEventHandler("onClientRender", root, guistart)
        okno1 = false
        showCursor(false)
    elseif mysz(scale_x(1011), scale_y(262), scale_x(16), scale_y(16)) and okno1 == true and ulepszenia == true then
        ulepszenia = false
    end
    for i, v in ipairs(listaulepszen) do
        local dodatekY = (scale_y(72))*(i-1)
        if mysz(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38)) and okno1 == true and ulepszenia == true then
            local punkty = getElementData(localPlayer, "apunkty") or 0
            if punkty < tonumber(v[3]) then exports["np-notyfikacje"]:noti("Posiadasz za ma?o punkt?w by zakupi? to ulepszenie", "error") return end
            if v[1] == "Du?y autobus" then 
                if getElementData(localPlayer, "autobusy:ulepszenie1") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "autobusy:ulepszenie1", 1)
            elseif v[1] == "Zarobek +5%" then
                if getElementData(localPlayer, "autobusy:ulepszenie2") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "autobusy:ulepszenie2", 1)
            end
            exports["np-notyfikacje"]:noti("Zakupujesz ulepszenie: "..v[1])
            setElementData(localPlayer, "apunkty", punkty-tonumber(v[3]))
        end
    end
  end
end)

addEvent("pokazTopke:autobusy:client", true)
addEventHandler("pokazTopke:autobusy:client", root, function(tabelka)
  pracownicy = tabelka
end)

-- praca

local bileciki = true
local trzymam1 = false
local trzymam2 = false
local bilet = false
local klienci = 0
local sprzedane = 0

local markers = {
    [1] = {
        [1] = {
        {1087.16, 1773.27, 10.91, 1},
        {1053.76, 1815.64, 10.67},  
        {1010.27, 1832.45, 10.67, 1},
        {1009.94, 1880.96, 10.67},
        {1009.55, 1924.89, 10.67},
        {1009.96, 1991.11, 10.67, 1},
        {1009.89, 2034.55, 10.67},
        {1044.43, 2050.67, 10.67},
        {1129.28, 2050.57, 10.67, 1},
        {1201.87, 2050.46, 13.55},
        {1282.72, 2050.97, 10.67},
        {1294.74, 2007.45, 10.67, 1},
        {1297.68, 1955.62, 10.67},
        {1331.71, 1950.79, 10.67},
        {1375.38, 1952.18, 10.67},
        {1384.83, 1919.90, 10.67, 1}, 
        {1386.44, 1878.71, 10.83},
        {1474.15, 1870.90, 10.67},
        {1545.98, 1871.03, 10.67},
        {1626.76, 1870.82, 10.67},
        {1709.24, 1880.88, 10.67},
        {1709.46, 1986.94, 10.67},
        {1745.63, 2050.25, 10.74, 1}, 
        {1820.35, 2050.11, 10.83},
        {1908.39, 2038.97, 10.67, 1},
        {1936.68, 2019.99, 10.67},
        {2015.92, 2019.78, 10.67},
        {2116.02, 2018.59, 10.74},
        {2125.12, 1965.19, 10.70},
        {2119.96, 1933.90, 10.67, 1},
        {2125.28, 1881.92, 10.67},
        {2091.93, 1795.81, 10.67},
        {2054.69, 1722.42, 10.67},
        {2038.80, 1658.72, 10.67, 1},
        {2046.04, 1598.01, 10.67},
        {2045.71, 1487.81, 10.67},
        {2046.28, 1364.67, 10.67},
        {2039.48, 1322.15, 10.67, 1},
        {2046.13, 1237.65, 10.67},
        {2045.70, 1091.87, 10.67},
        {2044.31, 981.60, 10.64},
        {2039.55, 940.42, 9.76, 1},
        {2051.67, 867.11, 6.83},
        {2090.88, 837.18, 6.74},
        {2367.12, 831.62, 6.73},
        {2550.50, 853.31, 6.73},
        {2696.08, 988.21, 6.73},
        {2728.79, 1291.64, 6.73},
        {2765.10, 1394.63, 8.56},
        {2779.66, 1476.00, 10.67},
        {2677.16, 1475.75, 12.08},
        {2622.97, 1476.36, 10.66, 1},
        {2525.31, 1475.23, 10.67},
        {2458.76, 1475.89, 10.67, 1},
        {2429.73, 1507.44, 10.67},
        {2429.70, 1578.45, 10.67},
        {2405.71, 1615.78, 10.67},
        {2351.05, 1615.13, 10.67, 1},
        {2329.79, 1646.30, 10.67},
        {2329.70, 1715.55, 10.83},
        {2329.91, 1757.90, 10.67},
        {2292.60, 1775.74, 10.67},
        {2154.41, 1775.43, 10.67},
        {2119.33, 1801.97, 10.67},
        {2149.77, 2123.34, 10.67},
        {2152.42, 2248.20, 10.67},
        {2229.41, 2398.64, 10.67},
        {2208.91, 2455.83, 10.67},
        {2128.16, 2455.53, 10.67, 1},
        {2041.53, 2455.58, 10.67},
        {2025.06, 2416.51, 10.67},
        {2005.17, 2395.73, 10.67},
        {1965.57, 2396.28, 10.67, 1},
        {1924.81, 2378.84, 10.67},
        {1924.89, 2316.70, 10.67, 1},
        {1884.00, 2275.60, 10.67},
        {1794.35, 2275.61, 12.48},
        {1686.88, 2275.85, 10.67, 1},
        {1579.78, 2275.48, 10.67},
        {1564.36, 2260.28, 10.67},
        {1564.66, 2200.58, 10.67, 1},
        {1577.45, 2170.87, 10.67},
        {1615.59, 2158.39, 10.67},
        {1616.08, 2089.09, 10.52},
        {1616.48, 2024.76, 10.67},
        {1665.35, 2010.25, 10.67, 1},
        {1704.81, 2006.18, 10.74},
        {1704.99, 1965.03, 10.67, 1},
        {1702.50, 1877.19, 10.67},
        {1656.59, 1875.58, 10.70},
        {1577.14, 1875.65, 10.67},
        {1509.04, 1875.56, 10.67},
        {1416.39, 1875.46, 10.67},
        {1352.84, 1876.05, 10.67},
        {1324.42, 1852.79, 10.67, 1},
        {1326.31, 1828.42, 10.68},
        {1269.45, 1815.93, 11.23},
        {1152.16, 1815.44, 10.67},
        {1098.70, 1814.72, 10.67},
        {1074.95, 1773.61, 10.82, 1},
        },
    },
    [2] = {
        [1] = {
            {1087.22, 1776.37, 10.82, 1},
            {1080.08, 1810.76, 10.67},    
            {1138.08, 1793.28, 10.67},
            {1192.00, 1701.98, 6.68},
            {1206.64, 1530.84, 6.74},
            {1206.00, 1396.90, 6.73},
            {1204.28, 1327.51, 6.73, 1},
            {1205.13, 1232.54, 6.78},
            {1205.73, 1103.10, 6.81},
            {1173.55, 925.03, 10.12},
            {1104.18, 838.65, 10.67},
            {1050.44, 800.61, 10.71},
            {835.22, 708.76, 11.55, 1},
            {676.39, 679.17, 8.37},
            {333.87, 778.82, 6.17},
            {154.21, 725.90, 6.21},
            {-46.61, 619.20, 11.93},
            {-280.75, 574.16, 15.97},
            {-453.57, 593.32, 17.18, 1},
            {-546.94, 625.56, 16.69},
            {-692.18, 689.45, 16.62},
            {-820.81, 801.45, 18.08},
            {-848.25, 1021.99, 24.67},
            {-872.89, 1125.12, 26.82},
            {-877.34, 1228.35, 34.03},
            {-930.72, 1321.02, 38.86},
            {-1107.65, 1157.46, 37.68},
            {-1209.60, 1042.88, 41.95},
            {-1420.57, 820.11, 47.31},
            {-1639.95, 589.02, 40.13},
            {-1729.80, 496.12, 38.49},
            {-1821.49, 392.69, 39.35},
            {-1862.60, 300.88, 39.47},
            {-1896.49, 131.82, 38.14},
            {-1904.20, 40.71, 38.24},
            {-1911.26, -84.70, 38.24},
            {-1913.99, -236.14, 38.24},
            {-1913.48, -388.62, 38.24},
            {-1913.58, -506.04, 38.23},
            {-1913.87, -601.50, 38.46},
            {-1914.36, -739.00, 44.42},
            {-1913.94, -823.32, 44.95},
            {-1913.87, -950.65, 43.60},
            {-1908.29, -1026.17, 38.71},
            {-1907.94, -1147.70, 38.45},
            {-1907.87, -1302.72, 39.48},
            {-1914.91, -1361.67, 40.38},
            {-1871.68, -1397.37, 38.90, 1},
            {-1572.17, -1522.64, 37.73},
            {-1547.98, -1598.73, 37.73},
            {-1629.03, -1618.71, 36.26},
            {-1723.61, -1658.27, 36.26},
            {-1821.80, -1718.31, 29.10, 1},
            {-1952.89, -1812.45, 34.03},
            {-2010.39, -1880.00, 44.36},
            {-2080.17, -1997.65, 60.34},
            {-2188.60, -2159.23, 47.09},
            {-2314.43, -2232.29, 22.64},
            {-2377.19, -2263.07, 15.00, 1},
            {-2430.18, -2285.96, 14.25},
            {-2503.52, -2300.18, 14.94},
            {-2540.64, -2337.16, 14.45},
            {-2510.49, -2447.58, 28.87},
            {-2457.38, -2533.82, 48.14},
            {-2395.47, -2596.97, 56.54},
            {-2307.65, -2638.25, 59.46},
            {-2204.80, -2681.18, 57.50},
            {-2089.56, -2680.11, 53.60},
            {-1975.94, -2642.51, 58.95},
            {-1907.34, -2618.84, 57.97},
            {-1854.06, -2606.02, 56.90, 1},
            {-1764.16, -2625.61, 49.50},
            {-1687.06, -2703.62, 46.95},
            {-1582.93, -2795.04, 46.92},
            {-1433.98, -2922.83, 46.92},
            {-1317.60, -2919.79, 50.74},
            {-1180.73, -2870.22, 67.72},
            {-1015.94, -2868.42, 67.54},
            {-866.88, -2860.11, 61.86},
            {-577.41, -2788.75, 48.80},
            {-456.77, -2815.35, 47.33},
            {-217.48, -2868.92, 39.18},
            {-87.30, -2870.70, 39.24},
            {3.45, -2750.44, 40.60},
            {3.58, -2611.68, 39.92},
            {-80.68, -2464.43, 33.85},
            {-156.09, -2390.61, 31.36, 1},
            {-240.96, -2272.88, 28.24},
            {-281.53, -2203.61, 28.39},
            {-325.48, -2071.75, 27.14},
            {-326.80, -1867.47, 21.58},
            {-273.79, -1700.40, 14.31},
            {-224.95, -1594.70, 15.55},
            {-115.26, -1464.46, 12.80},
            {-76.76, -1427.25, 12.26},
            {-20.66, -1412.36, 11.07},
            {-1.86, -1486.56, 3.36},
            {-51.70, -1498.65, 1.71},
            {-134.91, -1440.40, 2.70},
            {-148.13, -1334.68, 2.70},
            {-141.57, -1276.81, 2.70, 1},
            {-104.34, -1152.80, 1.72},
            {-77.16, -1066.27, 15.10},
            {-101.27, -1009.57, 24.22},
            {-101.32, -950.43, 21.93},
            {-32.58, -810.67, 11.01},
            {23.06, -682.44, 4.38},
            {44.51, -618.41, 3.47, 1},
            {40.63, -524.16, 10.07},
            {-71.13, -430.30, 1.08},
            {-124.72, -392.27, 1.08},
            {-226.54, -288.06, 1.08},
            {-276.53, -217.82, 1.08},
            {-308.38, -120.54, 1.08, 1},
            {-293.29, -13.85, 1.08},
            {-242.40, 135.02, 1.60},
            {-218.84, 192.76, 9.61},
            {-192.03, 263.38, 12.08},
            {-185.16, 288.83, 12.08},
            {-151.40, 416.90, 12.08},
            {-128.08, 509.58, 8.95, 1}, 
            {-107.92, 536.99, 7.06},
            {-19.17, 583.13, 10.52},
            {36.57, 631.12, 7.36},
            {103.18, 667.43, 5.53},
            {165.79, 703.19, 6.13},
            {251.87, 738.23, 6.13},
            {378.18, 752.65, 6.13},
            {466.11, 716.44, 5.69},
            {547.28, 673.83, 3.36},
            {700.37, 654.12, 9.46},
            {831.74, 679.61, 11.77},
            {894.54, 706.30, 10.84, 1},
            {950.13, 726.12, 10.68},
            {1015.12, 751.37, 10.71},
            {1079.97, 796.18, 10.70},
            {1101.75, 810.78, 10.70},
            {1185.65, 857.57, 11.60},
            {1311.96, 898.31, 17.35},
            {1350.74, 973.43, 16.36},
            {1282.85, 1068.86, 9.74},
            {1234.25, 1133.84, 6.81},
            {1229.75, 1346.76, 6.74},
            {1229.98, 1473.60, 6.73},
            {1229.54, 1634.43, 6.73},
            {1247.19, 1707.38, 6.73},
            {1294.38, 1797.98, 10.65},
            {1258.38, 1816.00, 12.02},
            {1178.33, 1816.02, 12.15},
            {1106.68, 1816.04, 10.67},
            {1074.93, 1774.62, 10.82, 1},
        },
    },        
}

x, y = 39*px, 30*py
x2, y2 = 39*px, 174*py

--guiCreateWindow(0.70, 0.19, 0.29, 0.60, "", true)

function gbilety()
    local mx, my = getCursorPosition()
    if mysz(x, y, 370*px, 127*py) and getKeyState("mouse1") == true then
        x, y = (mx*sx-(370*px/2)),(my*sy-(127*py/2))
        trzymam1 = true
        trzymam2 = false
    end
    if mysz(x2, y2, 370*px, 127*py) and getKeyState("mouse1") == true then
        x2, y2 = (mx*sx-(370*px/2)),(my*sy-(127*py/2))
        trzymam1 = false
        trzymam2 = true
    end
    if mysz(587*px, 373*py, 370*px, 127*py) and trzymam1 == true or trzymam2 == true then
        git = true
    else
        git = false
    end
    if mysz(587*px, 373*py, 370*px, 127*py) and git == true and getKeyState("mouse1") ~= true then
        sprzedal()
        trzymam1 = false
        trzymam2 = false
        git = false
    end
    dxDrawImage(0, 0, sx, sy, ":np-gui/grafiki/tlo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(x, y, 370*px, 127*py, ":np-autobusy/img/ulgowy.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(x2, y2, 370*px, 127*py, ":np-autobusy/img/normalny.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawLine(586*px, 372*py, 586*px, 500*py, tocolor(25, 175, 131, 255), 2, false)
    dxDrawLine(957*px, 372*py, 586*px, 372*py, tocolor(25, 175, 131, 255), 2, false)
    dxDrawLine(586*px, 500*py, 957*px, 500*py, tocolor(25, 175, 131, 255), 2, false)
    dxDrawLine(957*px, 500*py, 957*px, 372*py, tocolor(25, 175, 131, 255), 2, false)
    --dxDrawRectangle(587*px, 373*py, 370*px, 127*py, tocolor(0, 0, 0, 120), false)
    dxDrawText(bilet[1], 585*px, 373*py, 957*px, 500*py, tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
    if not myElement or not myObject then return end
    local projPosX, projPosY = guiGetPosition(guiWindow,true)
    local projSizeX, projSizeY = guiGetSize(guiWindow, true)
    exports.object_preview:setProjection(myObject, projPosX, projPosY, projSizeX, projSizeY, true, true)
end

function rozpocznijprace()
    setElementData(localPlayer, "pracuje", "autobusy")
    exports["np-notyfikacje"]:noti("Rozpoczynasz prace")
    triggerServerEvent("dajAutobus:autobusy", localPlayer)
    punkty = 0
    if getElementData(localPlayer, "autobusy:ulepszenie1") == 1 then
        region = 2 
    else
        region = 1
    end
    los = math.random(1, #markers[region])
    showMarkers()
end

function zakonczprace(cos)
    setElementData(localPlayer, "pracuje", false)
    triggerServerEvent("usunAutobus:autobusy", localPlayer)
    if isElement(marker) then
        destroyElement(marker)
    end
    if isElement(blip) then
        destroyElement(blip)
    end
    if cos then
        setElementPosition(localPlayer, 1621.62, -1139.10, 23.91)
    end
end
addEvent("zakonczPrace:autobusy", true)
addEventHandler("zakonczPrace:autobusy", root, zakonczprace)

function showMarkers()
    if isElement(marker) then
        destroyElement(marker)
    end
    if isElement(blip) then
        destroyElement(blip)
    end
    if punkty == #markers[region][los] then return end
    punkty = punkty + 1
    local przystanek = markers[region][los][punkty][4] or 0
    if przystanek == 1 then
        r, g, b = 255, 0, 0
    else
        r, g, b = 0, 0, 255
    end
    marker = createMarker(markers[region][los][punkty][1], markers[region][los][punkty][2], markers[region][los][punkty][3], "checkpoint", 4, r, g, b)
    blip = createBlipAttachedTo(marker, 41)
    setElementData(marker, "przystanek", (markers[region][los][punkty][4] or 0 ))
    if markers[region][los][punkty+1] then
        ile = markers[region][los][punkty+1]
        setMarkerTarget(marker, ile[1], ile[2], ile[3])
    end
    addEventHandler("onClientMarkerHit", marker, markersHit)
end

local bilety = {
    {"Ulgowy"},
    {"Normalny"},
}

function markersHit(gracz)
    if gracz ~= localPlayer then return end
    if punkty == #markers[region][los] then
        zakonczprace()
        triggerServerEvent("daj:azlecenia", localPlayer, localPlayer)
    end
    if getElementData(source, "przystanek") == 1 then
        addEventHandler("onClientRender", root, gbilety)
        showCursor(true)
        bileciki = true
        setElementData(localPlayer, "hud", true)
        setElementFrozen(getPedOccupiedVehicle(localPlayer), true)
        local x1, y1, z1 = getCameraMatrix()
        myElement = createPed(math.random(10, 41), x1, y1, z1, 0)
        myObject = exports.object_preview:createObjectPreview(myElement, 0, 0, 0, 10, 0.5, 1, 1, true, true, true)
        guiWindow = guiCreateWindow(987*px, 186*py, 418*px, 506*py, "", false, false)
        guiSetAlpha(guiWindow, 0)
        local projPosX, projPosY = guiGetPosition(guiWindow,true)
        local projSizeX, projSizeY = guiGetSize(guiWindow, true)
        exports.object_preview:setProjection(myObject, projPosX, projPosY, projSizeX, projSizeY, true, true)
        exports.object_preview:setRotation(myObject, -10, 0, 160)
        bilet = bilety[math.random(#bilety)]
        klienci = math.random(2,4)
        --outputChatBox(klienci)
        sprzedane = 0
    else
        showMarkers()
        if getElementData(localPlayer, "autobusy:ulepszenie1") == 1 then
               zarobek2 = math.random(7, 10)
           else
               zarobek2 = math.random(5, 10)
           end
        if getElementData(localPlayer, "premium") then
            zarobek2 = zarobek2 + zarobek2*0.15
        end
        setElementData(localPlayer, "pieniadze", getElementData(localPlayer, "pieniadze")+zarobek2)
        local nagroda = math.random(1, 20)
        if tonumber(nagroda) == 5 then
            local los2 = math.random(1,3)
            if getElementData(localPlayer, "premium") then
                los2 = math.random(2, 6)
            end
            setElementData(localPlayer, "punkty", getElementData(localPlayer, "punkty")+los2)
            exports["np-notyfikacje"]:noti("Za dobr? prace otrzymujesz "..los2.." RP")
        end
    end
end

function sprzedal()
    if (bilet[1] == "Ulgowy" and trzymam2 == true) or (bilet[1] == "Normalny" and trzymam1 == true) then
        exports["np-notyfikacje"]:noti("Da?e? klientowi z?y bilet", "error")
    else
        exports["np-notyfikacje"]:noti("Sprzedajesz bilet klientowi")
        if getElementData(localPlayer, "autobusy:ulepszenie1") == 1 then
            zarobek = math.random(10, 18)
        else
            zarobek = math.random(8, 16)
        end
        if getElementData(localPlayer, "premium") then
            zarobek = zarobek + zarobek*0.15
        end
        if getElementData(localPlayer, "autobusy:ulepszenie2") == 1 then
            zarobek = zarobek + zarobek*0.05
        end
        setElementData(localPlayer, "pieniadze", getElementData(localPlayer, "pieniadze")+zarobek)
    end
    sprzedane = sprzedane + 1
    bilet = bilety[math.random(#bilety)]
    if sprzedane >= klienci then 
        showMarkers() 
        removeEventHandler("onClientRender", root, gbilety)
        showCursor(false)
        bileciki = false
        x, y = 39*px, 30*py
        x2, y2 = 39*px, 174*py
        setElementFrozen(getPedOccupiedVehicle(localPlayer), false)
        if isElement(myElement) then
            destroyElement(myElement)
        end
        setElementData(localPlayer, "hud", false)
    return end
    local punkty = getElementData(localPlayer, "apunkty") or 0
    setElementData(localPlayer, "apunkty", punkty+math.random(0,1))
    x, y = 39*px, 30*py
    x2, y2 = 39*px, 174*py
    if isElement(myElement) then
        destroyElement(myElement)
    end
    local x1, y1, z1 = getCameraMatrix()
    myElement = createPed(math.random(10, 41), x1, y1, z1, 0)
    myObject = exports.object_preview:createObjectPreview(myElement, 0, 0, 0, 10, 0.5, 1, 1, true, true, true)
    guiWindow = guiCreateWindow(987*px, 186*py, 418*px, 506*py, "", false, false)
    guiSetAlpha(guiWindow, 0)
    local projPosX, projPosY = guiGetPosition(guiWindow,true)
    local projSizeX, projSizeY = guiGetSize(guiWindow, true)
    exports.object_preview:setProjection(myObject, projPosX, projPosY, projSizeX, projSizeY, true, true)
    exports.object_preview:setRotation(myObject, -10, 0, 160)
end

--opcje

function shadowText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
    dxDrawText(text,x+1,y+1,w+1,h+1,tocolor(0,0,0),size,font,xx,yy,x1,x2,x3,x4,x5)
    dxDrawText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
end

function mysz(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

function scale_x(value)
    local result = (value / 1440) * sx

    return result
end

function scale_y(value)
    local result = (value / 900) * sy

    return result
end


s.lua
function pokazpracownikow()
    local q = exports['np-mysql']:wykonaj("SELECT * from konta order by azlecenia desc")
    local topka = {}

    for i = 1,5 do
        table.insert(topka, {nick = q[i]["login"], liczba = q[i]["azlecenia"]})
    end

    return topka
end

tablica = pokazpracownikow()

setTimer(function()
    tablica = pokazpracownikow()
end, 600000, 0)

addEvent("pokazTopke:autobusy:source", true)
addEventHandler("pokazTopke:autobusy:source", root, function()
    triggerClientEvent(source, "pokazTopke:autobusy:client", source, tablica)
end)

addEvent("daj:azlecenia", true)
addEventHandler("daj:azlecenia", root, function(player)
    local dbid = getElementData(player, "dbid")
    local ilosc = getElementData(player, "azlecenia") or 0
    local q = exports['np-mysql']:wykonaj("UPDATE konta SET azlecenia=azlecenia+1 where dbid=?", dbid)
    setElementData(player, "azlecenia", ilosc+1)
end)

bus = { }

addEvent("dajAutobus:autobusy", true)
addEventHandler("dajAutobus:autobusy", root, function()
    if getElementData(source, "autobusy:ulepszenie1") == 1 then
        bus[source] = createVehicle(431, 1104.13, 1735.19, 10.49, 0.4, 0.0, 0.0)
    else
        bus[source] = createVehicle(418, 1104.13, 1735.19, 10.49, 0.4, 0.1, 0.0)
    end
    warpPedIntoVehicle(source, bus[source])
    setElementDimension(bus[source], 0)
    setVehicleDamageProof(bus[source], true)
    triggerClientEvent(root, "ghost:vehicle", root, bus[source])
    setElementData(bus[source], "kierowca:autobusy", getElementData(source, "dbid"))
    setVehicleColor(bus[source], 255, 255, 255, 255, 255, 255)
end)

addEvent("usunAutobus:autobusy", true)
addEventHandler("usunAutobus:autobusy", root, function()
    if isElement(bus[client]) then
        destroyElement(bus[client])
    end
end)

addEventHandler("onVehicleStartExit", resourceRoot, function(gracz)
    if getElementData(gracz, "pracuje") ~= "autobusy" then return end
    triggerClientEvent(gracz, "zakonczPrace:autobusy", gracz, true)
end)

addEventHandler("onVehicleStartEnter", root, function(gracz, seat)
    if getElementData(gracz, "pracuje") == "autobusy" then
        if getElementData(source, "id") then
            cancelEvent()
        end
        if getElementData(source, "kierowca:autobusy") ~= getElementData(gracz, "dbid") then
            cancelEvent()
        end
    else
        if getElementData(source, "kierowca:autobusy") then
            cancelEvent()
        end
    end
end)

addEventHandler("onPlayerQuit", root, function()
    if isElement( bus[source] ) then
        destroyElement( bus[source] )
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-25, 16:19


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Zobacz w /debugscript 3 i wy?lij zdj?cie b??d?w je?li takie b?d?.

Ja nie mia?em styczno?ci z tym Gamemodem i nie wiem o czym m?wi? Adaskokieblasko

Wy?lesz b??dy to si? wszystkiego dowiemy.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-25, 17:41


Fl!k







Wiek: 26
Na forum: 3733 dni
Posty: 162

Piwa: 18

Respekt: 50

Debugscript 3


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-25, 18:18


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Wys?a?e? kod od autobus?w a nie dzia?aj???mieciarki, wy?lij odpowiedni kod.

Z tego co pisa? Adaskokieblasko wywnioskowa?em, ?e wie jak naprawi? Tw?j b??d - musisz poczeka? na pomoc z Jego strony, sam spr?buje Ci pom?c kiedy otrzymam odpowiedni kod.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-25, 20:01


Adaskokieblasko







Wiek: 23
Na forum: 3095 dni
Posty: 101

Piwa: 18

Respekt: 100
Respekt: 100

np-smieciarki > s.lua > zmie? nazw? wadliwych event?w NP


addEvent("dajSmieciarke:smieciarki", true)
addEventHandler("dajSmieciarke:smieciarki", root, function(el)

na

addEvent("NadajSmieciarke", true)
addEventHandler("NadajSmieciarke", root, function(el)

oraz po stronie clienta
z

    triggerServerEvent("dajSmieciarke:smieciarki", localPlayer)

na

    triggerServerEvent("NadajSmieciarke", localPlayer)


Edit//Dodam ze w moim przypadku nie trzeba by?o zmienia? nazw po prostu w s.lua
starczy?o usun?? nazw? eventu i nada? j? ponownie (( w razie co podaje ten spos?b jest szybszy i prostszy ))

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-25, 21:35


Fl!k







Wiek: 26
Na forum: 3733 dni
Posty: 162

Piwa: 18

Respekt: 50

Nic nie zadzia?a?o :( Adaskokieblasko
DEBUGSCRIPT 3


[ Dodano: 2019-01-25, 21:39 ]
np-smieciarki >> c.lua
--[[
    Autor: Malentas
]]
 
local sx, sy = guiGetScreenSize()
local okno1 = false
local ulepszenia = false
 
local pracodawca = createPed(27, 2076.60, -2045.03, 13.59, 180)
setElementData(pracodawca, "name", "Pracodawca")
setElementDimension(pracodawca, 0)
setElementFrozen(pracodawca, true)
local rozpoczecie = createMarker(2076.85, -2047.22, 13.59-.95, "cylinder", 1, 255, 255, 255)
setElementData(rozpoczecie, "praca", true)
setElementDimension(rozpoczecie, 0)
 
 
addEventHandler("onClientMarkerHit", rozpoczecie, function(gracz)
    if gracz ~= localPlayer then return end
    if getPedOccupiedVehicle(localPlayer) then return end
    if getElementData(localPlayer, "block:prawko") then exports["np-notyfikacje"]:noti("Posiadasz zabrane prawo jazdy kat. A, B, C", "error") return end
    if getElementData(localPlayer, "punkty") < 75 then exports["np-notyfikacje"]:noti("Nie posiadasz 120 punkt?w reputacji!", "error") return end
    if getElementData(localPlayer, "pracuje") then
        if getElementData(localPlayer, "pracuje") ~= "smieciarki" then exports["np-notyfikacje"]:noti("Posiadasz inn? aktywn? prace!", "error") return end
    end
    addEventHandler("onClientRender", root, guistart)
    okno1 = true
    showCursor(true)
    triggerServerEvent("pokazTopke:smieciarki:source", localPlayer)
end)
 
local font = dxCreateFont("cz.ttf", 10)
local font2 = dxCreateFont("cz.ttf", 12)
 
local font = dxCreateFont("cz.ttf", 10)
local font2 = dxCreateFont("cz.ttf", 12)
 
local pracownicy = { }
 
local listaulepszen = {
    {"Sprint", "Dzi?ki temu ulepszeniu mo?esz biega? z koszem", 300, "dolar.png"},
    {"Szybsze ?adowanie", "Dzi?ki temu ulepszeniu b?dziesz szybciej ?adowa? ?mieci", 500, "dolar.png"},
    {"Zarobek +5%", "Dzi?ki temu ulepszeniu zarabiasz wi?cej o 5%", 700, "dolar.png"},
    {"Pojemniejsza ?mieciarka", "Dzi?ki temu ulepszeniu twoja smieciarka zmiesci wi?cej koszy", 500, "dolar.png"},
}
 
 
function guistart()
    dxDrawImage(scale_x(402), scale_y(251), scale_x(637), scale_y(399), ":np-gui/grafiki/tlo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    if ulepszenia == false then
       local punkty = getElementData(localPlayer, "spunkty") or 0
       local zlecenia = getElementData(localPlayer, "szlecenia") or 0
        shadowText("Praca zbieracza smieci", scale_x(401), scale_y(251), scale_x(1039), scale_y(295), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        --shadowText("Wymagania:\nBRAK", scale_x(401), scale_y(295), scale_x(719), scale_y(449), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        shadowText("Wykonane zlecenia: "..zlecenia.."\nPunkty: "..punkty.."", scale_x(402), scale_y(510), scale_x(719), scale_y(646), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        shadowText("Top pracownicy:", scale_x(719), scale_y(295), scale_x(1036), scale_y(329), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        dxDrawImage(scale_x(415), scale_y(310), scale_x(304), scale_y(175), ":np-magazynier/grafiki/bg2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        shadowText("Wymagania: Kategoria C\n75 Punkt?w reputacji", scale_x(415), scale_y(500), scale_x(719), scale_y(548), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        if mysz(scale_x(889), scale_y(592), scale_x(139), scale_y(44)) then
           dxDrawImage(scale_x(889), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_on.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        else
           dxDrawImage(scale_x(889), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_off.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        end
        if mysz(scale_x(729), scale_y(592), scale_x(139), scale_y(44)) then
           dxDrawImage(scale_x(729), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_on.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        else
           dxDrawImage(scale_x(729), scale_y(592), scale_x(139), scale_y(44), ":np-gui/grafiki/button_off.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        end
        if getElementData(localPlayer, "pracuje") == "smieciarki" then
           shadowText("Zako?cz prace", scale_x(728), scale_y(591), scale_x(868), scale_y(636), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        else
           shadowText("Rozpocznij prace", scale_x(728), scale_y(591), scale_x(868), scale_y(636), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        end
        shadowText("Ulepszenia", scale_x(888), scale_y(592), scale_x(1028), scale_y(637), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        dxDrawImage(scale_x(1010), scale_y(261), scale_x(25), scale_y(25), ":np-gui/grafiki/cross.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        shadowText("Nickname:", scale_x(729), scale_y(329), scale_x(880), scale_y(363), tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
        shadowText("Wykonane zlecenia:", scale_x(877), scale_y(329), scale_x(1028), scale_y(363), tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
 
        for i, v in ipairs(pracownicy) do
           local dodatekY = (scale_y(37))*(i-1)
           local dodatekY2 = (scale_y(74))*(i-1)
 
           dxDrawRectangle(scale_x(729), scale_y(363) + dodatekY, scale_x(299), scale_y(35), tocolor(0, 0, 0, 120), false)
           shadowText(v.nick, scale_x(729), scale_y(364) + dodatekY2, scale_x(877), scale_y(398), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
           shadowText(v.liczba, scale_x(880), scale_y(364) + dodatekY2, scale_x(1028), scale_y(398), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        end
    else
        local punkty = getElementData(localPlayer, "spunkty") or 0
        shadowText("Kupno ulepszen", scale_x(401), scale_y(251), scale_x(1039), scale_y(295), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        dxDrawImage(scale_x(1011), scale_y(262), scale_x(16), scale_y(16), ":np-gui/grafiki/cofnij.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Posiadasz: "..punkty.." punkt?w", scale_x(402), scale_y(582), scale_x(1037), scale_y(648), tocolor(0, 255, 0, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        for i, v in ipairs(listaulepszen) do
            local dodatekY = (scale_y(72))*(i-1)
            local dodatekY2 = (scale_y(144))*(i-1)
 
            dxDrawRectangle(scale_x(417), scale_y(297)+dodatekY, scale_x(610), scale_y(70), tocolor(0, 0, 0, 120), false)
            dxDrawImage(scale_x(432), scale_y(307)+dodatekY, scale_x(50), scale_y(50), ":np-magazynier/grafiki/"..v[4].."", 0, 0, 0, tocolor(255, 255, 255, 255), false)
            shadowText(v[1], scale_x(501), scale_y(297)+dodatekY2, scale_x(874), scale_y(332), tocolor(255, 255, 255, 255), 1.00, font2, "left", "center", false, false, false, false, false)
            shadowText(v[2], scale_x(501), scale_y(332)+dodatekY2, scale_x(874), scale_y(367), tocolor(255, 255, 255, 255), 1.00, font, "left", "center", false, false, false, false, false)
            if mysz(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38)) then
                dxDrawImage(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38), ":np-gui/grafiki/button_on.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
            else
                dxDrawImage(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38), ":np-gui/grafiki/button_off.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
            end
            shadowText("Zakup", scale_x(904), scale_y(312)+dodatekY2, scale_x(1017), scale_y(350), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
            shadowText("Cena: "..v[3].."p", scale_x(781), scale_y(297)+dodatekY2, scale_x(894), scale_y(335), tocolor(255, 255, 255, 255), 1.00, font2, "center", "center", false, false, false, false, false)
        end
    end
end
 
addEventHandler("onClientClick", root, function(btn, state)
  if btn == "left" and state == "down" then
    if mysz(scale_x(729), scale_y(592), scale_x(139), scale_y(44)) and okno1 == true and ulepszenia == false then
        if getElementData(localPlayer, "pracuje") == "smieciarki" then
            zakonczprace()
        else
            rozpocznijprace()
        end
    elseif mysz(scale_x(889), scale_y(592), scale_x(139), scale_y(44)) and okno1 == true and ulepszenia == false then
        ulepszenia = true
    elseif mysz(scale_x(1010), scale_y(261), scale_x(16), scale_y(16)) and okno1 == true and ulepszenia == false then
        removeEventHandler("onClientRender", root, guistart)
        okno1 = false
        showCursor(false)
    elseif mysz(scale_x(1011), scale_y(262), scale_x(16), scale_y(16)) and okno1 == true and ulepszenia == true then
        ulepszenia = false
    end
    for i, v in ipairs(listaulepszen) do
        local dodatekY = (scale_y(72))*(i-1)
        if mysz(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38)) and okno1 == true and ulepszenia == true then
            local punkty = getElementData(localPlayer, "spunkty") or 0
            if punkty < tonumber(v[3]) then exports["np-notyfikacje"]:noti("Posiadasz za ma?o punkt?w by zakupi? to ulepszenie", "error") return end
            if v[1] == "Szybsze ?adowanie" then
                if getElementData(localPlayer, "smieciarki:ulepszenie2") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "smieciarki:ulepszenie2", 1)
            elseif v[1] == "Sprint" then
                if getElementData(localPlayer, "smieciarki:ulepszenie1") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "smieciarki:ulepszenie1", 1)
            elseif v[1] == "Zarobek +5%" then
                if getElementData(localPlayer, "smieciarki:ulepszenie3") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "smieciarki:ulepszenie3", 1)
            elseif v[1] == "Pojemniejsza ?mieciarka" then
                if getElementData(localPlayer, "smieciarki:ulepszenie4") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
                setElementData(localPlayer, "smieciarki:ulepszenie4", 1)
            end
            exports["np-notyfikacje"]:noti("Zakupujesz ulepszenie: "..v[1])
            setElementData(localPlayer, "spunkty", punkty-tonumber(v[3]))
        end
    end
  end
end)
 
addEvent("pokazTopke:smieciarki:client", true)
addEventHandler("pokazTopke:smieciarki:client", root, function(tabelka)
  pracownicy = tabelka
end)
 
--praca
 
local kosz = {}
local kmarker = {}
local kblip = {}
local liczbakoszy = 5
local max = 20
local czas = 4000

local odklada = false
 
--Jefferson
local miejsce1 = {
    {2134.10, -1375.30, 23.98},
    {2190.74, -1375.72, 23.99},
    {2138.45, -1406.00, 23.99},
    {2138.42, -1411.33, 23.99},
    {2138.24, -1452.13, 23.98},
}
 
--Ganton
local miejsce2 = {
    {2498.26, -1686.70, 13.48},
    {2505.73, -1654.07, 13.59},
    {2490.30, -1647.08, 14.08},
    {2468.72, -1648.26, 13.47},
    {2471.70, -1684.67, 13.51},
}
 
--Idlewood
local miejsce3 = {
    {2067.43, -1733.55, 13.88},
    {2065.64, -1701.91, 14.15},
    {2072.29, -1653.71, 13.55},
    {2013.18, -1653.42, 13.55},
    {2012.33, -1629.07, 13.55},
}
 
--Glen Park
local miejsce4 = {
    {1937.65, -1126.89, 25.42},
    {1903.61, -1116.77, 25.66},
    {1939.73, -1062.33, 24.42},
    {2025.53, -1056.79, 24.69},
    {1858.05, -1159.61, 23.86},
}
 
--Market
local miejsce5 = {
    {1184.90, -1257.63, 15.18},
    {1185.32, -1257.91, 18.90},
    {1181.94, -1230.21, 18.55},
    {1185.18, -1230.07, 22.14},
    {1134.85, -1211.10, 18.55},
}
 
--Marina
local miejsce6 = {
    {819.46, -1495.79, 13.59},
    {867.32, -1509.56, 13.55},
    {843.90, -1481.20, 13.60},
    {785.13, -1460.96, 13.55},
    {811.44, -1553.44, 13.59},
}
 
--Richman
local miejsce7 = {
    {298.88, -1335.26, 53.44},
    {253.61, -1364.64, 53.11},
    {250.39, -1271.32, 73.84},
    {254.48, -1219.24, 75.31},
    {280.82, -1259.10, 73.92},
}
 
--Las Colinas
local miejsce8 = {
    {2528.09, -1036.69, 69.58},
    {2501.15, -1062.82, 70.16},
    {2488.55, -1013.44, 65.40},
    {2629.20, -1071.08, 69.62},
    {2556.71, -956.12, 82.73},
}
 
function rozpocznijprace()
    if getElementData(localPlayer, "prawko_c") ~= 1 then exports["np-notyfikacje"]:noti("Nie posiadasz prawa jazdy kat. c", "error") return end
    setElementData(localPlayer, "pracuje", "smieciarki")
    triggerServerEvent("skin:praca", localPlayer, 260)
    triggerServerEvent("NadajSmieciarke", localPlayer)
    removeEventHandler("onClientRender", root, guistart)
    okno1 = false
    showCursor(false)
    stowrzKosze()
    wysypisko = createMarker(2080.57, -2000.48, 12.65, "cylinder", 4.5, 0, 255, 0)
    bwysypisko = createBlipAttachedTo(wysypisko, 11)
    setElementData(localPlayer, "liczbakoszy", 0)
    odklada = false
    addEventHandler("onClientMarkerHit", wysypisko, function(gracz)
        if gracz ~= localPlayer then return end
        local ile = getElementData(localPlayer, "liczbakoszy")
        if ile <= 1 then exports["np-notyfikacje"]:noti("Aby wy?adowa? smieciarke musisz za?adowa? wi?cej ni? 1 kosz!", "error") return end
        local zarobek = 90*ile
        if getElementData(localPlayer, "premium") then
            zarobek = zarobek+(zarobek*0.15)
        end
        local nagroda = math.random(0,1)
        if getElementData(localPlayer, "premium") then
            nagroda = nagroda+(nagroda*2)
        end
        if getElementData(localPlayer, "smieciarki:ulepszenie3") == 1 then
            zarobek = zarobek+(zarobek*0.05)
        end
        setElementData(localPlayer, "pieniadze", getElementData(localPlayer, "pieniadze")+zarobek)
        setElementData(localPlayer, "punkty", getElementData(localPlayer, "punkty")+nagroda)
        exports["np-notyfikacje"]:noti("Wy?adowa?e? smieciarke zarabiasz: "..zarobek.." PLN")
        setElementData(localPlayer, "liczbakoszy", 0)
        setElementData(getPedOccupiedVehicle(localPlayer), "nametag", "")
    end)
end
 
function stowrzKosze()
    local los = math.random(1, 8)
    if los == 1 then
        trasa = miejsce1
    elseif los == 2 then
        trasa =  miejsce2
    elseif los == 3 then
        trasa =  miejsce3
        elseif los == 4 then
        trasa =  miejsce4
       elseif los == 5 then
        trasa =  miejsce5
       elseif los == 6 then
        trasa =  miejsce6
   elseif los == 7 then
        trasa =  miejsce7
elseif los == 8 then
        trasa =  miejsce8
    end
    liczbakoszy = 5
    for i, v in ipairs(trasa) do
        kmarker[i] = createMarker(v[1], v[2], v[3], "corona", 1.2, 0,0,0,0)
        kosz[i] = createObject(1339, v[1], v[2], v[3]-0.35)
        kblip[i] = createBlipAttachedTo(kosz[i], 41)
        setElementData(kmarker[i], "kosz", kosz[i])
        setElementData(kmarker[i], "blip", kblip[i])
        setElementCollisionsEnabled(kosz[i], false)
        addEventHandler("onClientMarkerHit", kmarker[i], function(gracz)
            if gracz ~= localPlayer then return end
            if getPedOccupiedVehicle(localPlayer) then return end
            if getElementData(localPlayer, "kosz") then return end
            --destroyElement(getElementData(source, "kosz"))
            attachElements(getElementData(source, "kosz"), localPlayer, 0, 0.7, -0.4, 0, 0, 180)
            setElementData(localPlayer, "kosz", getElementData(source, "kosz"))
            destroyElement(getElementData(source, "blip"))
            destroyElement(source)
            toggleControl("jump", false)
            if getElementData(localPlayer, "smieciarki:ulepszenie1") == 1 then
                toggleControl("walk", true)
                setControlState(localPlayer, "walk", false)
            else
                toggleControl("walk", false)
                setControlState(localPlayer, "walk", true)
            end
            setPedWalkingStyle(localPlayer, 66)    
        end)
    end
end
 
addEventHandler("onClientVehicleExit", root, function(gracz, seat)
    if gracz ~= localPlayer then return end
    if getElementData(localPlayer, "pracuje") == "smieciarki" then
        local x,y,z = getElementPosition(source)
        pmarker = createMarker(x,y,z, "corona", 1, 0,0,0,0)
        setElementData(pmarker, "pojazd", source)
        attachElements(pmarker, source, 0.121, -4.047, -0.641)
        addEventHandler("onClientMarkerHit", pmarker, function(gracz)
            if gracz ~= localPlayer then return end
            if odklada == true then return end
            if getElementData(localPlayer, "kosz") and isPedOnGround(localPlayer) then
                if getElementData(localPlayer, "smieciarki:ulepszenie4") == 1 then
                    max = 30
                else
                    max = 20
                end
                local ile = getElementData(localPlayer, "liczbakoszy") or 0
                if tonumber(ile) >= tonumber(max) then exports["np-notyfikacje"]:noti("Twoja ?mieciarka ma pe?ny zbiornik. Jed? na wysypisko aby j? wy?adowa?.") return end
                toggleAllControls(false)
                exports["np-notyfikacje"]:noti("Trwa wy?adowywanie kosza...")
                setElementFrozen(localPlayer, true)
                if getElementData(localPlayer, "smieciarki:ulepszenie1") == 1 then
                    czas = 2000
                else
                    czas = 4000
                end
                setElementData(localPlayer, "liczbakoszy", ile+1)
                odklada = true
                setTimer(function()
                    odklada = false
                    setElementFrozen(localPlayer, false)
                    exports["np-notyfikacje"]:noti("Kosz zosta? wy?adowany")
                    toggleAllControls(true)
                    toggleControl("fire", false)
                    toggleControl("aim_weapon", false)
                    destroyElement(getElementData(localPlayer, "kosz"))
                    toggleControl("walk", true)
                    setControlState(localPlayer, "walk", false)
                    toggleControl("jump", true)
                    setPedWalkingStyle(localPlayer, 0)
                    setElementData(localPlayer, "kosz", false)
                    liczbakoszy =  liczbakoszy-1
                    local nagroda = math.random(1, 10)
                    if tonumber(nagroda) == 5 then
                        local los2 = math.random(1,3)
                        if getElementData(localPlayer, "premium") then
                            los2 = math.random(2, 6)
                        end
                        setElementData(localPlayer, "punkty", getElementData(localPlayer, "punkty")+los2)
                        exports["np-notyfikacje"]:noti("Za dobr? prace otrzymujesz "..los2.." RP")
                    end
                    local pkt = getElementData(localPlayer, "spunkty") or 0
                    setElementData(localPlayer, "spunkty", pkt+math.random(0, 2))
                    for i, v in ipairs(getElementsByType("vehicle")) do
                        if getElementData(v, "kierowca:smieciarki") and getElementData(v, "kierowca:smieciarki") == getElementData(localPlayer, "dbid") then
                            setElementData(v, "nametag", "Zape?nienie "..getElementData(localPlayer, "liczbakoszy").."/"..max)
                        end
                    end
                    if liczbakoszy == 0 then
                        stowrzKosze()
                        triggerServerEvent("daj:szlecenia", localPlayer, localPlayer)
                    end
                end, czas, 1)
            end
        end)
    end
end)
 
addEventHandler("onClientVehicleEnter", root, function(gracz, seat)
    if gracz ~= localPlayer then return end
    if getElementData(localPlayer, "pracuje") == "smieciarki" then
        if isElement(pmarker) then
            destroyElement(pmarker)
        end
    end
end)
 
 
function zakonczprace()
    setElementData(localPlayer, "pracuje", false)
    triggerServerEvent("skin:praca", localPlayer, getElementData(localPlayer, "skin"))
    triggerServerEvent("usunSmieciarke:smieciarki", localPlayer)
    setElementData(localPlayer, "liczbakoszy", 0)
    odklada = false
    for i, v in ipairs(kmarker) do
        if isElement(v) then
            destroyElement(v)
        end
    end
    for i, v in ipairs(kblip) do
        if isElement(v) then
            destroyElement(v)
        end
    end
    for i, v in ipairs(kosz) do
        if isElement(v) then
            destroyElement(v)
        end
    end
    if isElement(pmarker) then
        destroyElement(pmarker)
    end
    if isElement(wysypisko) then
        destroyElement(wysypisko)
    end
    if isElement(bwysypisko) then
        destroyElement(bwysypisko)
    end
end
 
 
--opcje
 
function shadowText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
    dxDrawText(text,x+1,y+1,w+1,h+1,tocolor(0,0,0),size,font,xx,yy,x1,x2,x3,x4,x5)
    dxDrawText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
end
 
function mysz(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end
 
function scale_x(value)
    local result = (value / 1440) * sx
 
    return result
end
 
function scale_y(value)
    local result = (value / 900) * sy
 
    return result
end


np-smieciarki >> s.lua
local smieciarka = { }
 
function pokazpracownikow()
    local q = exports['np-mysql']:wykonaj("SELECT * from konta order by szlecenia desc")
    local topka = {}
 
    for i = 1,5 do
        table.insert(topka, {nick = q[i]["login"], liczba = q[i]["szlecenia"]})
    end
 
    return topka
end



tablica = pokazpracownikow()

setTimer(function()
    tablica = pokazpracownikow()
end, 600000, 0)
+

addEvent("pokazTopke:smieciarki:source", true)
addEventHandler("pokazTopke:smieciarki:source", root, function()
    triggerClientEvent(source, "pokazTopke:smieciarki:client", source, tablica)
end)
 
addEvent("NadajSmieciarke", true)
addEventHandler("NadajSmieciarke", root, function(el)
    smieciarka[source] = createVehicle(408, 2080.96, -2020.48, 14.10, 1.3, 0.1, 264.8)
    warpPedIntoVehicle(source, smieciarka[source])  
    triggerClientEvent(root, "ghost:vehicle", root, smieciarka[source])
    setElementData(smieciarka[source], "kierowca:smieciarki", getElementData(source, "dbid"))
end)
 
addEvent("usunSmieciarke:smieciarki", true)
addEventHandler("usunSmieciarke:smieciarki", root, function(el)
    if isElement(smieciarka[source]) then
        destroyElement(smieciarka[source])
    end
end)
 
addEventHandler("onPlayerQuit", root, function()
    if isElement(smieciarka[source]) then
        destroyElement(smieciarka[source])
    end
end)
 
addEvent("daj:szlecenia", true)
addEventHandler("daj:szlecenia", root, function(player)
    local dbid = getElementData(player, "dbid")
    local ilosc = getElementData(player, "szlecenia") or 0
    local q = exports['np-mysql']:wykonaj("UPDATE konta SET szlecenia=szlecenia+1 where dbid=?", dbid)
    setElementData(player, "szlecenia", ilosc+1)
end)
 
 
addEventHandler("onVehicleStartEnter", root, function(gracz, seat)
    if seat ~= 0 then return end
    if getElementData(gracz, "pracuje") == "smieciarki" then
        if getElementData(source, "id") then
            cancelEvent()
        end
        if getElementData(source, "kierowca:smieciarki") ~= getElementData(gracz, "dbid") then
            cancelEvent()
        end
    else
        if getElementData(source, "kierowca:smieciarki") then
            cancelEvent()
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-25, 23:25


Adaskokieblasko







Wiek: 23
Na forum: 3095 dni
Posty: 101

Piwa: 18

Respekt: 100
Respekt: 100

Wska? 8 linijk? + PW odczytaj

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-26, 00:06


Fl!k







Wiek: 26
Na forum: 3733 dni
Posty: 162

Piwa: 18

Respekt: 50

8 linijka Adaskokieblasko

s.lua
        table.insert(topka, {nick = q[i]["login"], liczba = q[i]["szlecenia"]})

Dalej jest problem z tym tworzeniem smieciarki :(

Postaw piwo autorowi tego posta
 

 
Tagi: prace :: newplace
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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