Jump to content

TorNix~|nR

Members
  • Posts

    503
  • Joined

  • Last visited

Everything posted by TorNix~|nR

  1. srfont = dxCreateFont("tag.ttf",13) g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_Players = getElementsByType('player') g_Me = getLocalPlayer() nametag = {} local nametags = {} local g_screenX,g_screenY = guiGetScreenSize() local bHideNametags = false local NAMETAG_SCALE = 0.5 --Overall adjustment of the nametag, use this to resize but constrain proportions local NAMETAG_ALPHA_DISTANCE = 5--Distance to start fading out local NAMETAG_DISTANCE = 50--Distance until we're gone local NAMETAG_ALPHA = 50--The overall alpha level of the nametag --The following arent actual pixel measurements, they're just proportional constraints local NAMETAG_TEXT_BAR_SPACE = 5 local NAMETAG_WIDTH = 50 local NAMETAG_HEIGHT = 5 local NAMETAG_WIDTH2 = 50 local NAMETAG_HEIGHT2 = 3.5 local NAMETAG_TEXTSIZE = 0.3 local NAMETAG_TEXTSIZE2 = 0.2 local NAMETAG_OUTLINE_THICKNESS = 1.2 -- local NAMETAG_ALPHA_DIFF = NAMETAG_DISTANCE - NAMETAG_ALPHA_DISTANCE NAMETAG_SCALE = 1/NAMETAG_SCALE * 800 / g_screenY -- Ensure the name tag doesn't get too big local maxScaleCurve = { {0, 0}, {3, 3}, {13, 5} } -- Ensure the text doesn't get too small/unreadable local textScaleCurve = { {0, 0.8}, {0.8, 1.2}, {99, 99} } -- Make the text a bit brighter and fade more gradually local textAlphaCurve = { {0, 0}, {25, 100}, {120, 190}, {255, 190} } function nametag.create ( player ) nametags[player] = true end function nametag.destroy ( player ) nametags[player] = nil end function creaTagDx () -- Hideous quick fix -- for i,player in ipairs(g_Players) do if isElement(player) then if player ~= g_Me then setPlayerNametagShowing ( player, false ) if not nametags[player] then if not getElementData(player,"Tag") then nametag.create ( player ) else nametag.destroy ( player ) --cancelEvent() end end end end end if bHideNametags then return end local x,y,z = getCameraMatrix() for player in pairs(nametags) do while true do if not isElement(player) then break end if getElementData(player,"Tag") and getElementData(player,"Tag") == true then break end if getElementDimension(player) ~= getElementDimension(g_Me) then break end local px,py,pz = getElementPosition ( player ) if processLineOfSight(x, y, z, px, py, pz, true, false, false, true, false, true) then break end local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if pdistance <= NAMETAG_DISTANCE then --Get screenposition local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) if not sx or not sy then break end --Calculate our components local scale = 1/(NAMETAG_SCALE * (pdistance / NAMETAG_DISTANCE)) local alpha = ((pdistance - NAMETAG_ALPHA_DISTANCE) / NAMETAG_ALPHA_DIFF) alpha = (alpha < 0) and NAMETAG_ALPHA or NAMETAG_ALPHA-(alpha*NAMETAG_ALPHA) scale = math.evalCurve(maxScaleCurve,scale) local textscale = math.evalCurve(textScaleCurve,scale) local textalpha = math.evalCurve(textAlphaCurve,alpha) local outlineThickness = NAMETAG_OUTLINE_THICKNESS*(scale) --Draw our text local r,g,b = getPlayerNametagColor(player) local offset = (scale) * NAMETAG_TEXT_BAR_SPACE/2 local w = dxGetTextWidth(getPlayerNameR(player), textscale * NAMETAG_TEXTSIZE, srfont) / 2 local wanted = getElementData(player, "Zombie kills") dxDrawText ("ZK: [ "..tostring(wanted).." ]", sx, sy + 6, sx, sy + 6, tocolor(0,255,0,255), textscale*NAMETAG_TEXTSIZE2, srfont, "center", "bottom", false, false, false ) dxDrawText ( getPlayerNameR(player), sx, sy - offset, sx, sy - offset, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false, false, false ) dxDrawColorText ( getPlayerName(player), sx-w, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false, false, false ) local drawX = sx - NAMETAG_WIDTH*scale/2 drawY = sy + offset local width,height = NAMETAG_WIDTH*scale, NAMETAG_HEIGHT*scale dxDrawRectangle ( drawX, drawY, width, height, tocolor(255,0,0,50) ) -- health local health local p local r,g health = getElementHealth ( player ) health = math.max(health, 0)/100 p = -510*(health^2) r,g = math.max(math.min(p + 255*health + 255, 255), 0), math.max(math.min(p + 765*health, 255), 0) if health > 1.0 then health = 1.0 end dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, width - outlineThickness*2, height - outlineThickness*2, tocolor(0,0,0,50) ) dxDrawRectangle ( drawX + outlineThickness, drawY + outlineThickness, health*(width - outlineThickness*2), height - outlineThickness*2, tocolor(0,255,50,150) ) -- ammo local drawX2 = sx - NAMETAG_WIDTH2*scale/2 drawY2 = sy + offset local width2,height2 = NAMETAG_WIDTH2*scale, NAMETAG_HEIGHT2*scale local armor local q local n,k armor = getPedArmor( player ) armor = math.max(armor, 0)/100 q = -510*(armor^2) n,k = math.max(math.min(q + 255*armor+ 255, 255), 0), math.max(math.min(q + 765*armor, 255), 0) if armor > 1.0 then armor = 1.0 end dxDrawRectangle ( drawX2 + outlineThickness, drawY2 + outlineThickness, width2 - outlineThickness*2, height2 - outlineThickness*2, tocolor(0,0,0,50) ) dxDrawRectangle ( drawX2 + outlineThickness, drawY2 + outlineThickness, armor*(width2 - outlineThickness*2), height2 - outlineThickness*2, tocolor(200,200,200,255) ) end break end end end addEventHandler ( "onClientRender", g_Root, creaTagDx ) ---------------THE FOLLOWING IS THE MANAGEMENT OF NAMETAGS----------------- addEventHandler('onClientResourceStart', g_ResRoot, function() for i,player in ipairs(getElementsByType"player") do if player ~= g_Me then nametag.create ( player ) end end end ) addEventHandler ( "onClientPlayerJoin", g_Root, function() if source == g_Me then return end setPlayerNametagShowing ( source, false ) nametag.create ( source ) end ) addEventHandler ( "onClientPlayerQuit", g_Root, function() nametag.destroy ( source ) end ) -- Math functions function math.lerp(from,to,alpha) return from + (to-from) * alpha end -- curve is { {x1, y1}, {x2, y2}, {x3, y3} ... } function math.evalCurve( curve, input ) -- First value if input<curve[1][1] then return curve[1][2] end -- Interp value for idx=2,#curve do if input<curve[idx][1] then local x1 = curve[idx-1][1] local y1 = curve[idx-1][2] local x2 = curve[idx][1] local y2 = curve[idx][2] -- Find pos between input points local alpha = (input - x1)/(x2 - x1); -- Map to output points return math.lerp(y1,y2,alpha) end end -- Last value return curve[#curve][2] end function removeColorCoding ( name ) return type(name)=='string' and string.gsub ( name, '#%x%x%x%x%x%x', '' ) or name end function getPlayerNameR ( player ) return removeColorCoding ( getPlayerName ( player ) ) end function dxDrawColorText(str, ax, ay, bx, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) ax = ax + w color = tocolor(tonumber("0x"..string.sub(col, 1, 2)), tonumber("0x"..string.sub(col, 3, 4)), tonumber("0x"..string.sub(col, 5, 6)), 255) end last = e+1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) end end I'm using the invisible vehicle too, can you add it please?
  2. TorNix~|nR

    Name Tag

    Hello guys, I'm using custom nametag show when I use player invisibility (setElementAlpha) The nametag doesn't disabled, only it works on default nametag Invisible Code setElementAlpha(source, 0) setPlayerNametagShowing(source, false) Help please?
  3. ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Hello everyone, LOS SANTOS Zombies Infection is released since 2014 it's a Zombie RPG Game Mode, You can kill zombies and bosses and get money, get clans, get stats and power , to buy for example: weapons, vehicles, houses etc Welcome, and enjoy ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ FEATURES: . Clan System . Hud System . Jail System . Job System . Vehicle System . Zombie System ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ PHOTOS: ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ OFFICIAL VIDEO: ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Server Statue: ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ LS Informations: Zombie Server IP: mtasa://149.56.13.31:22003 Freeroam Server IP: mtasa://149.56.13.31:22004 TeamSpeak Server: 149.56.13.31 Server Old Forum: www.ls-infection.xyz Server New Forum: https://www.facebook.com/groups/los.santos.community Server STAFF: TorNix~|nR ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
  4. TorNix~|nR

    Chat

    It's finally worked, thank you so much guys
  5. TorNix~|nR

    Chat

    it's just server-side, there is no client-side. if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("TEST")) then outputChatBox("[TEST] "..getPlayerName(source)..": #FFFFFF"..msg, getRootElement(), 255, 0, 0, true)
  6. TorNix~|nR

    Chat

    @#BrosS Yes ACL & Team tags
  7. TorNix~|nR

    Chat

    it's server-side, but not worked
  8. Thank you so much @NeXuS™
  9. TorNix~|nR

    Chat

    guys it's not worked what I want when player join, he can't use chat, when he log in he can, you understand? help please ?
  10. Hello guys, I have a kill command script, it works fine, but it bugs you can use /kill many times, I want to disable the /kill while its on progress help? addCommandHandler('kill', function(kill) setTimer(killPed, 10000, 1, kill) setElementFrozen (kill, true) end ) function Respawn (kill) setElementFrozen (kill, false) end addEventHandler ("onPlayerRespawn", kill, respawn)
  11. TorNix~|nR

    Chat

    @Fist, I'm sorry but I didn't understand
  12. zombies script of @Slothman that engine sound, bugs when I start the zombies script there is nothing on debugscript/console, and I have not code that caused this bug when I started zombies script, it bugs
  13. TorNix~|nR

    NameTag

    hello guys, I want to make the default nametagtext with default-bold not default font anyone helpme please?
  14. hello guys, when I turn on the zombies script on my server, the vehicles sound starts bug that sound of engine, help please?
  15. TorNix~|nR

    Chat

    hello guys, I want to disable the chat onPlayerJoin when the player is downloading only onPlayerLogin, can use chat, help me please,?
  16. same problem Done, thanks I fix it by myself, thank you so much @Pembo
  17. Bad argument @ 'createVehicle' [Expected number at argument 1, got boolean] Bad argument @ 'setVehicleColor' [Expected element at argument 1, got boolean] Bad argument @ 'warpPedIntoVehicle' [Expected vehicle at argument 2, got boolean]
  18. veh = {} addEvent ("getCar", true) addEventHandler ("getCar", getRootElement(), function(car) if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) veh[source] = nil end local carID = getVehicleModelFromName (car) local x,y,z = getElementPosition(source) local carName = getVehicleNameFromModel (carID) veh[source] = createVehicle(carID, x,y,z) setVehicleColor(veh[source], 255, 150, 0) warpPedIntoVehicle(source, veh[source]) end )
  19. @Pembo It's worked, no more free click, but I can not spawn it with the button the button won't work help please GUIEditor.button[1] I forget upload this, if it can help you for i,v in ipairs (cars) do local carName = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (GUIEditor.gridlist[1]) guiGridListSetItemText (GUIEditor.gridlist[1], row, 1, i.."", false, true) guiGridListSetItemText (GUIEditor.gridlist[1], row, 2, carName, false, true) guiGridListSetItemColor(GUIEditor.gridlist[1], row, 1, 255, 255, 255, 255) end
  20. TorNix~|nR

    GUI Click

    hello guys, I have a panel worked fine, but there is a little problem I have a button of Get Vehicle to spawn with it a vehicle, but I can spawn vehicle on all the window if I want to spawn vehicle? I click on whatever place on window, and done how to fix it only with the Get Vehicle button Code addEventHandler ("onClientGUIClick", GUIEditor.button[2], function (button, state, absoluteX, absoluteYe) guiSetVisible(GUIEditor.window[1],false) showCursor(false) end) function trigger () if (guiGridListGetSelectedItem (GUIEditor.gridlist[1])) then local car = guiGridListGetItemText (GUIEditor.gridlist[1], guiGridListGetSelectedItem (GUIEditor.gridlist[1]), 2) if car == "" or car == nil then return end triggerServerEvent ("getCar", getLocalPlayer(), car) guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end addEventHandler ("onClientGUIClick", GUIEditor.button[1], function (button, state, absoluteX, absoluteYe) trigger(getLocalPlayer()) playSound ("fail.mp3") end) addEventHandler ("onClientGUIDoubleClick", GUIEditor.gridlist[1], function (button, state, absoluteX, absoluteYe) trigger(getLocalPlayer()) playSound ("fail.mp3") end) Help please?
  21. now the ./mta-server -d is working fine, I use the ./mta-server to see the bug libz.so.1: cannot open shared object file: No such file or directory ERROR: Loading network library (net.so) failed! Press Q to shut down the server! Help please? Ah done I fix it, thank you guys, if you get this problem use this yum install zlib.i686 thank you @ccw for everything
  22. Package ncurses-devel-5.7-4.20090207.el6.x86_64 already installed and latest version Nothing to do is there a solution? this is the first time I get this
×
×
  • Create New...