Jump to content

##DanScripting

Members
  • Posts

    6
  • Joined

  • Last visited

Recent Profile Visitors

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

##DanScripting's Achievements

Vic

Vic (3/54)

0

Reputation

  1. Alguem ajuda aí, tô com esse script joinquitdx e quero colocar ele no canto direito da tela no meio, ja tentei n consegui.. function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, 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 cap == "" and col then color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) ax = ax + w color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 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, left, top, clip, wordbreak, postGUI ) end end local messageJoin = "" local messageQuit = "" function renderPlayerJoined ( ) dxDrawColorText(messageJoin,504.0,4.0,574.0,20.0,tocolor(200,0,0,255),1.2,"sans","left","top",false,false,false) end function renderPlayerLeft ( ) dxDrawColorText(messageQuit,550.0,16.0,573.0,32.0,tocolor(0,0,255,170),1.2,"sans","left","top",false,false,false) end addEventHandler('onClientPlayerJoin', root, function() messageJoin = getPlayerName(source) .. " #ffffffChegou na cidade." addEventHandler ( "onClientRender", root, renderPlayerJoined ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerJoined ) end ,6000,1 ) end ) addEventHandler('onClientPlayerChangeNick', root, function() outputChatBox('type /reconnect', localPlayer, 255, 100, 100) cancelEvent() end ) addEventHandler('onClientPlayerQuit', root, function(reason) messageQuit = getPlayerName(source) .. " #ffffffSaiu da cidade. (" .. reason .. ")" addEventHandler ( "onClientRender", root, renderPlayerLeft ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerLeft ) end ,6000,1 ) end )
  2. Consegui.. o codigo ficou assim: local chat_range=100 function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onPlayerChatHandler( message, messageType ) if (messageType == 0) then cancelEvent() local px,py,pz=getElementPosition(source) local ID = getElementData(source, "ID") local nick=getPlayerName(source) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("#FFFFFF• #32CD32[BVL]#FFFF00 • ʟᴏᴄᴀʟ • #FFFFFF"..nick.." ["..ID.."]: #FFFF00"..message,v,30,30,200,true) end end end end addEventHandler( "onPlayerChat", root, onPlayerChatHandler ) function disableChat (message, messageType) cancelEvent () end addEventHandler ("onPlayerChat", getRootElement(), disableChat)
  3. O script ainda não inicia no game.. ERROR: Loading script failed: chatlocal/local.lua:17: ')' expected near '": #FFFF00"'
  4. Olá, eu uso um sistema de id e queria saber como eu pego o id pra mostrar no chat. Exemplo: aparecer meu nome e meu id no chat Dan[31] tô tentando mas o script nem inicia no server: local chat_range=100 function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onPlayerChatHandler( message, messageType ) if (messageType == 0) then cancelEvent() local px,py,pz=getElementPosition(source) local id = getPlayerID(source) local nick=getPlayerName(source) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("#32CD32[BVL]#FFFF00 • ʟᴏᴄᴀʟ • #FFFFFF"..nick.." ["..id.."]"": #FFFF00"..message,v,30,30,200,true) end end end end addEventHandler( "onPlayerChat", root, onPlayerChatHandler ) function disableChat (message, messageType) cancelEvent () end addEventHandler ("onPlayerChat", getRootElement(), disableChat) Codigo do script ID SYSTEM function Start_Id ( _, acc ) if eventName == "onPlayerLogin" then setElementData ( source, "ID", getAccountID(acc) or "N/A" ) outputChatBox ( "", root, 255,255,255,true) elseif eventName == "onPlayerLogout" then removeElementData( source, "ID" ) outputChatBox ( "", root, 255,255,255,true) elseif eventName == "onResourceStart" then for _, player in pairs(getElementsByType("player")) do local acc = getPlayerAccount(player) if not isGuestAccount(acc) then setElementData( source, "ID", getAccountID(acc) or "N/A" ) end end end end addEventHandler("onResourceStart", resourceRoot, Start_Id) addEventHandler("onPlayerLogout", root, Start_Id) addEventHandler("onPlayerLogin", root, Start_Id) function getPlayerID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end --============================================================================================================================-- --=============================-- ----------- ID PLAYER ------------ --=============================-- function getnick(player, command, id, ...) if(id) then local playerID = tonumber(id) if(playerID) then local Player2 = getPlayerID(playerID) if(Player2) then outputChatBox ( "#00ff00✘ #ffffffINFO #00ff00✘➺ #ffffff Nome do Jogador #00ff00" .. getPlayerName(Player2) .."", player, 255,255,255,true) else outputChatBox ( "#00ff00✘ #ffffffERRO #00ff00✘➺ #ffffff O Jogador(a) de ID: #00ff00( " .. id .. " ) #ffffffNão Foi Encontrado!", player, 255,255,255,true) end else outputChatBox ( "#00ff00✘ #ffffffERRO #00ff00✘➺ #ffffff ID: #00ff00( " .. id .. " ) #ffffffInválido!", player, 255,255,255,true) end else outputChatBox ( "#00ff00✘ #ffffffERRO #00ff00✘➺ #ffffffUse /id #00ff00[#ffffffID#00ff00]", player, 255,255,255,true) end end addCommandHandler("id", getnick)
  5. Ao tentar iniciar um script de chat que peguei no Mta Brasil aparece "attempt to concatenate a boolean value", alguem ajuda: (linha 313) --[[ ########################################################################## ## ## ## ## ## Criador: Volklack ## ## ## ## ## ########################################################################## [C] Copyright 2012-2016, Apollo ]] local bw = {"desativado01"} local evento = {"desativado02"} local pw = {"desativado03"} local gw = {"desativado04"} anti_sm = {} local blockc = false function ram() blockc = false return 1 end addEventHandler("onResourceStart", getRootElement(), ram) function rem() removeElementData(getRootElement(), "mutc") removeElementData(getRootElement(), "mutc_m") removeElementData(getRootElement(), "mutc_t") blockc = false return 1 end addEventHandler("onResourceStop", getRootElement(), rem) function scant(msg, msgt) local msgs = string.lower(msg) local sep = scanp(msgs, ' ') local r, g, b = getPlayerNametagColor(source) local z = getPlayerName(source) local x = getPlayerFromName(z) local acc = getAccountName(getPlayerAccount(x)) local hr = getRealTime() local playeraccount = getPlayerAccount (source) if isGuestAccount(playeraccount) then outputChatBox("#FF0000Chat:#FFFFFF Digite /register (nome) (senha) depois /login (nome) (senha) para utilizar o chat.", source, 255, 0, 0, true) cancelEvent() return 1 end if blockc == true then if not isObjectInACLGroup("user."..acc, aclGetGroup("Console")) then outputChatBox("#FF0000Chat:#FFFFFF Conexão perdida com o Chat.", source, 0, 0, 0, true) cancelEvent() return 1 else outputChatBox("#FF0000Chat:#FFFFFF O chat está fechado, porém ele é liberado para demais usuários da administração.", source, 0, 0, 0, true) end end if getElementData(source, "blockic") == 4 then for a, b in ipairs(getElementsByType("player")) do local bcc = getAccountName(getPlayerAccount(b)) if isObjectInACLGroup("user."..bcc, aclGetGroup("Console")) or isObjectInACLGroup("user."..bcc, aclGetGroup("SuperModerator")) or isObjectInACLGroup("user."..bcc, aclGetGroup("Moderator")) then outputChatBox("#FF8000Bloqueado: #FFFFFF "..z.." #FFFFFF(ID:"..IDx(source) .."):#FF8000 "..msg.."", b, 255, 255, 255, true) end end outputChatBox("#FF0000Chat:#FFFFFF O seu chat está bloqueado.", source, 200, 0, 0, true) cancelEvent() return 1 end if getElementData(source, "mutc") == 1 then outputChatBox("#FF0000Chat:#FFFFFF Você está mutado por "..getElementData(source, "mutc_m").." (tempo restante: ".. getElementData(source, "mutc_t") - hr.second.." segs).", source, 0, 0, 0, true) cancelEvent() return 1 end for a, b in pairs(sep) do for c, d in pairs(bw) do if msgt == 0 then if b == d then outputChatBox(getPlayerName(source).. " #FFFFFFFoi mutado por 2 minutos por ofensa.", getRootElement(), 200, 0, 0, true) outputChatBox("#FF0000Chat:#FFFFFF Você foi mutado por 2 minutos por ofensa.", source, 200, 0, 0, true) setElementData(source, "mutc_m", "ofensa") setElementData(source, "mutc_t", 120) setElementData(source, "mutc", 1) setTimer(removeElementData, 120000, 1, source, "mutc") setTimer(removeElementData, 120000, 1, source, "mutc_t") setTimer(removeElementData, 120000, 1, source, "mutc_m") setTimer(outputChatBox, 120000, 1, "#FF0000Chat:#FFFFFF Agora você pode utilizar o chat novamente.", source, 200, 0, 0, true) for a, b in ipairs(getElementsByType("player")) do local bcc = getAccountName(getPlayerAccount(b)) if isObjectInACLGroup("user."..bcc, aclGetGroup("Console")) or isObjectInACLGroup("user."..bcc, aclGetGroup("SuperModerator")) or isObjectInACLGroup("user."..bcc, aclGetGroup("Moderator")) then outputChatBox("#FF8000Ofensa:#FFFFFF "..z.." #FFFFFF(ID:"..IDx(source) .."):#FF8000 "..msg.."", b, 255, 255, 255, true) end end cancelEvent() return 1 end end end end for a, b in pairs(sep) do for c, d in pairs(gw) do if msgt == 0 then if b == d then outputChatBox(getPlayerName(source).. " #FFFFFFFoi mutado por 1 minuto por menssagen obscenas.", getRootElement(), 200, 0, 0, true) outputChatBox("#FF0000Chat:#FFFFFF Você foi mutado por 1 minuto por menssagen obscenas.", source, 200, 0, 0, true) setElementData(source, "mutc_m", "menssagen obscena") setElementData(source, "mutc_t", 60) setElementData(source, "mutc", 1) setTimer(removeElementData, 60000, 1, source, "mutc") setTimer(removeElementData, 60000, 1, source, "mutc_t") setTimer(removeElementData, 60000, 1, source, "mutc_m") setTimer(outputChatBox, 60000, 1, "#FF0000Chat:#FFFFFF Agora você pode utilizar o chat novamente.", source, 200, 0, 0, true) for a, b in ipairs(getElementsByType("player")) do local bcc = getAccountName(getPlayerAccount(b)) if isObjectInACLGroup("user."..bcc, aclGetGroup("Console")) or isObjectInACLGroup("user."..bcc, aclGetGroup("SuperModerator")) or isObjectInACLGroup("user."..bcc, aclGetGroup("Moderator")) then outputChatBox("#FF8000Mensagen obsena:#FFFFFF "..z.." #FFFFFF(ID:"..IDx(source) .."):#FF8000 "..msg.."", b, 255, 255, 255, true) end end cancelEvent() return 1 end end end end for a, b in pairs(sep) do for c, d in pairs(pw) do if msgt == 0 then if b == d then outputChatBox("Você foi mutado por 30 segundos, respeite os jogadores e as regras do servidor.", source, 255) setElementData(source, "mutc_m", "falta de respeito") setElementData(source, "mutc_t", 40) setElementData(source, "mutc", 1) setTimer(removeElementData, 30000, 1, source, "mutc") setTimer(removeElementData, 30000, 1, source, "mutc_t") setTimer(removeElementData, 30000, 1, source, "mutc_m") setTimer(outputChatBox, 30000, 1, "#FF0000Chat:#FFFFFF Agora você pode utilizar o chat novamente.", source, 255) for a, b in ipairs(getElementsByType("player")) do local bcc = getAccountName(getPlayerAccount(b)) if isObjectInACLGroup("user."..bcc, aclGetGroup("Console")) or isObjectInACLGroup("user."..bcc, aclGetGroup("SuperModerator")) or isObjectInACLGroup("user."..bcc, aclGetGroup("Moderator")) then outputChatBox("#FF8000Insulto:#FFFFFF "..z.." #FFFFFF(ID:"..IDx(source) .."):#FF8000 "..msg.."", b, 255, 255, 255, true) end end cancelEvent() return 1 end end end end if isTimer(anti_sm[source]) then outputChatBox("#FF0000Chat:#FFFFFF Espere 1 segundo para falar novamente.", source, 255, 255, 255, true) cancelEvent() return 1 else anti_sm[source] = setTimer(function(source) anti_sm[source] = nil end, 1000, 1, source) end if msgt == 2 then r, g, b = getTeamColor(getPlayerTeam(source)) p = getPlayerName(source) for a, b in ipairs(getElementsByType("player")) do if getPlayerTeam(source) == getPlayerTeam(b) then outputChatBox("#00FF00(GANG)#FFFFFF "..p.."#FFFFFF(ID: "..IDx(source).."):#00FF00 "..msg.."", b, 0, 0, 0, true) end end cancelEvent() return 1 end if isObjectInACLGroup ("user."..acc, aclGetGroup("Console")) and getElementData(x, "AnonAdmin") == false then outputChatBox("#FFFF00* GM "..getPlayerName(source).."#FFFFFF(ID:"..IDx(source) .."): "..msg.."", getRootElement(), r, g, b, true) outputConsole("Chat: (GM) "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") outputDebugString("Chat: (GM) "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") return 1 end if isObjectInACLGroup ("user."..acc, aclGetGroup("Admin")) and getElementData(x, "AnonAdmin") == false then outputChatBox("* Admin "..getPlayerName(source).."#FFFFFF(ID:"..IDx(source) .."): "..msg.."", getRootElement(), r, g, b, true) outputConsole("Chat: (ADMIN) "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") outputDebugString("Chat: (ADMIN) "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") return 1 end if isObjectInACLGroup ("user."..acc, aclGetGroup("SuperModerator")) and getElementData(x, "AnonAdmin") == false then outputChatBox("* Smod "..getPlayerName(source).."#FFFFFF(ID:"..IDx(source) .."): "..msg.."", getRootElement(), r, g, b, true) outputConsole("Chat: (SMOD) "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") outputDebugString("Chat: (SMOD) "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") return 1 end if isObjectInACLGroup ("user."..acc, aclGetGroup("Moderator")) and getElementData(x, "AnonAdmin") == false then outputChatBox("* Mod "..getPlayerName(source).."#FFFFFF(ID:"..IDx(source) .."): "..msg.."", getRootElement(), r, g, b, true) outputConsole("Chat: (MOD) "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") outputDebugString("Chat: (MOD) "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") return 1 end if isObjectInACLGroup ("user."..acc, aclGetGroup("VIP")) and getElementData(x, "AnonAdmin") == false then outputChatBox("* Vip "..getPlayerName(source).."#FFFFFF(ID:"..IDx(source) .."): "..msg.."", getRootElement(), r, g, b, true) outputConsole("Chat: (VIP) "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") outputDebugString("Chat: (VIP) "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") return 1 end -- outputChatBox(""..getPlayerName(source).."#FFFFFF(ID:"..IDx(source) ..")#FFFFFF: Deshawn tae?", getRootElement(), r, g, b, true) outputChatBox(""..getPlayerName(source).."#FFFFFF(ID:"..IDx(source) .."): "..rcc(msg).."", getRootElement(), r, g, b, true) outputConsole("Chat: "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") outputDebugString("Chat: "..getPlayerName(source).."(ID:"..IDx(source) .."): "..msg.."") end addEventHandler("onPlayerChat", getRootElement(), scant) -- function bbc(source) local accName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accName, aclGetGroup("Console")) then if blockc == true then outputChatBox("#FF8000"..getPlayerName(source).." #ffffffabriu o chat para jogadores.", getRootElement(), 255, 255, 255, true) blockc = false else outputChatBox("#FF8000"..getPlayerName(source).." #fffffffechou o chat para jogadores.", getRootElement(), 255, 255, 255, true) blockc = true end else return outputChatBox("Você não tem permição para este comando.", source, 200, 0, 0) end return 0 end addCommandHandler("fc", bbc) -- function IDx(idi) local idn = get("idDataCaption") or "id" return getElementData(idi, idn) end function scanp(sid, separador) if(#sid == 0) then return {} end if (#separador == 0) then return { sid } end return loadstring("return {\" "..sid:gsub(separador, "\", \"").."\"}") () end function rcc(txt) return type(txt)=='string' and string.gsub(txt, '#%x%x%x%x%x%x', "(#)") or name end
  6. Fiz um marker que quando o player entra se teleporta pra um interior, mas ele se teleporta virado pra outro lado. eu quero que toda vez que ele entre vire pra direção certa e a camera esteja certa tambem.. como eu faço? tô começando agora.
×
×
  • Create New...