Mefisto_PL

Members
  • Content Count

    459
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Mefisto_PL

  • Rank
    Hustler

Recent Profile Visitors

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

  1. 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)
  2. 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)
  3. 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)
  4. 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 )
  5. I know, when I found the problem then I fix that, but thanks for trying to help me
  6. NOW NOTHING, REMOVE PLEASE.
  7. http://mta.dzek.eu/compiler/ - To jest compiler Korzystam z tego, ale na forum sporo tego jest.
  8. 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.
  9. 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.
  10. YouTube have copyrights too, but it's not our problem. Good work
  11. Not quite. There is a way to play sound from url . @Author I too think that you can't upload audiobooks without copyright
  12. Widzę, że przerabiasz czyjeś skrypty, anyway nie ma takiej funkcji givePlayerHealth oraz zmiennej health.