Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sw,sh=guiGetScreenSize()
- local logo_w=sw/8
- local logo_h=logo_w*(133/405)
- local target_cel, target_ograniczenia
- local target_material = dxCreateTexture("i/arrow.png")
- local ss_image
- local vote={}
- local countdown={}
- local playerWarning=false
- local bottom_bar={"","","","","",""}
- local bottombar_scale=(logo_h/2)/dxGetFontHeight(1.0,barFont)
- local stoper_st=nil
- local stoper_width=dxGetTextWidth("00:00.00", 1, lcdFont)
- addEvent("startCountingTime", true)
- addEventHandler("startCountingTime", root, function(state)
- stoper_st = state and getTickCount() or nil
- end)
- addEventHandler("onClientPlayerSpawn", localPlayer, function()
- stoper_st=nil
- end)
- function findRotation(startX, startY, targetX, targetY)
- local t = -math.deg(math.atan2(targetX - startX, targetY - startY))
- if t < 0 then
- t = t + 360
- end
- return t
- end
- local function renderTarget()
- if target_cel then
- if not isElement(target_cel) then
- target_cel=nil
- return
- end
- if target_ograniczenia then
- if target_ograniczenia.inVehicle and isElement(target_ograniczenia.inVehicle) then
- if getPedOccupiedVehicle(localPlayer)~=target_ograniczenia.inVehicle then return end
- end
- if target_ograniczenia.factionId and target_ograniczenia.factionId~=(getElementData(localPlayer,"faction:id") or "") then
- return
- end
- end
- local x1,y1,z1=getWorldFromScreenPosition(sw/2,sh*1/20,15)
- local tx,ty,tz=getElementPosition(target_cel)
- local x0,y0=getElementPosition(localPlayer)
- local dist=math.min(getDistanceBetweenPoints2D(x0,y0,tx,ty),31)
- local alpha=(dist-15)*8
- if alpha<0 then alpha=0 end
- -- 0 = 0
- -- 15 - 0
- -- 32 - 255
- local rz=findRotation(x1,y1,tx,ty)
- local x2,y2,z2=x1,y1,z1-1
- local rrz=math.rad(rz)
- local x2= x2 + (5 * math.sin(-rrz))
- local y2= y2 + (5 * math.cos(-rrz))
- dxDrawMaterialLine3D(x1,y1,z1, x2,y2,z2, target_material, 5, tocolor(255,255,255,alpha), tx,ty,tz)
- end
- end
- local display_stat_pp=getTickCount()-5000
- addEvent("displayStatPP", true)
- addEventHandler("displayStatPP", root, function()
- display_stat_pp=getTickCount()+10000
- end)
- addEventHandler("onClientRender", root, function()
- -- dxDrawImage(sw-389,sh-500, 389,500, "i/babe.jpg")
- -- dxDrawText("Serwer testowy, prosze nie spodziewac sie ze wszystko bedzie dzialac, wyniki gry nie są rejestrowane",0,0)
- if getElementData(localPlayer, "justConnected") then return end
- if (playerWarning) then
- dxDrawRectangle( 100,100,sw-200, sh-200, tocolor(255,0,0,100), true)
- dxDrawText( _("Otrzymałeś/aś ostrzeżenie:"), 100, 100, sw-100, sh/2-20, tocolor(255,255,255), 3.0, "default-bold", "center", "bottom", true, true,true)
- dxDrawText( playerWarning, 100,sh/2+20, sw-100, sh-100, tocolor(0,0,0), 2.0, "default-bold", "center", "top", true, true,true )
- return -- reszty nie pokazujemy bo po co
- end
- renderTarget()
- dxDrawImage(0,sh-logo_h, sw, logo_h, 'i/statusbarbg.png')
- dxDrawImage(8, sh-logo_h, logo_w,logo_h, 'i/bp.png') --405x133
- dxDrawText(bottom_bar[2], logo_w+16+1, sh-logo_h, sw, sh-logo_h/2+1, tocolor(0,0,0), bottombar_scale,barFont,"left","bottom",false,false,false,false)
- dxDrawText(bottom_bar[1], logo_w+16, sh-logo_h, sw, sh-logo_h/2, tocolor(getPlayerNametagColor(localPlayer)), bottombar_scale,barFont,"left","bottom",false,false,false,true,false)
- dxDrawText(bottom_bar[4], logo_w+16+1, sh-logo_h*1/2+1, sw,sh,tocolor(0,0,0),bottombar_scale, barFont, "left","top",false, false, false, true)
- dxDrawText(bottom_bar[3], logo_w+16, sh-logo_h*1/2, sw,sh,-1,bottombar_scale, barFont, "left","top",false, false, false, true)
- dxDrawText(bottom_bar[6], logo_w+16+1, sh-logo_h+1, sw,sh-logo_h/2+1,tocolor(0,0,0),bottombar_scale, barFont, "right","bottom",false, false, false, true)
- dxDrawText(bottom_bar[5], logo_w+16, sh-logo_h, sw,sh-logo_h/2,-1,bottombar_scale, barFont, "right","bottom",false, false, false, true)
- -- stoper
- if stoper_st then
- local czas=getTickCount()-stoper_st
- local czas_t=string.format("%02d:%02d.%02d", czas/60000, (czas/1000)%60, czas%1000/10)
- dxDrawText(czas_t, sw/2-stoper_width/2, 16, sw, 16, tocolor(0,0,60,255), 1, lcdFont, "left", "top")
- end
- local area=getElementData(localPlayer,"area") or 0
- if area==1 then
- local t=_("strefa bez dm")
- dxDrawText(t, 860/1024*sw-1,0-1, sw*970/1024-1, sh/25-1, tocolor(0,0,0,255),1, "pricedown", "center","center")
- dxDrawText(t, 860/1024*sw+1,0+1, sw*970/1024+1, sh/25+1, tocolor(0,0,0,255),1, "pricedown", "center","center")
- dxDrawText(t, 860/1024*sw,0, sw*970/1024, sh/25, tocolor(150,150,250),1, "pricedown", "center","center")
- elseif area==2 then
- local t=_("strefa śmierci")
- dxDrawText(t, 860/1024*sw-1,0-1, sw*970/1024-1, sh/25-1, tocolor(0,0,0,255),1, "pricedown", "center","center")
- dxDrawText(t, 860/1024*sw+1,0+1, sw*970/1024+1, sh/25+1, tocolor(0,0,0,255),1, "pricedown", "center","center")
- dxDrawText(t, 860/1024*sw,0, sw*970/1024, sh/25, tocolor(250,20,20),1, "pricedown", "center","center")
- end
- local pv=getPedOccupiedVehicle(localPlayer)
- if pv then
- drawSpedo()
- local pve=getElementModel(pv)
- if pve==520 or pve==425 then
- drawTargeting()
- end
- end
- local ctrl=(getKeyState("lalt") or getKeyState("ralt")) and (getKeyState("lctrl") or getKeyState("rctrl"))
- if ctrl or getTickCount()-display_stat_pp<5000 then
- dxDrawText("Pojemność płuc",683/800*sw, (90+75)/600*sh, 759/800*sw, (100+75)/600*sh,tocolor(255,255,255),1,"default-small","center","center")
- dxDrawRectangle(683/800*sw, (100+75)/600*sh, 76/800*sw, 11/600*sh, tocolor(0,0,0,255))
- dxDrawRectangle(685/800*sw, (100+77)/600*sh, 72/800*sw, 7/600*sh, tocolor(100,100,255,64))
- local hl=getPedStat(localPlayer, 225)/10
- dxDrawRectangle(685/800*sw, (100+77)/600*sh, 72/800*sw*(hl/100), 7/600*sh, tocolor(100,100,255,255))
- end
- if (vote and vote.timeleft and vote.timeleft>-8 and vote.pytanie) then
- if (vote.timeleft>0) then
- vote.tekst=vote.pytanie .. "\n\n" .. vote.tak.. " /" .. _("TAK").." (".. vote.timeleft .."s) /".. _("NIE").." "..vote.nie
- else
- vote.tekst=vote.pytanie .. "\n\n"
- if (vote.tak>vote.nie) then
- vote.tekst=vote.tekst.._("TAK! (głosów:").." " .. vote.tak ..")"
- elseif (vote.nie>vote.tak) then
- vote.tekst=vote.tekst.._("NIE! (głosów:").." " .. vote.nie ..")"
- else
- vote.tekst=vote.tekst.._("REMIS! (głosów:").." " ..vote.tak.."+".. vote.nie ..")"
- end
- end
- dxDrawText( vote.tekst, 1+sw*2/8, 1+sh*6/9, 1+sw*6/8, 1+sh*8/9, tocolor(0,0,0), 1, "default-bold", "center","bottom",true,true)
- dxDrawText( vote.tekst, sw*2/8, sh*6/9, sw*6/8, sh*8/9, tocolor(255,255,255), 1, "default-bold", "center","bottom",true,true)
- local vcn=((0.2+vote.nie)*sw*2/8)/(vote.tak+vote.nie+0.4)
- local vct=((0.2+vote.tak)*sw*2/8)/(vote.tak+vote.nie+0.4)
- dxDrawLine( sw*4/8, sh*8/9+8, sw*4/8+vcn, sh*8/9+8, tocolor(255,0,0), 6)
- dxDrawLine( sw*4/8, sh*8/9+8, sw*4/8-vct, sh*8/9+8, tocolor(0,255,0), 6)
- end
- for i,v in pairs(countdown) do
- if v<getTickCount()-1000 then
- outputDebugString("a")
- countdown[i]=nil
- if tonumber(i) and tonumber(i)>1 and tonumber(i)<=5 then
- playSound("a/"..tostring(tonumber(i-1))..".ogg")
- end
- elseif v<getTickCount() then
- local scale=math.sqrt(1000-(getTickCount()-v))/20+1
- --[[
- x/2 x/2-250 math.abs(x/2-250) 255-prev
- 1 - 0 0 -250 250
- 250 - 127 127 -127 127
- 500 - 250 250 0 0
- 750 - 127 350 127 127
- 1000 - 0 500 250 250
- ]]--
- local alpha=255-math.abs( (getTickCount()-v)/2-250)
- dxDrawText(tostring(i), sw/2,sh/2,sw/2,sh/2, tocolor(255,255,255,alpha), scale, cdFont, "center", "center")
- end
- end
- if ss_image then
- dxDrawImage( sw/2-320, sh/2-240, 640, 480, ss_image )
- end
- end)
- addEvent("doCountdown", true)
- addEventHandler("doCountdown", root, function(n)
- for i=n,1,-1 do
- countdown[i]=getTickCount()+(n-i)*1000
- end
- playSound("a/"..tostring(tonumber(n))..".ogg")
- end)
- local function getPlayersCount()
- local gracze=getElementsByType("player")
- local vipy,gmy,admini=0,0,0
- for i,v in ipairs(gracze) do
- local r=getElementData(v,"rank")
- if r and r>=2 then
- admini=admini+1
- elseif r and r==1 then
- gmy=gmy+1
- end
- if getElementData(v,"vip") then
- vipy=vipy+1
- end
- end
- return #gracze,vipy,gmy,admini
- end
- local function refreshBars()
- local playTime=getElementData(localPlayer,"playTime")
- if not playTime then return end -- gracz jeszcze nie wszedl do gry
- bottom_bar[1]=getPlayerName(localPlayer).."#6090AA ID:#FFFFFF "..(getElementData(localPlayer, "id") or "-")
- bottom_bar[2]=stripColors(bottom_bar[1])
- bottom_bar[3]=string.format(_("#d9ddfcRespekt:#FFFFFF %d#d9ddfc, Skill:#FFFFFF %d#d9ddfc, Czas gry:#FFFFFF %02dh%02dm"), getElementData(localPlayer, "respect"), getElementData(localPlayer,"skill"), playTime/60, playTime%60)
- bottom_bar[4]=stripColors(bottom_bar[3])
- bottom_bar[5]=string.format(_("#d9ddfcGraczy:#FFFFFF %d#d9ddfc (#FFFF00%d#d9ddfc/#1f1fff%d#d9ddfc/#FF0000%d#d9ddfc)"), getPlayersCount())
- -- bottom_bar[5]=string.format(_("#d9ddfcGraczy:#FFFFFF %d#d9ddfc (#FFFF00%d#d9ddfc/#0fc0fc%d#d9ddfc/#FF0000%d#d9ddfc)"), getPlayersCount())
- bottom_bar[6]=stripColors(bottom_bar[5])
- end
- setTimer(refreshBars, 5000, 0)
- refreshBars()
- function hidePlayerWarning()
- playerWarning=false
- end
- function onPlayerWarningReceived(tresc)
- playSoundFrontEnd(5)
- outputChatBox(" ")
- outputChatBox(" ")
- outputChatBox(_("Otrzymales/as ostrzezenie!"), 255,0,0)
- outputChatBox(tresc, 255,255,255)
- outputChatBox(_("Nie stosowanie sie do ostrzezen moze skutkowac kickiem lub banem!"), 255,0,0)
- outputChatBox(" ")
- outputChatBox(" ")
- playerWarning=tresc
- setTimer(hidePlayerWarning, 7000, 1)
- end
- addEvent("onPlayerWarningReceived",true)
- addEventHandler ( "onPlayerWarningReceived", getRootElement(), onPlayerWarningReceived )
- addEvent("onGlosowanie", true)
- addEventHandler("onGlosowanie", getRootElement(), function(rvote)
- vote=rvote
- end)
- local function checkSpec()
- local ct=getCameraTarget(localPlayer)
- if ct and ct~=localPlayer and getElementType(ct)=="player" then
- setElementInterior(localPlayer, getElementInterior(ct))
- setElementDimension(localPlayer, getElementDimension(ct))
- end
- end
- setTimer(checkSpec, 1000, 0)
- addEvent("onMyClientScreenShot",true)
- addEventHandler( "onMyClientScreenShot", resourceRoot,
- function( pixels )
- if ss_image then
- destroyElement(ss_image)
- end
- ss_image = dxCreateTexture( pixels )
- setTimer(function()
- destroyElement(ss_image)
- ss_image=nil
- end, 5000, 1)
- end
- )
- --bindKey("y","down","chatbox","local")
- function setTarget(cel, ograniczenia)
- target_cel=cel
- target_ograniczenia=ograniczenia
- end
- function clearTarget()
- target_cel=nil
- target_ograniczenia=nil
- end
- addEvent("setTarget", true)
- addEventHandler("setTarget", root, function(ograniczenia,passive)
- if not passive or not target_cel then
- setTarget(source,ograniczenia)
- end
- end)
- addEvent("clearTarget", true)
- addEventHandler("clearTarget", root, function(ograniczenia)
- clearTarget()
- end)
- addEventHandler("onClientResourceStop", resourceRoot, function()
- if target_cel then
- setElementData(localPlayer, "tmp:target_cel", target_cel)
- setElementData(localPlayer, "tmp:target_ograniczenia", target_ograniczenia)
- end
- end)
- if getElementData(localPlayer, "tmp:target_cel") then
- target_cel=getElementData(localPlayer, "tmp:target_cel")
- end
- addEventHandler("onClientPedWasted", localPlayer, clearTarget)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement