Advertisement
Cherro

dwdwd

May 26th, 2017
584
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.50 KB | None | 0 0
  1. --[[
  2.             AUTOR: xMaximerr <xmaximerr.programmer@vp.pl>
  3.             GAMEMODE: foxGaming <foxgaming.pl>
  4.             Nie masz prawa używać tego kodu bez mojej zgody!
  5. --]]
  6.  
  7. local w, h = guiGetScreenSize()
  8. local tognames=false
  9. local streamedPlayers={}
  10.  
  11. addEventHandler("onClientRender",root,function ()
  12.     if #streamedPlayers == 0 then return end
  13.     for player in ipairs(streamedPlayers) do
  14.         if player ~= localPlayer and getElementData(player, "c:uid") then
  15.             if getElementAlpha(player) == 255 then
  16.                 setPlayerNametagShowing ( player, false )
  17.                 local cx, cy, cz = getCameraMatrix()
  18.                 local x, y, z = getPedBonePosition(player,8)
  19.                 local xs, ys, ds = getScreenFromWorldPosition(x,y,z+0.35)
  20.                 local nx,ny,nz=getElementPosition(localPlayer)
  21.                 local px,py,pz=getElementPosition(player)
  22.                 local dist=getDistanceBetweenPoints3D(nx,ny,nz,px,py,pz)
  23.                
  24.                 if xs and ys and ds and dist < 12 then
  25.                     if isLineOfSightClear(cx,cy,cz,x,y,z,true,false,false,true,true,true,true,player) then
  26.                         local Grupa = nil
  27.                         local GrupaShadow = nil
  28.                         if getElementData (player,"a:duty")=="Developer" then
  29.                             Grupa = "#D621FA(Developer)#D7DABB"
  30.                             GrupaShadow = "(Developer)"
  31.                         elseif getElementData (player,"a:duty")=="Supporter" then
  32.                             Grupa = "#0080FF(Supporter)#D7DABB"
  33.                             GrupaShadow = "(Supporter)"
  34.                         elseif getElementData (player,"a:duty")=="Manager" then
  35.                             Grupa = "#1FBA00(Manager)#D7DABB"
  36.                             GrupaShadow = "(Manager)"
  37.                         elseif getElementData (player,"a:duty")=="Administrator" then
  38.                             Grupa = "#800000(Administrator)#D7DABB"
  39.                             GrupaShadow = "(Administrator)"
  40.                         elseif getElementData (player, "b:duty") then
  41.                             Grupa = "#F29D00("..getElementData(player, "b:duty")..")#D7DABB"
  42.                             GrupaShadow = "("..getElementData(player, "b:duty")..")"
  43.                         elseif not getElementData(player, "a:duty") or not getElementData(player, "b:duty") then
  44.                             Grupa = ""
  45.                             GrupaShadow = ""
  46.                         end
  47.                             local id=getElementData(player,"k:id")
  48.                         if id then
  49.                             if not isPedDead (player) then
  50.                                 text="("..id..") "..string.gsub(getPlayerName(player),"_"," ").." "..Grupa..""
  51.                                 shadow="("..id..") "..string.gsub(getPlayerName(player),"_"," ").." "..GrupaShadow..""
  52.                             else
  53.                                 text="#212121("..id..") "..string.gsub(getPlayerName(player),"_"," ").." "..Grupa..""
  54.                                 shadow="("..id..") "..string.gsub(getPlayerName(player),"_"," ").." "..GrupaShadow..""
  55.                             end
  56.  
  57.                             if tognames==false then
  58.                                 local alpha, scale, alpha_shadow = interpolateBetween(185, 1.12, 80, 0, 0.8, 0, dist/12, "Linear")
  59.  
  60.                                 if getElementData(player,"n:damage") then
  61.                                     if getPedOccupiedVehicle(player) then
  62.                                         if getElementData(getPedOccupiedVehicle(player), "player:folia") then
  63.                                             dxDrawText(text,xs,ys,xs,ys,tocolor(178,0,0,alpha),scale/2,"sens","center","center",false,false,false,true,false)
  64.                                             dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale/2,"sens","center","center",false,false,false,true,false)
  65.                                         else
  66.                                             dxDrawText(text,xs,ys,xs,ys,tocolor(178,0,0,alpha),scale,"sens","center","center",false,false,false,true,false)
  67.                                             dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale,"sens","center","center",false,false,false,true,false)
  68.                                         end
  69.                                     else
  70.                                         dxDrawText(text,xs,ys,xs,ys,tocolor(178,0,0,alpha),scale,"sens","center","center",false,false,false,true,false)
  71.                                         dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale,"sens","center","center",false,false,false,true,false)
  72.                                     end
  73.                                 else
  74.                                     if getPedOccupiedVehicle(player) then
  75.                                         if getElementData(getPedOccupiedVehicle(player), "player:folia") then
  76.                                             dxDrawText(text,xs,ys,xs,ys,tocolor(238,252,220,alpha),scale/2,"sens","center","center",false,false,false,true,false)
  77.                                             dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale/2,"sens","center","center",false,false,false,true,false)
  78.                                         else
  79.                                             dxDrawText(text,xs,ys,xs,ys,tocolor(238,252,220,alpha),scale,"sens","center","center",false,false,false,true,false)
  80.                                             dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale,"sens","center","center",false,false,false,true,false) 
  81.                                         end
  82.                                     else
  83.                                         dxDrawText(text,xs,ys,xs,ys,tocolor(238,252,220,alpha),scale,"sens","center","center",false,false,false,true,false)
  84.                                         dxDrawText(shadow,xs+3,ys+2,xs,ys,tocolor(0,0,0,alpha_shadow),scale,"sens","center","center",false,false,false,true,false)
  85.                                     end
  86.                                 end
  87.  
  88.                                 iconsCount={}
  89.  
  90.                                 if getElementData(player,"c:fame") then
  91.                                     table.insert(iconsCount, "img/fame.png")
  92.                                 end
  93.  
  94.                                 if getElementData(player,"n:AFK") then
  95.                                     table.insert(iconsCount, "img/afk.png")
  96.                                 end
  97.  
  98.                                 if getElementData(player,"n:pmNotif") then
  99.                                     table.insert(iconsCount, "img/pm.png")
  100.                                 end
  101.  
  102.                                 if getElementData(player,"n:typing") then
  103.                                     table.insert(iconsCount, "img/type.png")
  104.                                 end
  105.  
  106.                                 for k,player in ipairs(iconsCount) do
  107.                                     if k <= 2 then
  108.                                         width = 45 * (k - 1)
  109.                                     elseif k > 2 then
  110.                                         width = -23 * (k - 1)
  111.                                     end
  112.  
  113.                                     local alpha_icon = interpolateBetween(200, 0, 0, 0, 0, 0, dist/12, "Linear")
  114.                                     dxDrawImage(xs-20-width, ys - 50, 50, 50, player, 0, 0, 0, tocolor(255, 255, 255, alpha_icon))
  115.                                 end
  116.                             end
  117.                         end
  118.  
  119.  
  120.                         if isChatBoxInputActive() then
  121.                             if not getElementData(localPlayer, "n:typing") then
  122.                                 setElementData(localPlayer,"n:typing", true)
  123.                             end
  124.                         elseif not isChatBoxInputActive() and not isConsoleActive() then
  125.                             if getElementData(localPlayer, "n:typing") then
  126.                                 setElementData(localPlayer,"n:typing", false)
  127.                             end
  128.                         end
  129.                     end
  130.                 end
  131.             end
  132.         end
  133.     end
  134. end)
  135.  
  136. function onDamage(attacker, weapon, bodypart)
  137.     if not isTimer(timer) then
  138.         setElementData(localPlayer, "n:damage", true)
  139.         fadeCamera ( false, 2.0, 80, 0, 0 )  
  140.         timer = setTimer(function()
  141.             setElementData(localPlayer, "n:damage", false)
  142.             fadeCamera(true, 0.5)
  143.         end, 1000, 1)
  144.     end
  145. end
  146. addEventHandler ( "onClientPlayerDamage", localPlayer, onDamage )
  147.  
  148. function onClientToggleNicknames(cmd, arg)
  149.     if arg == "names" then
  150.         if tognames==false then
  151.             tognames=true
  152.             exports.rp_notifications:showBox("Nickname'y zostały ukryte.")
  153.         else
  154.             tognames=false
  155.             exports.rp_notifications:showBox("Nickname'y zostały pokazane.")
  156.         end
  157.     end
  158. end
  159. addCommandHandler ( "tog", onClientToggleNicknames )
  160.  
  161. addEventHandler("onClientElementStreamIn", root, function()
  162.     if getElementType(source) == "player" then
  163.     streamedPlayers[source] = true
  164.     outputDebugString("STREAMIN: "..getPlayerName(source))
  165.     end
  166. end)
  167.  
  168. addEventHandler("onClientElementStreamOut", root, function()
  169.     if getElementType(source) == "player" then
  170.     streamedPlayers[source] = nil
  171.     outputDebugString("STREAMOUT: "..getPlayerName(source))
  172.     end
  173. end)
  174. addEventHandler("onClientPlayerSpawn", root, function()
  175.     for k, v in pairs(getElementByType("player")) do
  176.         if isElementStreamedIn(v) then
  177.             streamedPlayers[v] = true
  178.             outputDebugString("STREAMINGIN: "..getPlayerName(v))
  179.         end
  180.     end
  181.  
  182.  
  183. local function putStreamedPlayersInTable()
  184.     for k, v in pairs(getElementByType("player")) do
  185.         if isElementStreamedIn(v) then
  186.             streamedPlayers[v] = true
  187.             outputDebugString("STREAMINGIN: "..getPlayerName(v))
  188.         end
  189.     end
  190. end)
  191.  
  192. addEventHandler("onClientPlayerSpawn", root, putStreamedPlayersInTable)
  193. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement