Jump to content

Mefisto_PL

Members
  • Posts

    460
  • Joined

  • Last visited

1 Follower

Recent Profile Visitors

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

Mefisto_PL's Achievements

Hustler

Hustler (26/54)

0

Reputation

  1. I was trying to use this method, but after all this pain i've been through, it still looks different on each resolution, it works perfectly on 800x600. Here is the photo of 1280x1024: https://imgur.com/nYswa5d The text should be in the right corner local devSX = 1920 local devSY = 1080 local sx, sy = guiGetScreenSize() local scaleV = sy / devSY scaleV = math.max(scaleV, 0.65) function statsShow () local text = "Ping: " ..getPlayerPing(localPlayer) .. " | FPS: " .. getElementData(localPlayer, "FPS") local textWidth = dxGetTextWidth(text) local centerX = sx/2 local centerY = sy/2 local textX = centerX - ((scaleV*-840)/2) local textY = centerY - ((scaleV*-830)/2) dxDrawText( text, textX-2, textY, textWidth, sy, tocolor(0, 0, 0, 255), scaleV*2, "arial") dxDrawText( text, textX+2, textY, textWidth, sy, tocolor(0, 0, 0, 255), scaleV*2, "arial") dxDrawText( text, textX, textY-2, textWidth, sy, tocolor(0, 0, 0, 255), scaleV*2, "arial") dxDrawText( text, textX, textY+2, textWidth, sy, tocolor(0, 0, 0, 255), scaleV*2, "arial") dxDrawText( text, textX, textY, textWidth, sy, tocolor(255, 255, 255, 255), scaleV*2, "arial") end addEventHandler("onClientRender", root, statsShow)
  2. Hi, I've got an interesting bug with my localchat script. When the players are in range of local chat then for some of them a *action text* part is not colored, but when they're alone in their chat distance, everything works fine and message is fully colored. function RGBToHex(red, green, blue, alpha) -- Make sure RGB values passed to this function are correct if( ( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ) ) ) then return nil end -- Alpha check if alpha then return string.format("#%.2X%.2X%.2X%.2X", red, green, blue, alpha) else return string.format("#%.2X%.2X%.2X", red, green, blue) end end function localchat (msg, msgtype, cmdname) local x, y, z = getElementPosition (source) local playerdim = getElementDimension (source) local range = 30 local playerName = getPlayerName (source) for index, player in pairs(getElementsByType ("player")) do local playersdim = getElementDimension (player) if playerdim == playersdim then local xp, yp, yz = getElementPosition (player) local distance = getDistanceBetweenPoints3D (x, y, z, xp, yp, yz) if ( distance <= range ) then r = tonumber (255 - (tonumber((distance))* 3)) g = tonumber (255 - (tonumber((distance))* 3)) b = tonumber (255 - (tonumber((distance))* 3)) mr = tonumber (255 - (tonumber((distance))* 3)) mg = 0 mb = tonumber (255 - (tonumber((distance))* 3)) if msgtype == 0 then cancelEvent() msg = string.gsub(msg, "#%x%x%x%x%x%x", "") msg = msg:gsub("^%l", string.upper) playerName = string.gsub(playerName, "#%x%x%x%x%x%x", "") playerName = string.gsub(playerName, "_", " ") mecolor = RGBToHex(mr, mg, mb) normalcolor = RGBToHex(r, g, b) while true do local find,find2 = string.find(msg, "%<(.-)%>") if (find and find2) then msg = string.sub(msg,1,find-1) .. mecolor .. "*".. string.sub(msg, find+1, find2-1) .. "*" .. normalcolor .. string.sub(msg, find2+1, #msg) else break end end if string.find(msg, ".", -1, true) or string.find(msg, "?", -1, true) or string.find(msg, "!", -1, true) then outputChatBox(playerName .. " mówi: " .. msg , player, r, g, b, true) else msg = msg.. "." outputChatBox(playerName .. " mówi: " .. msg , player, r, g, b, true) --outputChatBox(playerName .. " mówi: " .. msg .. ".", player, 255, 255, 255, true) end end end end end end addEventHandler("onPlayerChat", getRootElement(), localchat)
  3. local troller = getPlayerName(root,thePlayer) - wat? There root isn't needed. Try this: function getPlayerFromNamePart(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function trollRandomPlayerWithFire(commandName,thePlayer,theTarget) local target = getPlayerFromNamePart ( theTarget ) local troller = getPlayerName( getLocalPlayer() ) if ( theTarget ) then setPedOnFire(target,true) outputChatBox("You've been set on fire by" .. troller .. "",root,255,0,0,true) outputDebugString( target .. "has been set on fire by" .. troller .. "" ) end end addCommandHandler("fire",trollRandomPlayerWithFire)
  4. function getPlayerFromNamePart(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function trollRandomPlayerWithFire(commandName,thePlayer,theTarget) local target = getPlayerFromNamePart ( theTarget ) local troller = getPlayerName(thePlayer) if ( theTarget ) then setPedOnFire(theTarget,true) outputChatBox("You've been set on fire by" .. troller .. "",255,0,0) outputDebugString( target .. "has been set on fire by" .. troller .. "" ) -- If your argument is first what you want to add in chat/debug then you don't have to put ".." before it or if it's the last argument and it close your message then you don't have to put ".." after it. end end addCommandHandler("fire",trollRandomPlayerWithFire)
  5. My function should change colors in my buttons and it's working.. but I add event that when mouse leave from this button then colors should be changed again and now when I move cursor up then simple change colors, but when I move cursor down, left, right it isn't changed.. function spawnMenuInit ( ) if source == ls_bg then guiLabelSetColor ( ls_label, 255, 255, 255 ) guiSetProperty ( ls_bg, "ImageColours", "tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000" ) elseif source == sf_bg then guiLabelSetColor ( sf_label, 255, 255, 255 ) guiSetProperty ( sf_bg, "ImageColours", "tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000" ) elseif source == lv_bg then guiLabelSetColor ( lv_label, 255, 255, 255 ) guiSetProperty ( lv_bg, "ImageColours", "tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000" ) end end addEventHandler( "onClientMouseEnter", getRootElement(), spawnMenuInit ) function spawnMenuLeave ( ) if source == ls_bg then guiLabelSetColor ( ls_label, 155, 155, 155 ) guiSetProperty ( ls_bg, "ImageColours", "tl:CC000000 tr:CC000000 bl:AA000000 br:AA000000" ) elseif source == sf_bg then guiLabelSetColor ( sf_label, 155, 155, 155 ) guiSetProperty ( sf_bg, "ImageColours", "tl:AA000000 tr:AA000000 bl:AA000000 br:AA000000" ) elseif source == lv_bg then guiLabelSetColor ( lv_label, 155, 155, 155 ) guiSetProperty ( lv_bg, "ImageColours", "tl:AA000000 tr:AA000000 bl:CC000000 br:CC000000" ) end end addEventHandler( "onClientMouseLeave", getRootElement(), spawnMenuLeave )
  6. I know, when I found the problem then I fix that, but thanks for trying to help me
  7. NOW NOTHING, REMOVE PLEASE.
  8. http://mta.dzek.eu/compiler/ - To jest compiler Korzystam z tego, ale na forum sporo tego jest.
  9. Nie odbezpieczysz, zabezpieczane jest to właśnie żeby nikt nie kradł tego kodu. Jest dekoder lua, ale nie jest na tyle sprawny, żeby przetłumaczyć dobrze kod i on działał poprawnie, w każdym razie nawet jeśli przetłumaczy jest on wciąż nie zrozumiały, nie ma dziwnych krzaczków, ale tego po prostu nie zrozumiesz.
  10. TriggerEvent służy do wywołania funkcji połączonej z eventem stworzonym za pomocą "addEvent". Wytłumaczę Ci kodem. addEvent ( "mojwlasniestworzonyevent", true ) function TextTest ( ) outputChatBox ( "TEXT TEXT TEXT" ) end addEventHandler ( "mojwlasniestworzonyevent", getRootElement(), TextTest ) Korzystając teraz z triggerClientEvent ( "mojwlasniestworzonyevent", getRootElement() ) wywołasz funkcję TextTest.
  11. YouTube have copyrights too, but it's not our problem. Good work
  12. Not quite. There is a way to play sound from url . @Author I too think that you can't upload audiobooks without copyright
×
×
  • Create New...