np-pizza ma te triggery ale nawet jak jest odpalone to nie dzia?a
[ Dodano: 2018-08-30, 10:24 ]
c.lua np-pizza
--[[
Autor: Malentas
]]
local sx, sy = guiGetScreenSize()
local okno1 = false
local niesie = false
local ulepszenia = false
local alpha = 250
local ile = 0
local trasa = " "
local oddanie = {}
local oddanieped = {}
local boddanie = {}
local rozpoczecie = createMarker(2105.49, -1806.45, 13.55, "cylinder", 1, 255, 255, 255)
setElementData(rozpoczecie, "praca", true)
setElementDimension(rozpoczecie, 0)
addEventHandler("onClientMarkerHit", rozpoczecie, function(gracz)
if gracz ~= 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, "pracuje") then
if getElementData(localPlayer, "pracuje") ~= "pizza" then exports["np-notyfikacje"]:noti("Posiadasz inn? aktywn? prace!", "error") return end
end
addEventHandler("onClientRender", root, guistart)
okno1 = true
showCursor(true)
triggerServerEvent("pokazTopke:pizza:source", localPlayer)
end)
local font = dxCreateFont("cz.ttf", 10)
local font2 = dxCreateFont("cz.ttf", 12)
local pracownicy = { }
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, "kpunkty") or 0
local zlecenia = getElementData(localPlayer, "kzlecenia") or 0
shadowText("Praca dostawcy pizzy", 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/bg3.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
shadowText("Wymagania: Kategoria B\n10 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") == "pizza" 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("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, "kpunkty") 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") == "pizza" 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, "kpunkty") 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] == "Szybszy pojazd" then
if getElementData(localPlayer, "pizza:ulepszenie2") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
setElementData(localPlayer, "pizza:ulepszenie2", 1)
elseif v[1] == "Sprint" then
if getElementData(localPlayer, "pizza:ulepszenie1") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
setElementData(localPlayer, "pizza:ulepszenie1", 1)
elseif v[1] == "Zarobek +5%" then
if getElementData(localPlayer, "pizza:ulepszenie3") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
setElementData(localPlayer, "pizza:ulepszenie3", 1)
end
exports["np-notyfikacje"]:noti("Zakupujesz ulepszenie: "..v[1])
setElementData(localPlayer, "kpunkty", punkty-tonumber(v[3]))
end
end
end
end)
addEvent("pokazTopke:pizza:client", true)
addEventHandler("pokazTopke:pizza:client", root, function(tabelka)
pracownicy = tabelka
end)
-- praca
local miejsca1 = {
{1667.07, -2108.30, 13.89, 185, 5},
{1673.64, -2122.38, 14.15, 0, 0},
{1684.41, -2098.16, 13.83, 90, 280},
{1695.71, -2125.83, 13.81, 0, 35},
{1707.99, -2101.86, 13.55, 180, 105},
}
local miejsca2 = {
{2275.85, -1785.88, 13.55, 90, 270},
{2247.07, -1795.70, 13.55, 130, 240},
{2290.14, -1795.71, 13.55, 270, 90},
{2307.68, -1785.74, 13.56, 90, 270},
{2292.04, -1758.31, 13.55, 180, 0},
}
local miejsca3 = {
{2018.05, -1629.92, 14.04, 120, 300},
{2016.54, -1641.74, 14.11, 310, 180},
{2013.58, -1656.48, 14.14, 180, 0},
{2018.24, -1703.17, 14.23, 190, 190},
{2016.20, -1717.29, 14.13, 230, 50},
}
function rozpocznijprace()
if getElementData(localPlayer, "punkty") < 10 then exports["np-notyfikacje"]:noti("Nie posiadasz 10 punkt?w reputacji!", "error") return end
if getElementData(localPlayer, "prawko_b") ~= 1 then exports["np-notyfikacje"]:noti("Nie posiadasz prawa jazdy kat.c!", "error") return end
if getVehicleModel(element) == 410 then end
setElementData(localPlayer, "pracuje", "pizza")
exports["np-notyfikacje"]:noti("Rozpoczynasz prace jako dostawca pizzy, udaj si? za?adowa? pizze.")
triggerServerEvent("dajBus:pizza", localPlayer)
zaladunek = createMarker(2097.32, -1815.42, 13.38-.95, "cylinder", 2.5, 255, 255, 255)
bzaladunek = createBlipAttachedTo(zaladunek, 41)
addEventHandler("onClientMarkerHit", zaladunek, zaladuj)
removeEventHandler("onClientRender", root, guistart)
okno1 = false
showCursor(false)
ile = 0
end
function zakonczprace()
setElementData(localPlayer, "pracuje", false)
exports["np-notyfikacje"]:noti("Zako?czy?e? prace.")
if isElement(zaladunek) then
destroyElement(zaladunek)
end
if isElement(bzaladunek) then
destroyElement(bzaladunek)
end
if isElement(branieskrzynki) then
destroyElement(branieskrzynki)
end
if isElement(skrzynia5) then destroyElement(skrzynia5) end
if isElement(skrzynia4) then destroyElement(skrzynia4) end
if isElement(skrzynia3) then destroyElement(skrzynia3) end
if isElement(skrzynia2) then destroyElement(skrzynia2) end
if isElement(skrzynia1) then destroyElement(skrzynia1) end
for i, v in ipairs(oddanie) do
if isElement(v) then
destroyElement(v)
end
end
for i, v in ipairs(oddanieped) do
if isElement(v) then
destroyElement(v)
end
end
for i, v in ipairs(boddanie) do
if isElement(v) then
destroyElement(v)
end
end
setElementData(localPlayer, "niesieskrzynie", false)
triggerServerEvent("usunSkrzynie:pizza", localPlayer)
triggerServerEvent("usunBus:pizza", localPlayer)
end
function zaladuj(gracz)
if gracz ~= localPlayer then return end
if getPedOccupiedVehicle(localPlayer) and (getElementData(getPedOccupiedVehicle(localPlayer), "kierowca:pizza") or 0) == getElementData(localPlayer, "dbid") then
if isElement(zaladunek) then
destroyElement(zaladunek)
end
if isElement(bzaladunek) then
destroyElement(bzaladunek)
end
local pojazd = getPedOccupiedVehicle(localPlayer)
skrzynia1 = createObject(1582, 0,0,0)
skrzynia2 = createObject(1582, 0,0,0)
skrzynia3 = createObject(1582, 0,0,0)
skrzynia4 = createObject(1582, 0,0,0)
skrzynia5 = createObject(1582, 0,0,0)
attachElements(skrzynia1, pojazd, -0.45, -0.7, -0.1)
setObjectScale(skrzynia1, 0.6)
attachElements(skrzynia2, pojazd, 0.45, -0.7, -0.1)
setObjectScale(skrzynia2, 0.6)
attachElements(skrzynia3, pojazd, -0.45, -1.4, -0.1)
setObjectScale(skrzynia3, 0.6)
attachElements(skrzynia4, pojazd, 0.45, -1.4, -0.1)
setObjectScale(skrzynia4, 0.6)
attachElements(skrzynia5, pojazd, 0.45, -2.1, -0.1)
setObjectScale(skrzynia5, 0.6)
ile = 5
local los = math.random(1, 3)
if los == 1 then
trasa = miejsca1
elseif los == 2 then
trasa = miejsca2
elseif los == 3 then
trasa = miejsca3
elseif los == 4 then
trasa = miejsca4
elseif los == 5 then
trasa = miejsca5
elseif los == 6 then
trasa = miejsca6
elseif los == 7 then
trasa = miejsca7
elseif los == 8 then
trasa = miejsca8
elseif los == 9 then
trasa = miejsca9
end
exports["np-notyfikacje"]:noti("Pomy?lnie za?adowa?e? pizze, udaj si? do klient?w.")
for i, v in ipairs(trasa) do
local skin = math.random(10, 41)
oddanie[i] = createMarker(v[1], v[2], v[3]-.95, "cylinder", 1.5, 255, 255, 255)
oddanieped[i] = createPed(skin, v[1], v[2], v[3], v[4])
boddanie[i] = createBlipAttachedTo(oddanie[i], 41)
setElementData(oddanie[i], "ped", oddanieped[i])
setElementData(oddanie[i], "blip", boddanie[i])
setPedAnimation(oddanieped[i], 'ped','XPRESSscratch')
setElementFrozen(oddanieped[i], true)
addEventHandler("onClientMarkerHit", oddanie[i], function(gracz)
if gracz ~= localPlayer then return end
if not getElementData(localPlayer, "niesieskrzynie") then exports["np-notyfikacje"]:noti("Nie posiadasz pizzy dla klienta.", "error") return end
local ped = getElementData(source, "ped")
local blip = getElementData(source, "blip")
setElementFrozen(ped, false)
setElementRotation(ped, -0.00, 0.00, v[5])
setPedAnimation(ped, 'ped', 'WOMAN_walknorm')
setElementData(localPlayer, "ped", ped)
fade = true
destroyElement(source)
destroyElement(blip)
ile = ile - 1
setElementData(localPlayer, "niesieskrzynie", false)
triggerServerEvent("usunSkrzynie:pizza", localPlayer)
local zarobek = math.random(300, 800)
if getElementData(localPlayer, "premium") then
zarobek = zarobek + zarobek*0.20
end
local nagroda = math.random(0,1)
if getElementData(localPlayer, "premium") then
nagroda = nagroda + nagroda*2
end
if getElementData(localPlayer, "pizza:ulepszenie3") then
zarobek = zarobek + zarobek*0.05
end
local nagroda = math.random(1, 2)
if tonumber(nagroda) == 5 then
local los2 = math.random(1,3)
if getElementData(localPlayer, "premium") then
los2 = math.random(2, 3)
end
setElementData(localPlayer, "punkty", getElementData(localPlayer, "punkty")+los2)
exports["np-notyfikacje"]:noti("Za dobr? prace otrzymujesz "..los2.." RP")
end
local pkt = math.random(0, 2)
local zarobek2 = string.format("%1d", zarobek)
setElementData(localPlayer, "punkty", getElementData(localPlayer, "punkty")+nagroda)
setElementData(localPlayer, "pieniadze", getElementData(localPlayer, "pieniadze")+zarobek2)
setElementData(localPlayer, "kpunkty", getElementData(localPlayer, "kpunkty")+pkt)
if ile == 0 then
zaladunek = createMarker(2097.32, -1815.42, 13.38-.95, "cylinder", 2.5, 255, 255, 255)
bzaladunek = createBlipAttachedTo(zaladunek, 41)
addEventHandler("onClientMarkerHit", zaladunek, zaladuj)
exports["np-notyfikacje"]:noti("Dowioz?e? pizze do klienta otrzymujesz: "..zarobek2.." PLN.\nUdaj si? po nowe zlecenie")
triggerServerEvent("daj:kzlecenia", localPlayer, localPlayer)
else
exports["np-notyfikacje"]:noti("Dowioz?e? pizze do klienta otrzymujesz: "..zarobek2.." PLN.\nZosta?o: "..ile.." pizzy")
end
setTimer(function()
fade = false
destroyElement(ped)
setElementData(localPlayer, "ped", false)
alpha = 255
end, 3000, 1)
end)
end
end
end
function skinAlpha()
if fade == true then
alpha = alpha-1.5
if alpha > 0 then
setElementAlpha(getElementData(localPlayer, "ped"), alpha)
elseif alpha < 0 then
fade = false
end
end
end
addEventHandler('onClientRender', root, skinAlpha)
addEventHandler("onClientVehicleExit", root, function(gracz, seat)
if gracz ~= localPlayer then return end
if getElementData(localPlayer, "pracuje") == "pizza" then
local x, y, z = getVehicleComponentPosition(source, "boot_dummy")
setVehicleComponentPosition(source, "boot_dummy", x, y, z+1)
local rx, ry, rz = getVehicleComponentRotation(source, "boot_dummy")
setVehicleComponentRotation(source, "boot_dummy", rx+90, ry, rz)
branieskrzynki = createMarker(0,0,0, "cylinder", 1.5, 25, 175, 131)
attachElements(branieskrzynki, source, 0, -3.5, -0.9)
setElementData(branieskrzynki, "auto", source)
addEventHandler("onClientMarkerHit", branieskrzynki, function(gracz)
if gracz ~= localPlayer then return end
if ile == 0 then exports["np-notyfikacje"]:noti("Nie posiadasz paczek.", "error") return end
if not getElementData(localPlayer, "niesieskrzynie") then
setElementData(localPlayer, "niesieskrzynie", true)
triggerServerEvent("dajSkrzynie:pizza", localPlayer)
if ile == 5 then
if isElement(skrzynia5) then destroyElement(skrzynia5) end
elseif ile == 4 then
if isElement(skrzynia4) then destroyElement(skrzynia4) end
elseif ile == 3 then
if isElement(skrzynia3) then destroyElement(skrzynia3) end
elseif ile == 2 then
if isElement(skrzynia2) then destroyElement(skrzynia2) end
elseif ile == 1 then
if isElement(skrzynia1) then destroyElement(skrzynia1) end
end
else
setElementData(localPlayer, "niesieskrzynie", false)
triggerServerEvent("usunSkrzynie:pizza", localPlayer)
local veh = getElementData(source, "auto")
if ile == 5 then
skrzynia5 = createObject(1582, 0,0,0)
attachElements(skrzynia5, veh, 0.45, -2.1, -0.1)
setObjectScale(skrzynia5, 0.6)
elseif ile == 4 then
skrzynia4 = createObject(1582, 0,0,0)
attachElements(skrzynia4, veh, 0.45, -2.1, -0.1)
setObjectScale(skrzynia4, 0.6)
elseif ile == 3 then
skrzynia3 = createObject(1582, 0,0,0)
attachElements(skrzynia3, veh, 0.45, -2.1, -0.1)
setObjectScale(skrzynia3, 0.6)
elseif ile == 2 then
skrzynia2 = createObject(1582, 0,0,0)
attachElements(skrzynia2, veh, 0.45, -2.1, -0.1)
setObjectScale(skrzynia2, 0.6)
elseif ile == 1 then
skrzynia5 = createObject(1582, 0,0,0)
attachElements(skrzynia1, veh, 0.45, -2.1, -0.1)
setObjectScale(skrzynia1, 0.6)
end
end
end)
end
end)
addEventHandler("onClientVehicleEnter", root, function(gracz, seat)
if gracz ~= localPlayer then return end
if getElementData(localPlayer, "pracuje") == "pizza" then
local x, y, z = getVehicleComponentPosition(source, "boot_dummy")
setVehicleComponentPosition(source, "boot_dummy", x, y, z-1)
local rx, ry, rz = getVehicleComponentRotation(source, "boot_dummy")
setVehicleComponentRotation(source, "boot_dummy", rx-90, ry, rz)
if isElement(branieskrzynki) then
destroyElement(branieskrzynki)
end
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
s.lua
local bus = {}
function pokazpracownikow()
local q = exports['np-mysql']:wykonaj("SELECT * from konta order by kzlecenia desc")
local topka = {}
for i = 1,5 do
table.insert(topka, {nick = q[i]["login"], liczba = q[i]["kzlecenia"]})
end
return topka
end
tablica = pokazpracownikow()
setTimer(function()
tablica = pokazpracownikow()
end, 600000, 0)
addEvent("pokazTopke:pizza:source", true)
addEventHandler("pokazTopke:pizza:source", root, function()
triggerClientEvent(source, "pokazTopke:pizza:client", source, tablica)
end)
addEvent("dajBus:pizza", true)
addEventHandler("dajBus:pizza", root, function()
bus[source] = createVehicle(404, 2095.36, -1799.02, 13.12, 359.7, 359.9, 91.1)
warpPedIntoVehicle(source, bus[source])
setVehicleVariant(bus[source], 255, 255)
setElementDimension(bus[source], 0)
setVehicleDamageProof(bus[source], true)
triggerClientEvent(root, "ghost:vehicle", root, bus[source])
setElementData(bus[source], "kierowca:pizza", getElementData(source, "dbid"))
if getElementData(source, "pizza:ulepszenie2") == 1 then
setVehicleColor(bus[source], 230, 0, 0)
setVehicleHandling(bus[source], "driveType", "awd")
setVehicleHandling(bus[source], "engineAcceleration", getVehicleHandling(bus[source]).engineAcceleration+2)
setVehicleHandling(bus[source], "maxVelocity", getVehicleHandling(bus[source]).maxVelocity+30)
else
setVehicleColor(bus[source], 0, 19, 0)
end
end)
addEvent("usunBus:pizza", true)
addEventHandler("usunBus:pizza", root, function()
if isElement(bus[source]) then
destroyElement(bus[source])
end
end)
addEvent("daj:kzlecenia", true)
addEventHandler("daj:kzlecenia", root, function(player)
local dbid = getElementData(player, "dbid")
local ilosc = getElementData(player, "kzlecenia") or 0
local q = exports['np-mysql']:wykonaj("UPDATE konta SET kzlecenia=kzlecenia+1 where dbid=?", dbid)
setElementData(player, "kzlecenia", ilosc+1)
end)
addEventHandler("onVehicleStartEnter", root, function(gracz, seat)
if getElementData(gracz, "pracuje") == "pizza" then
if getElementData(source, "id") then
cancelEvent()
end
if getElementData(source, "kierowca:pizza") ~= getElementData(gracz, "dbid") then
cancelEvent()
end
if getElementData(gracz, "niesieskrzynie") then
exports["np-notyfikacje"]:noti("Nie mo?esz wej?? do pojazdu z pizza", gracz, "error")
cancelEvent()
end
else
if getElementData(source, "kierowca:pizza") then
cancelEvent()
end
end
end)
local skrzynka = {}
local timer = {}
addEvent("dajSkrzynie:pizza", true)
addEventHandler("dajSkrzynie:pizza", root, function()
local x,y,z = getElementPosition(source)
skrzynka[source] = createObject(1582, x,y,z)
pudelko = exports.bone_attach:attachElementToBone(skrzynka[source],source,11,-0.15,0.00,0.10,-92.00,-5.00,5.00)
setPedAnimation(source,"CARRY","crry_prtial",0,true,true,false,true)
toggleControl(source,"sprint", false)
toggleControl(source,"jump", false)
toggleControl(source,"fire", false)
if getElementData(source, "pizza:ulepszenie1") then
toggleControl(source,"walk", true)
setControlState(source,"walk", false)
else
toggleControl(source,"walk", false)
setControlState(source,"walk", true)
end
setObjectScale(skrzynka[source], 0.6)
unbug(source)
end)
function unbug(gracz)
timer[gracz] = setTimer(function()
toggleControl(gracz,"sprint", false)
toggleControl(gracz,"jump", false)
toggleControl(gracz,"fire", false)
if getElementData(gracz, "pizza:ulepszenie1") == 1 then
toggleControl(gracz,"walk", true)
setControlState(gracz,"walk", false)
else
toggleControl(gracz,"walk", false)
setControlState(gracz,"walk", true)
end
end, 51, 0)
end
addEvent("usunSkrzynie:pizza", true)
addEventHandler("usunSkrzynie:pizza", root, function()
if isElement(skrzynka[source]) then destroyElement(skrzynka[source]) end
setPedAnimation(source,"ped","facanger",-1,false,true,true,false)
toggleControl(source,"sprint", true)
toggleControl(source,"jump", true)
toggleControl(source,"fire", false)
toggleControl(source,"walk", true)
setControlState(source,"walk", false)
if isTimer(timer[source]) then
killTimer(timer[source])
end
end)
addEventHandler("onPlayerQuit", root, function()
if isTimer(timer[source]) then
killTimer(timer[source])
end
if isElement(skrzynka[source]) then
destroyElement(skrzynka[source])
end
if isElement(bus[source]) then
destroyElement(bus[source])
end
end)
Chodzi o to, ?e czyta?em to, lecz rozumiem z tego tylko tyle, ?e powinnem wgra? jaki? skrypt "co? typu ,,ustawienia" ,,settings" ". Ale nie mam poj?cia jak mam doda? do serverside powy?sze triggery. Sorka, ale jestem laikiem w tym temacie, a chc? si? nauczy?, mam nadziej?, ?e mnie rozumiesz.
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