• Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Yung_Lungs

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello I have, going to do a ranking of players where considered to be, and their quantity. The entry points I made to the MySQL database, there is written the number of points, the player and continuously updated. 3D GUI also I have done, I give the code below. I would like to make in this GUI was displayed ranking 10 or 5 players with the most points. I have no idea how I make such a ranking. This is beyond my skills. Here is the code for 3D GUI: local renderTarget = dxCreateRenderTarget(1000, 1000, true) local X, Y, Z = -345.5341796875, -1031.6298828125, 59.296432495117 local title_font = dxCreateFont(":server_fonts/main_font.ttf", 63) local ranking_font = dxCreateFont(":server_fonts/main_font.ttf", 50) addEventHandler("onClientRender", root, function() dxSetRenderTarget(renderTarget, true) dxDrawRectangle( 0, 0, 1000, 700, tocolor(72, 71, 81, 190)) -- Background dxDrawText("Job Ranking", 0, 0, 1000, 100, tocolor(255, 255, 255, 255), 1, title_font, "center", "center") -- Text dxDrawText("1. ", -830, 300, 1000, 50, tocolor(255, 255, 255, 255), 1, ranking_font, "center", "center") -- Text dxSetRenderTarget() dxDrawMaterialLine3D( X, Y, Z + 5, X, Y, Z, renderTarget, 5, tocolor(255, 255, 255, 255), -2000, 0, 0) end)
  2. @thisdp hello can you paste there examples for Font functions?
  3. If it was not possible to have them move and sometimes can be. This can be by the duty? The duty can beat and aim and the player who is not on duty may not.
  4. Yes num_8 and num_2. Sometimes it works and sometimes not, or I work and the other person does not.
  5. Hi, I have a question, what determines whether the forklift can raise the forks? Because sometimes I can raise them and sometimes not.
  6. Hello, I have a problem with the script on the notifications. The point is that the notifications show up one what I mean, but if you call it a few times the notification is imposed on each other. I want to show only one and the other to display only when the first one disappears. I have no idea how to do it. Thank you in advance for your help! Here The Code: local cFunc={} local cSetting={} NTSClient={} NTSClient.__index=NTSClient addEvent('onClientAddNotification', true) -- send to client - triggerClientEvent(player, 'onClientAddNotification', player, text, 'type') -- send to all clients - triggerClientEvent(root, 'onClientAddNotification', root, text, 'type') function NTSClient:new(...) local obj=setmetatable({}, {__index=self}) if obj.constructor then obj:constructor(...) end return obj end function NTSClient:render() local now = getTickCount() if now >= self.tick then self.tick = getTickCount()+30 self.count = self.count-2 end local bg_x, bg_y=937, 186 local if self.count==0 and self.nts[1] then self.fadeOut=self.nts[1] table.remove(self.nts, 1) end if self.count<=1 and self.count>0 then self.pos_y=4.7/self.zoom+self.count/self.zoom self.posTXT_y=4.20/self.zoom+self.count/self.zoom elseif self.count==0 then self.pos_y=4.7/self.zoom self.posTXT_y=4.20/self.zoom self.count=280 end if self.fadeOut then self.fadeOut.alpha=math.max(self.fadeOut.alpha-0.005, 0) dxDrawImage(x, self.pos_y, bg_x/self.zoom, bg_y/self.zoom, self.textures[tostring(self.fadeOut.type)], 0, 0, 0, tocolor(255, 255, 255, 255*self.fadeOut.alpha), true) dxDrawText(self.fadeOut.msg, x+(bg_x/6.25/self.zoom), self.posTXT_y, x+(bg_x/7/self.zoom)+bg_x/self.zoom-bg_x/5/self.zoom, self.posTXT_y+(bg_y/self.zoom), tocolor(255, 255, 255, 255*self.fadeOut.alpha), 0.5, self.font1, 'center', 'center', true, true, true) if self.fadeOut.alpha==0 then self.fadeOut=nil end end for i,v in pairs(self.nts) do if i>1 then return end if i>2 then return end v.alpha=math.min(v.alpha+0.065, 1) dxDrawImage(x, self.pos_y+((i-1)*150)/self.zoom, bg_x/self.zoom, bg_y/self.zoom, self.textures[tostring(v.type)], 0, 0, 0, tocolor(255, 255, 255, 255*v.alpha), true) dxDrawText(v.msg, x+(bg_x/6.25/self.zoom), self.posTXT_y+((i-1)*150)/self.zoom, x+(bg_x/7/self.zoom)+bg_x/self.zoom-bg_x/5/self.zoom, self.posTXT_y+(bg_y/self.zoom)+((i-1)*150)/self.zoom, tocolor(255, 255, 255, 255*v.alpha), 0.5, self.font1, 'center', 'center', true, true, true) end end function NTSClient:add(msg, type) if #self.nts==0 then self.count=280 end outputConsole("["..string.upper(type).."] "..msg) table.insert(self.nts, { msg=msg, type=type, alpha=0, tick=getTickCount() }) local snd=playSound('s/' ..type.. '.mp3') setSoundVolume(snd, 0.3) end function NTSClient:onAddNTS(data, type) if not data then return end if not type then return end NTSClass:add(data, type) end function NTSClient:constructor(...) self.count=280 self.fadeOut=nil self.nts={} local sx,sy=guiGetScreenSize(),, sy self.zoom=2.4 self.lu_start=getTickCount() self.pos_y, self.posTXT_y=6/self.zoom, 4/self.zoom self.textures={ ['warning']=dxCreateTexture('i/nts_warning.png', 'dxt5', false, 'wrap'), ['error']=dxCreateTexture('i/nts_error.png', 'dxt5', false, 'wrap'), ['success']=dxCreateTexture('i/nts_success.png', 'dxt5', false, 'wrap'), ['info']=dxCreateTexture('i/nts_info.png', 'dxt5', false, 'wrap'), } self.font=dxCreateFont('f/myriad_prop.ttf', 20) self.font1=dxCreateFont('f/archivo_narrow.ttf', 20) self.funcAddNTS=function(data, type) self:onAddNTS(data, type) end addEventHandler('onClientAddNotification', root, self.funcAddNTS) self.renderFunc=function() self:render() end addEventHandler('onClientRender', root, self.renderFunc) self.tick = 10 end NTSClass=NTSClient:new()
  7. Yung_Lungs


    Hello, I have a problem with the script. The point is that the script showing two messages over my head and i don't know how to fix it thank you in advance for your help! Client Side: local selfVisible = true -- Want to see your own message? local messages = {} -- {text, player, lastTick, alpha, yPos} local textures = {} local timeVisible = 8500 local distanceVisible = 30 local bubble = true -- Rounded rectangle(true) or not(false) function addBubble(text, player, tick) if (not messages[player]) then messages[player] = {} end local width = dxGetTextWidth(text:gsub("#%x%x%x%x%x%x", ""), 1, "default-bold") local _texture = dxCreateRoundedTexture(width+19,29,100) table.insert(messages[player], {["text"] = text, ["player"] = player, ["tick"] = tick, ["endTime"] = tick + 2000, ["alpha"] = 0, ["texture"] = _texture}) end function removeBubble() table.remove(messages) end addEvent("onChatbubblesMessageIncome", true) addEventHandler("onChatbubblesMessageIncome", root, function(message, messagetype) if source ~= localPlayer then addBubble(message, source, getTickCount()) elseif selfVisible then addBubble(message, source, getTickCount()) end end ) local pi = math.pi function outElastic(t, b, c, d, a, p) if t == 0 then return b end t = t / d if t == 1 then return b + c end if not p then p = d * 0.3 end local s if not a or a < math.abs(c) then a = c s = p / 4 else s = p / (2 * pi) * math.asin(c/a) end return a * math.pow(2, -10 * t) * math.sin((t * d - s) * (2 * pi) / p) + c + b end addEventHandler("onClientRender", root, function() local tick = getTickCount() local x, y, z = getElementPosition(localPlayer) for _, pMessage in pairs(messages) do for i, v in ipairs(pMessage) do if isElement(v.player) then if tick-v.tick < timeVisible then local px, py, pz = getElementPosition(v.player) if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < distanceVisible and isLineOfSightClear ( x, y, z, px, py, pz, true, not isPedInVehicle(v.player), false, true) then v.alpha = v.alpha < 200 and v.alpha + 5 or v.alpha local bx, by, bz = getPedBonePosition(v.player, 6) local sx, sy = getScreenFromWorldPosition(bx, by, bz) local elapsedTime = tick - v.tick local duration = v.endTime - v.tick local progress = elapsedTime / duration if sx and sy then if not v.yPos then v.yPos = sy end local width = dxGetTextWidth(v.text:gsub("#%x%x%x%x%x%x", ""), 1, "default-bold") --local yPos = interpolateBetween ( v.yPos, 0, 0, sy - 22*i, 0, 0, progress, "OutElastic") local yPos = outElastic(elapsedTime, v.yPos, ( sy - 22*i ) - v.yPos, duration, 5) if bubble then dxDrawImage ( sx-width/2-10, yPos - 93, width+16, 20, v.texture, nil, nil, tocolor(56, 96, 229, v.alpha) ) else dxDrawRectangle(sx-width/2-10, yPos - 60, width+16, 20, tocolor(0, 0, 0, v.alpha)) end dxDrawText(v.text, sx-width/2-2, yPos - 90, width, 20, tocolor( 255,255,255, v.alpha+50), 1, "default-bold", "left", "top", false, false, false, true) end end else table.remove(messages[v.player], i) end else table.remove(messages[v.player], i) end end end end ) Server Side: function outputMessage(element, text) assert(isElement(element), "outputMessage @ Bad argument: expected element at argument 1, got "..type(element).." "..tostring(element)) triggerClientEvent("onChatbubblesMessageIncome", element, tostring(text)) end function sendMessageToClient(message,messagetype) if not wasEventCancelled() then if messagetype == 0 or messagetype == 1 then triggerClientEvent("onChatbubblesMessageIncome", source, message, messagetype) end end end addEventHandler("onPlayerChat",getRootElement(),sendMessageToClient)