Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- AUTOR: xMaximerr <xmaximerr.programmer@vp.pl>
- GAMEMODE: foxGaming <foxgaming.pl>
- Nie masz prawa używać tego kodu bez mojej zgody!
- --]]
- local w, h = guiGetScreenSize()
- local tognames=false
- local streamedPlayers={}
- addEventHandler("onClientRender",root,function ()
- if #streamedPlayers == 0 then return end
- for player in ipairs(streamedPlayers) do
- if player ~= localPlayer and getElementData(player, "c:uid") then
- if getElementAlpha(player) == 255 then
- setPlayerNametagShowing ( player, false )
- local cx, cy, cz = getCameraMatrix()
- local x, y, z = getPedBonePosition(player,8)
- local xs, ys, ds = getScreenFromWorldPosition(x,y,z+0.35)
- local nx,ny,nz=getElementPosition(localPlayer)
- local px,py,pz=getElementPosition(player)
- local dist=getDistanceBetweenPoints3D(nx,ny,nz,px,py,pz)
- if xs and ys and ds and dist < 12 then
- if isLineOfSightClear(cx,cy,cz,x,y,z,true,false,false,true,true,true,true,player) then
- local Grupa = nil
- local GrupaShadow = nil
- if getElementData (player,"a:duty")=="Developer" then
- Grupa = "#D621FA(Developer)#D7DABB"
- GrupaShadow = "(Developer)"
- elseif getElementData (player,"a:duty")=="Supporter" then
- Grupa = "#0080FF(Supporter)#D7DABB"
- GrupaShadow = "(Supporter)"
- elseif getElementData (player,"a:duty")=="Manager" then
- Grupa = "#1FBA00(Manager)#D7DABB"
- GrupaShadow = "(Manager)"
- elseif getElementData (player,"a:duty")=="Administrator" then
- Grupa = "#800000(Administrator)#D7DABB"
- GrupaShadow = "(Administrator)"
- elseif getElementData (player, "b:duty") then
- Grupa = "#F29D00("..getElementData(player, "b:duty")..")#D7DABB"
- GrupaShadow = "("..getElementData(player, "b:duty")..")"
- elseif not getElementData(player, "a:duty") or not getElementData(player, "b:duty") then
- Grupa = ""
- GrupaShadow = ""
- end
- local id=getElementData(player,"k:id")
- if id then
- if not isPedDead (player) then
- text="("..id..") "..string.gsub(getPlayerName(player),"_"," ").." "..Grupa..""
- shadow="("..id..") "..string.gsub(getPlayerName(player),"_"," ").." "..GrupaShadow..""
- else
- text="#212121("..id..") "..string.gsub(getPlayerName(player),"_"," ").." "..Grupa..""
- shadow="("..id..") "..string.gsub(getPlayerName(player),"_"," ").." "..GrupaShadow..""
- end
- if tognames==false then
- local alpha, scale, alpha_shadow = interpolateBetween(185, 1.12, 80, 0, 0.8, 0, dist/12, "Linear")
- if getElementData(player,"n:damage") then
- if getPedOccupiedVehicle(player) then
- if getElementData(getPedOccupiedVehicle(player), "player:folia") then
- dxDrawText(text,xs,ys,xs,ys,tocolor(178,0,0,alpha),scale/2,"sens","center","center",false,false,false,true,false)
- dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale/2,"sens","center","center",false,false,false,true,false)
- else
- dxDrawText(text,xs,ys,xs,ys,tocolor(178,0,0,alpha),scale,"sens","center","center",false,false,false,true,false)
- dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale,"sens","center","center",false,false,false,true,false)
- end
- else
- dxDrawText(text,xs,ys,xs,ys,tocolor(178,0,0,alpha),scale,"sens","center","center",false,false,false,true,false)
- dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale,"sens","center","center",false,false,false,true,false)
- end
- else
- if getPedOccupiedVehicle(player) then
- if getElementData(getPedOccupiedVehicle(player), "player:folia") then
- dxDrawText(text,xs,ys,xs,ys,tocolor(238,252,220,alpha),scale/2,"sens","center","center",false,false,false,true,false)
- dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale/2,"sens","center","center",false,false,false,true,false)
- else
- dxDrawText(text,xs,ys,xs,ys,tocolor(238,252,220,alpha),scale,"sens","center","center",false,false,false,true,false)
- dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale,"sens","center","center",false,false,false,true,false)
- end
- else
- dxDrawText(text,xs,ys,xs,ys,tocolor(238,252,220,alpha),scale,"sens","center","center",false,false,false,true,false)
- dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale,"sens","center","center",false,false,false,true,false)
- end
- end
- iconsCount={}
- if getElementData(player,"c:fame") then
- table.insert(iconsCount, "img/fame.png")
- end
- if getElementData(player,"n:AFK") then
- table.insert(iconsCount, "img/afk.png")
- end
- if getElementData(player,"n:pmNotif") then
- table.insert(iconsCount, "img/pm.png")
- end
- if getElementData(player,"n:typing") then
- table.insert(iconsCount, "img/type.png")
- end
- for k,player in ipairs(iconsCount) do
- if k <= 2 then
- width = 45 * (k - 1)
- elseif k > 2 then
- width = -23 * (k - 1)
- end
- local alpha_icon = interpolateBetween(200, 0, 0, 0, 0, 0, dist/12, "Linear")
- dxDrawImage(xs-20-width, ys - 50, 50, 50, player, 0, 0, 0, tocolor(255, 255, 255, alpha_icon))
- end
- end
- end
- if isChatBoxInputActive() then
- if not getElementData(localPlayer, "n:typing") then
- setElementData(localPlayer,"n:typing", true)
- end
- elseif not isChatBoxInputActive() and not isConsoleActive() then
- if getElementData(localPlayer, "n:typing") then
- setElementData(localPlayer,"n:typing", false)
- end
- end
- end
- end
- end
- end
- end
- end)
- function onDamage(attacker, weapon, bodypart)
- if not isTimer(timer) then
- setElementData(localPlayer, "n:damage", true)
- fadeCamera ( false, 2.0, 80, 0, 0 )
- timer = setTimer(function()
- setElementData(localPlayer, "n:damage", false)
- fadeCamera(true, 0.5)
- end, 1000, 1)
- end
- end
- addEventHandler ( "onClientPlayerDamage", localPlayer, onDamage )
- function onClientToggleNicknames(cmd, arg)
- if arg == "names" then
- if tognames==false then
- tognames=true
- exports.rp_notifications:showBox("Nickname'y zostały ukryte.")
- else
- tognames=false
- exports.rp_notifications:showBox("Nickname'y zostały pokazane.")
- end
- end
- end
- addCommandHandler ( "tog", onClientToggleNicknames )
- addEventHandler("onClientElementStreamIn", root, function()
- if getElementType(source) == "player" then
- streamedPlayers[source] = true
- outputDebugString("STREAMIN: "..getPlayerName(source))
- end
- end)
- addEventHandler("onClientElementStreamOut", root, function()
- if getElementType(source) == "player" then
- streamedPlayers[source] = nil
- outputDebugString("STREAMOUT: "..getPlayerName(source))
- end
- end)
- addEventHandler("onClientPlayerSpawn", root, function()
- for k, v in pairs(getElementByType("player")) do
- if isElementStreamedIn(v) then
- streamedPlayers[v] = true
- outputDebugString("STREAMINGIN: "..getPlayerName(v))
- end
- end
- local function putStreamedPlayersInTable()
- for k, v in pairs(getElementByType("player")) do
- if isElementStreamedIn(v) then
- streamedPlayers[v] = true
- outputDebugString("STREAMINGIN: "..getPlayerName(v))
- end
- end
- end
- addEventHandler("onClientPlayerSpawn", root, putStreamedPlayersInTable)
- addEventHandler("onClientResourceStart", root, putStreamedPlayersInTable)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement