Search the Community
Showing results for tags 'chatbox'.
-
Oi @#DeltaSCR, vi o tópico e infelizmente não entendi como aplicar. Sou novo em Lua/MTA, desculpe se a pergunta é besta mas segue o código: addEventHandler ("onPlayerJoin", root, function () showChat (source, false) end) function onChat(message, messageType) onChat(message, messageType) if string.find(message, '/showChat') then -- Searches for the string 'kill' in the message sentif string.find(message, 'kill') then -- Searches for the string 'kill' in the message sent cancelEvent()() outputChatBox("#FF0000[ERRO] #FFFFFF Chat desativado! Use o somente o chat local!", source, 255, 255, 255, true) endend end --End of the functionend --End of the function addEventHandler("onPlayerChat", root, onChat)("onPlayerChat", root, onChat)
-
Hi guys, I made a chatbox script myself and all is working perfectly with no errors or warnings in /debugscript 3. I am using a table to save the messages that will be displayed in the chatbox. This is how a part of it looks like: local chatBox = {} function drawChat() for i,v in ipairs (chatBox) do if i < 15 then dxDrawBorderedText(v, 27, 229 - 15*i, 582, 230, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "top", false, false, false, false, false) end end end addEventHandler("onClientRender", root, drawChat) I have no problems to display the first 14 messages, but now I want the last ( first message) to disappear when there comes a new 15th message. But I have no idea how to script it. So it could be nice if someone could help me.
-
i added this line to a nametag script: if isChatBoxInputActive() then dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - imageSize - 1*scale, sy - imageSize, imageSize, imageSize, "logo.png" ) end but when i press 't', the image show in all players nametag.. how to fix this?
-
Hi Everyone! Can someone help me, how can I make that, if a fire is created it outputs the chatbox the fire's position (example: "The LSPD is on fire" or "The Hospital is on fire" . The Script Files: FireC.lua local fireElement = {} addEvent("FireServer.rootFireCreate",true) addEventHandler("FireServer.rootFireCreate",getRootElement(),function(rand) local fire = createFire(FirePositions[rand][1], FirePositions[rand][2], FirePositions[rand][3], FirePositions[rand][4], FirePositions[rand][5], FirePositions[rand][6]) fireElement[#fireElement + 1] = fire end) addEventHandler ("onClientResourceStart", getRootElement(), function (res) if res ~= getThisResource() then return end triggerServerEvent("FireServer.loadMe", localPlayer, localPlayer) end) function draw() for k,v in ipairs(getElementsByType("object")) do if getElementData(v, "Fire->object") then local x, y ,z = getElementPosition(v) local wx, wy, wz = getScreenFromWorldPosition(x , y, z+1) if wx and wy then local playerx, playery, playerz = getElementPosition(getLocalPlayer()) if getDistanceBetweenPoints3D(playerx, playery, playerz, wx, wy, wz) <= 5 then dxDrawRectangle(wx-200/2,wy,200,30,tocolor(0,0,0,255/2)) dxDrawRectangle(wx-200/2+5,wy+5,190,20,tocolor(124, 197, 118,255/2)) end end end end end addEventHandler("onClientRender", root, draw) FireG.lua FirePositions = { -- X, Y, Z, Range(FireSize) [1] = {2114.1240234375, -1756.2508544922, 13.3984375, 800}, } FireS.lua local loadedPlayers = {} local fireBar = {} FireServer = {} function FireServer.start(player) loadedPlayers[#loadedPlayers + 1] = player end addEvent("FireServer.loadMe", true) addEventHandler("FireServer.loadMe", root, FireServer.start) function FireServer.FireCreate() if math.random(1, 3) == 2 then local rand = math.random(#FirePositions) if fireBar[rand] then return end for k,v in pairs(loadedPlayers) do triggerClientEvent(v, "FireServer.rootFireCreate", v, rand) fireBar[rand] = createObject(1337, FirePositions[rand][1], FirePositions[rand][2], FirePositions[rand][3] - 1) setElementAlpha(fireBar[rand], 0) setElementCollisionsEnabled(fireBar[rand], false) setElementData(fireBar[rand], "Fire->object", true) end end end setTimer(FireServer.FireCreate, 1000, 0)
-
I've been working with binding keys quite a lot, but this is currently destroying my brain. Lots of other people have been walking against this problem and I'm trying to find a solution, it can't be that hard! My setup is as following: User gets a UI -> fills in a key to bind a chat to -> using triggerServerEvent to bind the key for the user + some sql saving After a successful attempt of saving the new button for the user, I'm trying to unbind the key from the chatbox-styled function isn't unbinding. If I'm simply unbinding it with runcode directly in runtime, it's returning a true but it's not unbinding. I've seen several reports about this on the bugtracker but none of them were taken note off. Is there a work around or should I simply ask my users to use a MTA-based command to unbind their keys? thanks in advance.
-
function checkAFKPlayers() for index, source in ipairs(getElementsByType("player")) do if (getPlayerIdleTime(source) > 1000) then setElementDimension ( source, 50) setElementAlpha(source, 50) outputChatBox("#004B00[DDC - Afk] #FFffFFNem mozogtál 2 percig, afk módba léptél! Kikapcsoláshoz mozdulj meg!", root, 255,000,000, true) elseif isElementMoving(source) then setElementAlpha(source, 255) setElementDimension ( source, 0) outputChatBox("#004B00[DDC - Afk] #FFffFFKiléptél az afk módból!", root, 255,000,000, true) end end end setTimer(checkAFKPlayers, 1000, 0) function isElementMoving ( theElement ) if isElement ( theElement ) then local x, y, z = getElementVelocity( theElement ) return x ~= 0 or y ~= 0 or z ~= 0 end return false end how to fix this? i want once outputChatbox