elopolacy201
Poland Rescue Team
Wiek: 23 Na forum: 3027 dni Posty: 10
Nick w MP: Lekorz
Qwertick ,
Strona clienta:
Kod: bindKey("h","down","podniespaczkemagazynier")
bindKey("h","down","odstawpaczkemagazynier")
local czc=exports.czcionka:CZ()
local opensans10=exports.czcionka:czcionka("czcos.ttf",10)
local opensans12=exports.czcionka:czcionka("czcos.ttf",12)
local opensans14=exports.czcionka:czcionka("czcos.ttf",14)
local semi14=exports.czcionka:czcionka("czcossmi.ttf",14)
local opensans18=exports.czcionka:czcionka("czcos.ttf",18)
local opensans25=exports.czcionka:czcionka("czcos.ttf",25)
local opensans50=exports.czcionka:czcionka("czcos.ttf",50)
local opensans65=exports.czcionka:czcionka("czcos.ttf",65)
local opensans95=exports.czcionka:czcionka("czcos.ttf",95)
local czc65=exports.czcionka:czcionka("czcd.ttf",65)
local sx,sy=guiGetScreenSize()
local skala=sx*0.2/384
local LatoBlack25 = exports["es-fonts"]:createFont("Lato-Black.ttf",math.floor(25*skala))
local LatoBold35 = exports["es-fonts"]:createFont("Lato-Bold.ttf",math.floor(30*skala))
local LatoBold25 = exports["es-fonts"]:createFont("Lato-Bold.ttf",math.floor(20*skala))
local LatoBold20 = exports["es-fonts"]:createFont("Lato-Bold.ttf",math.floor(25*skala))
local LatoBold15 = exports["es-fonts"]:createFont("Lato-Bold.ttf",math.floor(18*skala))
local LatoRegular = exports["es-fonts"]:createFont("Lato-Regular.ttf",math.floor(21*skala))
local LatoRegular23 = exports["es-fonts"]:createFont("Lato-Regular.ttf",math.floor(23*skala))
if not LatoBlack25 or altFont then
altFont = 'default-bold'
end
local button=exports["es-gui"]:createTexture("button2.png")
local buttonred=exports["es-gui"]:createTexture("buttonred.png")
local wlaczony=false
local strona=1
local blokada=false
local namierzanie_wlaczone=false
local blur=nil
local blur=nil
local tick1=nil
local scroll=0
local getmax=0
local var={}
local varout={}
local recX,recY,recX2,recY2=sx/2-450*skala,sy/2-180*skala,900*skala,340*skala
local napisy_refresh=(
function()
napisy={
{strona=1, cz=LatoBold25 or altFont, x=sx/2+0*skala, y=sy/2-230*skala, txt="#151515Praca dorywcza magazyniera b?dzie wymaga?a od Ciebie\ndo?? du?ej si?y fizycznej. Twoim zadaniem jest przenoszenie\npaczek ze strefy roz?adunku na odpowiednie rega?y\nw odpowiednich alejkach."},
{strona=3, cz=LatoBold25 or altFont, x=sx/2+0*skala, y=sy/2-280*skala, txt="#151515Czy na pewno chcesz zako?czy? prac? magazyniera?\nTwoje statystyki:"},
{strona=3, cz=LatoBold25 or altFont, x=sx/2+0*skala, y=sy/2-10*skala, txt="",edit=1},
{strona=4, cz=LatoBold25 or altFont, x=sx/2+0*skala, y=sy/2-160*skala, txt="#151515U?yj #3f6586„odbierz”,#151515 aby odebra? uzbierane ?rodki.\nTwoje zarobki:"},
{strona=4, cz=LatoBold35 or altFont, x=sx/2+0*skala, y=sy/2+30*skala, txt="",edit=1},
}
end
)
napisy_refresh()
local btn_refresh=(
function()
btn={
{scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=1, x=sx/2-320*skala, y=sy/2-30*skala, w=320*skala, h=120*skala, png="Rozpocznij prac?"},
{scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=1, x=sx/2+5*skala, y=sy/2-30*skala, w=320*skala, h=120*skala, png="Zako?cz prac?"},
{scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=1, x=sx/2-320*skala, y=sy/2+100*skala, w=320*skala, h=120*skala, png="Odbierz wyp?at?",rot=180},
{scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=1, x=sx/2+5*skala, y=sy/2+100*skala, w=320*skala, h=120*skala, png="Zamknij", btn=buttonred},
{podswietlanie=true, scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=2, x=sx/2-300*skala, y=sy/2-170*skala, w=130*skala, h=130*skala, png="1\nPoziom", poziom=1},
{podswietlanie=true, scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=2, x=sx/2-75*skala, y=sy/2-170*skala, w=130*skala, h=130*skala, png="2\nPoziom", poziom=2},
{podswietlanie=true, scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=2, x=sx/2+150*skala, y=sy/2-170*skala, w=130*skala, h=130*skala, png="3\nPoziom", poziom=3},
{podswietlanie=true, scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=2, x=sx/2-300*skala, y=sy/2-25*skala, w=130*skala, h=130*skala, png="4\nPoziom", poziom=4},
{podswietlanie=true, scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=2, x=sx/2-75*skala, y=sy/2-25*skala, w=130*skala, h=130*skala, png="5\nPoziom", poziom=5},
{podswietlanie=true, scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=2, x=sx/2+150*skala, y=sy/2-25*skala, w=130*skala, h=130*skala, png="6\nPoziom", poziom=6},
{scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=2, x=sx/2-260*skala, y=sy/2+120*skala, w=520*skala, h=50*skala, png="Rozpocznij prac?"},
{scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=2, x=sx/2-260*skala, y=sy/2+180*skala, w=520*skala, h=50*skala, png="Wr??", btn=buttonred},
{scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=3, x=sx/2-260*skala, y=sy/2+120*skala, w=520*skala, h=50*skala, png="Zako?cz prac?"},
{scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=3, x=sx/2-260*skala, y=sy/2+180*skala, w=520*skala, h=50*skala, png="Wr??", btn=buttonred},
{scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=4, x=sx/2-260*skala, y=sy/2+120*skala, w=520*skala, h=50*skala, png="Odbierz"},
{scrlX=0, clr={230,230,230}, clr_napis={255,255,255}, alpha=255, strona=4, x=sx/2-260*skala, y=sy/2+180*skala, w=520*skala, h=50*skala, png="Wr??", btn=buttonred},
}
end
)
btn_refresh()
local header={
{strona=1, txt="Praca dorywcza - Magazynier"},
{strona=2, txt="Wybierz poziom"},
{strona=3, txt="Zaka?czanie pracy"},
{strona=4, txt="Odbierz wyp?at?"},
}
local dxdraw=(
function()
local kx, ky = getCursorPosition()
kx = kx*sx
ky = ky*sy
--dxDrawRectangle(recX,recY,recX2,recY2,tocolor(0,0,0,140))--podstawa
--dxDrawRectangle(recX,recY,recX2,50,tocolor(0,0,0,140))--pasek na g?rze
dxDrawRectangle(sx/2-450*skala,sy/2-255*skala,900*skala,510*skala,tocolor(255,255,255,180))
dxDrawRectangle(sx/2-450*skala,sy/2-255*skala,900*skala,60*skala,tocolor(255,255,255,100))
for i,v in ipairs(header) do
if strona==v.strona then
dxDrawText(v.txt, sx/2+150*skala,sy/2-271*skala,sx/2-150*skala,sy/2-180*skala, tocolor(15, 15, 15, 210), 1.00, LatoBlack25, "center", "center", false, false, false, false)
end
end
if not tick1 then
tick1=getTickCount()
end
local tick2=getTickCount()
local roznica=tick2-tick1
tick1=getTickCount()
for i,v in ipairs(btn) do
if (strona==v.strona) then
if (kx >= v.x) and (kx <= v.x+v.w) and (ky >= v.y) and (ky <= v.y+v.h) then
dxDrawImage(v.x, v.y, v.w, v.h, v.btn or button, v.rot or 0, 0, 0, tocolor(255, 255, 255, 255))
dxDrawText(v.png, v.x, v.y, v.x+v.w, v.y+v.h, tocolor(v.clr_napis[1] or 255,v.clr_napis[2] or 255,v.clr_napis[3] or 255,220), 1, v.czcionka or LatoBold20 or altFont, "center", "center")
else
dxDrawImage(v.x, v.y, v.w, v.h, v.btn or button, v.rot or 0, 0, 0, tocolor(255, 255, 255, 255))
dxDrawRectangle(v.x, v.y, v.w+v.scrlX, v.h, tocolor(v.clr[1] or 230,v.clr[2] or 230,v.clr[3] or 230, v.alpha or 255))
dxDrawText(v.png, v.x, v.y, v.x+v.w, v.y+v.h, tocolor(35,35,35,205), 1, v.czcionka or LatoBold20 or altFont, "center", "center")
end
end
end
for i,v in ipairs(napisy) do
if (strona==v.strona) then
dxDrawText(v.txt, v.x, v.y, sx/2+1*skala, sy/2+1*skala, tocolor(255, 255, 255, 255), 1, v.cz or LatoBold15 or altFont, "center", "center", false, false, false, true)
end
end
end
)
local namierzanie=(
function()
if not getElementData(localPlayer, "3dtext_status") then
return
end
if not varout.marker or not isElement(varout.marker) then
return
end
--local px,py,pz=getCameraMatrix(localPlayer)
--local x,y,z=getElementPosition(varout.marker)
--local _,_,rrz=getElementRotation(localPlayer)
--local rrz3=math.rad(rrz)
--local tx=px - (1 * math.sin(-rrz3))
--local ty=py - (1 * math.cos(-rrz3))
--dxDrawMaterialLine3D(x, y, z+3,x, y, z+2, img, 1, tocolor(255,255,255,255), tx,ty,z)
local rootx, rooty, rootz = getCameraMatrix()--getElementPosition(getLocalPlayer())
local x,y,z=getElementPosition(varout.marker)
local distance = getDistanceBetweenPoints3D(rootx, rooty, rootz, x, y, z)
--if (distance<=20) then
local screenx,screeny = getScreenFromWorldPosition(x,y,z+2, 200)
if (screenx and screeny) then
dxDrawText("↓", screenx-(sx/5),screeny,screenx+(sx/5),screeny, tocolor(255,255,0,255), 1, czc65, "center","center",false,true)
end
--end
end
)
function getElementSpeed(theElement, unit)
-- Check arguments for errors
assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")")
assert(getElementType(theElement) == "player" or getElementType(theElement) == "ped" or getElementType(theElement) == "object" or getElementType(theElement) == "vehicle", "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType(theElement) .. ")")
assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)")
-- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number
unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit))
-- Setup our multiplier to convert the velocity to the specified unit
local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456)
-- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit
return (Vector3(getElementVelocity(theElement)) * mult).length
end
addEvent("evc", true)
addEventHandler("evc", resourceRoot,
function(ev,arg1,arg2)
if (ev=="wlacz_okno") then
if arg1 then
if wlaczony then
return
end
if arg2 then
var.z_p=arg2
end
blur=exports.blur_box:createBlurBox(sx/2-450*skala,sy/2-255*skala,900*skala,510*skala, 255, 255, 255, 180, false)
addEventHandler("onClientRender", root, dxdraw)
wlaczony=true
showCursor(true,false)
guiSetInputMode("no_binds")
setElementData(localPlayer, "3dtext_status", false)
elseif not arg1 then
if not wlaczony then
return
end
if blur then
exports.blur_box:destroyBlurBox(blur)
blur=nil
end
removeEventHandler("onClientRender", root, dxdraw)
wlaczony=false
showCursor(false,false)
guiSetInputMode("allow_binds")
strona=1
tick1=nil
blokada=false
var={}
setElementData(localPlayer, "3dtext_status", true)
napisy_refresh()
btn_refresh()
--[[
if getElementData(localPlayer,"magazynier:ma_paczke") then
toggleControl("walk", false)
toggleControl("crouch", false)
toggleControl("sprint", false)
toggleControl("jump", false)
setControlState("walk", true)
end
]]
end
elseif (ev=="zwroc_exp") then
local ex=arg1
local lvl=1
btn_refresh()
for i,v in ipairs(lvl_do_exp) do
if (ex>=v.experience) then
lvl=v.poziom
end
end
for i,v in ipairs(btn) do
if (v.strona==2) and v.poziom then
if (lvl<v.poziom) then
v.podswietlanie=false
v.alphamin=20
end
end
end
strona=2
blokada=false
elseif (ev=="zwroc_staty") then
local dane=arg1
local lvl=1
for i,v in ipairs(lvl_do_exp) do
if (dane.exp>=v.experience) then
lvl=v.poziom
end
end
local tekst=string.format("#3f6586• #151515DBID:#3f6586 %d\n#3f6586• #151515Punkty do?wiadczenia:#3f6586 %d\n#3f6586• #151515Do wyp?acenia:#3f6586 %.2f PLN\n#3f6586•#151515 Og?? zarobk?w:#3f6586 %.2f PLN\n#3f6586• #151515Poziom:#3f6586 %d",dane.id,dane.exp,dane.do_wyplacenia/100,dane.ogol_zarobkow/100,lvl)
local z_n=nil
for i,v in ipairs(napisy) do
if (v.strona==3) and (v.edit==1) then
z_n=v
end
end
if not z_n then
return
end
z_n.txt=tekst
strona=3
blokada=false
elseif (ev=="unlock") then
blokada=false
elseif (ev=="zwroc_wyplate") then
local dane=arg1
local tekst=string.format("#151515Do wyp?acenia:#3f6586 %.2f PLN\n#151515Og?? zarobk?w:#3f6586 %.2f PLN#151515",dane.do_wyplacenia/100,dane.ogol_zarobkow/100)
local z_n=nil
for i,v in ipairs(napisy) do
if (v.strona==4) and (v.edit==1) then
z_n=v
end
end
if not z_n then
return
end
z_n.txt=tekst
strona=4
blokada=false
elseif (ev=="namierzanie") then
if arg1 then
if not arg2 or not isElement(arg2) then
return
end
varout.marker=arg2
if not namierzanie_wlaczone then
addEventHandler("onClientRender",root,namierzanie)
namierzanie_wlaczone=true
end
else
if namierzanie_wlaczone then
removeEventHandler("onClientRender",root,namierzanie)
namierzanie_wlaczone=false
end
varout={}
end
elseif (ev=="predkosc") then
local spd=getElementSpeed(localPlayer,"km/h")
if (spd>=2) then
exports["es-komunikaty"]:komunikat("St?j nieruchomo podczas pobierania paczki.")
return
end
if blokada then
return
end
blokada=true
triggerServerEvent("ev",resourceRoot,"predkoscok")
end
end
)
--triggerEvent("evc",resourceRoot,"wlacz_okno",true)
addEventHandler("onClientClick", root,
function(_,state,abx,aby)
if not wlaczony then
return
end
if (state=="up") then
local z_btn=nil --##buttony
for i,v in ipairs(btn) do
if (v.strona==strona) or not v.strona then
if (abx >= v.x) and (abx <= v.x+v.w) and (aby >= v.y) and (aby <= v.y+v.h) then
z_btn=v
end
end
end
if not z_btn then
return
end
playSoundFrontEnd(42)
--[[if not z_btn.strona then
if (z_btn.png=="?") and not z_btn.podpis then
triggerEvent("evc", resourceRoot, "wlacz_okno", false)
end
end]]
if (strona==1) then
if (z_btn.png=="Zamknij") then
triggerEvent("evc", resourceRoot, "wlacz_okno", false)
elseif (z_btn.png=="Rozpocznij prac?") then
if blokada then
return
end
blokada=true
triggerServerEvent("ev",resourceRoot,"pobierz_exp")
elseif (z_btn.png=="Zako?cz prac?") then
if blokada then
return
end
blokada=true
triggerServerEvent("ev",resourceRoot,"pobierz_staty")
elseif (z_btn.png=="Odbierz wyp?at?") then
if blokada then
return
end
blokada=true
triggerServerEvent("ev",resourceRoot,"pobierz_wyplate")
end
elseif (strona==2) then
if (z_btn.png=="Wr??") then
strona=1
elseif (z_btn.png=="Rozpocznij prac?") then
local z_btn2=nil
for i,v in ipairs(btn) do
if v.check and v.poziom and (v.strona==strona) then
z_btn2=v
end
end
if not z_btn2 then
exports["es-komunikaty"]:komunikat("Najpierw wybierz poziom.")
return
end
if blokada then
return
end
blokada=true
if not var.z_p then
exports["es-komunikaty"]:komunikat("B??d #126. Spr?buj ponownie.")
return
end
triggerServerEvent("ev",resourceRoot,"rozpocznij_prace",z_btn2.poziom,var.z_p)
else
if z_btn.poziom then
if not z_btn.podswietlanie then
if z_btn.check then
z_btn.check=nil
z_btn.alpha=z_btn.alphamax
z_btn.podswietlanie=true
return
end
--local ex=150
--for i,v in ipairs(lvl_do_exp) do
-- if (v.poziom==z_btn.poziom) then
-- ex=v.experience
-- end
--end
--exports["es-komunikaty"]:komunikat("Ten poziom nie zosta? jeszcze odblokowany. Wymagane do?wiadczenie: "..ex.." pkt.")
--return
end
local z_btn2=nil
for i,v in ipairs(btn) do
if v.check and v.poziom and (v.strona==strona) then
v.check=nil
v.alpha=v.alphamax
v.podswietlanie=true
z_btn2=v
end
end
if (z_btn~=z_btn2) then
z_btn.podswietlanie=false
z_btn.alpha=0
z_btn.check=true
end
end
end
elseif (strona==3) then
if (z_btn.png=="Wr??") then
strona=1
elseif (z_btn.png=="Zako?cz prac?") then
if blokada then
return
end
blokada=true
triggerServerEvent("ev",resourceRoot,"zakoncz_prace")
end
elseif (strona==4) then
if (z_btn.png=="Wr??") then
strona=1
elseif (z_btn.png=="Odbierz") then
if blokada then
return
end
blokada=true
triggerServerEvent("ev",resourceRoot,"odbierz_wyplate")
end
end
end
--elseif (z_btn.png=="↓") then
-- if (getmax>=scroll*(-1)) then
-- scroll=scroll-35
-- end
--elseif (z_btn.png=="↑") then
-- if (0<scroll*(-1)) then
-- scroll=scroll+35
-- end
--end
end
)
addEventHandler("onClientResourceStop",resourceRoot,
function()
if blur then
exports.blur_box:destroyBlurBox(blur)
blur=nil
end
if not wlaczony then
return
end
guiSetInputMode("allow_binds")
end
)