Jump to content

Sergioks

Members
  • Posts

    262
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Sergioks

  1. Sergioks

    Chat(Ayuda)

    settings = { ['enableTeamChat'] = true, ['adminTag'] = { ['enabled'] = true, ['ACL'] = { -- A bit more advanced. { 'Admin', '' }, { 'Moderator', ' ' }, { 'Everyone', '' }, } }, ['swearFilter'] = { ['enabled'] = true, ['swearCost'] = 0, ['swears'] = { -- Allows you to set the blocked swear words, syntax is ['WORD'] = 'REPLACEMENT' ['fghg'] = '*****', ['gffgh'] = '*****' } }, ['antiSpamFilter'] = { ['enabled'] = true, ['execeptionGroups'] = 'Admin', -- Groups which can spam, eg. 'Admin,SuperModerator,Moderator' ['chatTimeOut'] = 1.5 -- Set in seconds. }, ['freezeChat'] = { ['enabled'] = true, ['command'] = 'fchat', -- Command to use when activating frozen chat. ['allowedGroups'] = 'Admin', -- Groups which have access to this command. ['resetTime'] = 5 -- Time in minutes before it automatically resets. }, ['clearChat'] = { ['enabled'] = true, ['command'] = 'cchat', ['allowedGroups'] = 'Admin' } } -- Required variables spam = { } stopChat = false function chatbox(message, msgtype) if stopChat then cancelEvent() outputChatBox('', source, 255, 255, 255, true) return end local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local serial = getPlayerSerial(source) local r, g, b = getPlayerNametagColor(source) local text = message:gsub("%a", string.upper, 0) local check = 0 local spamCheck = false local tag = exports.gang_system:getPlayerGang(source) if settings['swearFilter']['enabled'] then for i, v in pairs(settings['swearFilter']['swears']) do while text:lower():find(i:lower(),1,true) do local start, end_ = text:lower():find(i:lower(),1,true) local found = text:sub(start,end_) text = text:gsub(found,v) if settings['swearFilter']['swearCost'] ~= 0 then takePlayerMoney(source, settings['swearFilter']['swearCost']) end end end end if msgtype == 0 then cancelEvent() if not settings['adminTag']['enabled'] and not spam[serial] then message = RGBToHex(r, g, b) .. name .. ":#FFFFFF " .. text if 600 <= #message then outputChatBox('#FF0000Error: El mensaje que escribiste es muy largo!', source, 255, 255, 255, true) else outputChatBox(message, getRootElement(), 255, 255, 255, true) aclgroup = split(settings['antiSpamFilter']['execeptionGroups'], ', ') or settings['antiSpamFilter']['execeptionGroups'] for i, v in ipairs(aclgroup) do if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup(v)) then spamCheck = true end end if not spamCheck then if settings['antiSpamFilter']['enabled'] then spam[serial] = true setTimer(function() spam[serial] = false end, settings['antiSpamFilter']['chatTimeOut']*1000, 1) end end outputServerLog('CHAT: ' .. name .. ': ' .. text) end return end for _,v in ipairs(settings['adminTag']['ACL']) do if isObjectInACLGroup('user.' .. account, aclGetGroup(v[1])) and check == 0 and not spam[serial] then --- if ( tag == "None" ) then gangTag = "" else gangTag = tag end --- local message = v[2] .. RGBToHex(r, g, b) .. name .. ""..gangTag..":#FFFFFF " .. text if 600 <= #message then outputChatBox('#FF0000Error: El mensaje que escribiste es muy largo!', source, 255, 255, 255, true) check = 1 else check = 1 outputChatBox(message, getRootElement(), 255, 255, 255, true) if settings['antiSpamFilter']['enabled'] then aclgroup = split(settings['antiSpamFilter']['execeptionGroups'], ', ') or settings['antiSpamFilter']['execeptionGroups'] for i, v in ipairs(aclgroup) do if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup(v)) then spamCheck = true end end if not spamCheck then spam[serial] = true check = 1 setTimer(function() spam[serial] = false end, settings['antiSpamFilter']['chatTimeOut']*1000, 1) end end outputServerLog('CHAT: '.. v[2] .. name .. ': ' .. text) end elseif spam[serial] and check == 0 then outputChatBox('#FF0000Error: Por favor espere '..settings['antiSpamFilter']['chatTimeOut']..' segundos para escribir otro mensaje!', source, 255, 255, 255, true) check = 1 end end elseif msgtype == 1 and not settings['enableTeamChat'] then cancelEvent() end end addEventHandler("onPlayerChat", getRootElement(), chatbox) addEventHandler("onPlayerQuit", getRootElement(), function() local serial = getPlayerName(source) spam[serial] = false end ) -- Freeze chat addCommandHandler(settings['freezeChat']['command'], function(player) if not settings['freezeChat']['enabled'] then return end aclgroup = split(settings['freezeChat']['allowedGroups'], ', ') or settings['freezeChat']['allowedGroups'] for i, v in ipairs(aclgroup) do if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup(v)) then check = true end end if not check then return end if not stopChat then outputChatBox('', getRootElement(), 255, 255, 255, true) stopChat = true frozenTimer = setTimer(function() stopChat = false end, (settings['freezeChat']['resetTime'] * 60000), 1) else outputChatBox('', getRootElement(), 255, 255, 255, true) stopChat = false end end ) -- Clear chat addCommandHandler(settings['clearChat']['command'], function(player) if not settings['clearChat']['enabled'] then return end aclgroup = split(settings['clearChat']['allowedGroups'], ',') or settings['clearChat']['allowedGroups'] for i, v in ipairs(aclgroup) do if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup(v)) then check = true end end if not check then return end for i = 2, getElementData(player, 'chatLines') do outputChatBox(' ') end outputChatBox('', getRootElement(), 255, 255, 255, true) end ) function RGBToHex(red, green, blue, alpha) return string.format("#%.2X%.2X%.2X", red,green,blue) end Prueba esto a ver, no lo he testeado, pero algo así haría yo.
  2. local respawn = 30 local r function respawnVehicle() if isTimer(r) then resetTimer(r) outputDebugString("Timer Reset") return end outputChatBox("Todos los vehiculos vacios se respawnearan en 10 ".. respawn.."segundos") outputDebugString("Cars Respawning") r = setTimer(function() for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do if isEmpty( vehicle ) then resetVehicleIdleTime ( vehicle ) respawnVehicle ( vehicle ) end end outputDebugString("Cars Respawned") outputChatBox("Todos los vehiculos vacios han sido respawneados") end,respawn*1000,1) end) addEventHandler("onResourceStart", getRootElement(), respawnVehicle) function isEmpty( vehicle ) local passengers = getVehicleMaxPassengers( vehicle ) if type( passengers ) == 'number' then for seat = 0, passengers do if getVehicleOccupant( vehicle, seat ) then return false end end end return true end Trata con esto
  3. En realidad, lo que deseo hacer es una especie de sistema de dialogo real. Por ejemplo: Vas caminando por la calle y le das click al ped y el setCameraMatrix hace que se enfoque la cámara en el rostro del ped. Por ello quería que fuera algo automático, algo que pueda calcularse de la posición del ped y su rotación, pero de no ser posible esto tendré que hacerle un elementData o algo a cada ped que defina su frente al momento de crearse.
  4. No entiendo... ¿puedo hacer algo como esto.. con esas funciones? Porque algo asi es lo que busco..
  5. Buenas, hace mucho que no publicaba por aqui, necesito una pequeña ayuda... Necesito saber como hacer para detectar el frente de un ped, para poder ponerle una setCameraMatrix enfocada en su rostro.. ¿Alguien me podría ayudar?
  6. ¿Y como las convierto a absolutas? Ya lo intente y sigue quedando muy lejos de la radarArea. Problema resuelto en otra red social. Formula: ancho/2 + x, altura/2 + y
  7. Buenas. He tardado un rato intentando y no he podido detectar el centro de una radarArea. ¿alguien me podría decir cual es el calculo que tengo que hacer para obtenerlo? Saludos
  8. Justamente estoy pensando en hacer un script para poder cambiarle el idioma al servidor y que sea multi-lenguaje. (Español, Ingles, Portugués).
  9. El servidor vuelve a estar Online despues de un problemita con el host. Nueva IP: mtasa://158.69.101.7:22005 ¡Los esperamos!
  10. Me refería al rayo blanco en el barco, cómo lo hiciste? Ah, eso es humo. Lo hice con una torre de fabrica que luego hice invisible. Se ve de esa manera por el shader que tengo en mi MTA.
  11. Es una arena de ClanWar. Aunque solo esta el mapeo. Pronto estará el sistema allí para que puedan haber clanWars sin necesidad de un staff controlandolo (que sea automático)
  12. Buenas, tengo una duda que siempre la he tenido. Siempre que trato de hacer un script como este caigo y no se porque Bueno, me problema es el siguiente: Estoy haciendo un sistema de reportes para mi servidor, el cual consiste en escribir el comando /report y toma la fotografia con takePlayerScreenShot y que lo guarde en los archivos del script. (client/files/reportes/cuenta/dia-mes-año/mensaje.jpg). Y que luego, se la muestre al usuario en una GUI para que decida si enviar el reporte o no, y colocar un mensaje para el staff. Sin embargo, el programa no muestra la imagen del reporte.. Server-Side: function onScreenShotTaked(theResource, status, pixels, timestamp, tag) if ( theResource == getThisResource() ) then ---- local time = getRealTime(timeStamp) local year = time.year + 1900 local month = time.month + 1 local day = time.monthday local hour = time.hour local minute = time.minute -- local id = dbPoll(dbQuery(db, "SELECT * FROM reports"), -1) local filepath = ("client/files/reportes/%s/[%s][%s][%s]/[%s][%s][%s](%d).jpg"):format(getAccountName(getPlayerAccount(source)), day, month, year, hour, minute, tag, #id + 1) local file = fileCreate(filepath) or fileOpen(filepath) fileWrite(file, pixels) fileClose(file) -- local reportPath = ("client/files/reportes/%s/[%s][%s][%s]/[%s][%s][%s](%d)"):format(getAccountName(getPlayerAccount(source)), day, month, year, hour, minute, tag, #id + 1) if ( not reportPath ) then outputChatBox("* El reporte no pudo tomarse!! Reporta esto a un staff!", source, 255, 0, 0, true) return end -- ---- triggerClientEvent(source, "acp.verifyReport", source, reportPath ) end end addEventHandler("onPlayerScreenShot", root, onScreenShotTaked) Client-side: addEvent("acp.verifyReport",true) addEventHandler( "acp.verifyReport", root, function( img ) reports_open_close() -- filepath = img..".jpg" guiStaticImageLoadImage(zRACP.staticimage[3], filepath) end ) Debugscript: WARNING: acp/report_c.lua:415: Error loading image @'guiStaticImageLoadImage' [E:\MTA San Andreas 1.5\mods\deathmatch\resources\acp\client\files\reportes\Sergioks\05-02-2016\Reporte de Sergioks.jpg] ¿como puedo hacer en este caso? alguien me ayuda? Espero sus respuestas y gracias por leer
  13. Buenas, el día de hoy les traigo un problema que no me habia pasado nunca Bueno, el problema es el siguiente: Server-Side Censurado EDIT: la linea que da dicho warning es la que aparece en la linea 11 del codigo de arriba Problema especificado en debugscript (3) Censurado ¿Alguien me puede ayudar con esto? - Un saludo y gracias por leer
  14. Buenas tengo una duda, referente a las funciones exportables. Yo estoy haciendo una serie de funciones UserFull para un script. En fin, en algunos casos se necesita detectar al sourcePlayer. ¿Como puedo detectarlo en una userfull funcion? ej: function sellHouse(id) if ( tonumber(id) ) then if ( getOwner(id) ~= getAccountName(getPlayerAccount(???)) ) then outputChatBox("Tu no eres dueño de esta propiedad", ????, 255, 0, 0, true) end end end ¿se puede utilizar el source en esos casos? u obligatoriamente debo colocar algo como.. exports.HS:sellHouse(sPlayer, id) Es la primera vez que construyo funciones exportables un saludo.
  15. El servidor local es solo para staffs, ya que allí se testea todo, mapas y scripts. Aun no hay un servidor hosteado que soporte visitas Pero cuando lo halla abriremos al publico
  16. Buenas! el dia de hoy tengo una duda muy grande con respecto a... ¿como poner signos de puntuacion en numeros automaticamente? Es para un hud. No quiero que aparezca el dinero asi: $1000000 quiero que aparezca asi: $1.000.000 ¿como puedo hacer? ¡gracias por leer! espero respuesta
  17. Me podrias dar un ejemplo? tengo tiempo que no toco MTA y se me olvido casi todo un saludo
  18. Buenas! tenia tiempo que no publicaba . En fin... Tengo una duda, y es la siguiente: ¿Que funciones puedo utilizar para añadir efectos realistas a mi server MTA? es decir... Sangre, Explosiones, fuego, agua...? Gracias por leer, ¡espero respuestas!
  19. Usas un trigger desde server-side para cerrar la gui? hay errores causados por esto. que colocan: triggerClientEvent(root, "cerrar", root) cuando deberian colocar triggerClientEvent(source, "cerrar", source)
×
×
  • Create New...