Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/11/24 in all areas

  1. Use AI in your MTA:SA resources. Powered by providers like OpenAI, Anthropic & Groq. You can now bake Artificial Intelligence into your resources, gamemodes and systems. This resource exports the below functions: init(config) generateText(prompt,system) generateObject(prompt, system) getProviders() getModels(provider) getConfig() Example usage: The below code initializes the AI agent (add your API key from the provider) and creates a ped and a marker. when the player hits the marker, the ped says something funny. addEventHandler("onResourceStart", resourceRoot, function() AI.init({ api_key = "", provider = "groq", model = "llama3-8b-8192", temperature = 0.7, max_tokens = 150 }) createPed(0, 0, 0, 5) local marker = createMarker(0, 0, 2, "cylinder", 5, 10, 244, 23, 10, root) local function handleMarkerHit(hitElement) local elementType = getElementType(hitElement) if elementType ~= "player" then return end local playerName = getPlayerName(hitElement) outputDebugString("Player "..playerName.." hit marker") AI.generateText(playerName.." got close to you, say something funny, and out of pocket. Limit is 255 characters. Your name is Pedro. Don't use quotes.", "You are a random pedestrian living in San Andreas, grand theft auto.")( function(result, error) if error then outputDebugString("Error: " .. error) return end if (result:len() >= 254) then result = result:sub(1, 254) .. "..." return end outputChatBox("[Pedro]: "..result, hitElement, 255, 255, 255) end ) end addEventHandler("onMarkerHit", marker, handleMarkerHit) end ) Download: https://community.multitheftauto.com/index.php?p=resources&s=details&id=18946 Roadmap: - Support conversation history - Support streaming - Contributing: Contributions are welcome on Github: https://github.com/MrgSub/mtasa-ai
    1 point
  2. Simplified MTA Beginner's Guide https://gist.github.com/Fernando-A-Rocha/f99294cf32d8a205830068d9668a9090 Created by me
    1 point
  3. Good shout putting this together Nando, well done
    1 point
  4. @Malmalzkadicione esse script server-side no seu resource: (não se esqueça de colocar o nome do seu arquivo.map) function assignLOD(element) -- Função útil que gera um objeto LOD igual ao elemento declarado. local lod = createObject(getElementModel(element),0, 0 ,0, 0, 0, 0, true) setElementDimension(lod,getElementDimension(element)) setElementPosition(lod, getElementPosition(element)) setElementRotation(lod, getElementRotation(element)) setElementCollisionsEnabled(lod,false) setLowLODElement(element,lod) return lod end addEventHandler("onResourceStart", resourceRoot, function() -- Executa essa função ao iniciar este resource. local mapFile = getResourceMapRootElement(resource, "mapa.map") -- Nome do seu arquivo .map (se estiver dentro de uma pasta do resource, precisa declarar também.) local objetos = getElementsByType("object", mapFile) -- Obtém todos os elementos do tipo objeto neste mapa. for _, obj in ipairs(objetos) do -- Para cada objeto, faça: assignLOD(obj) -- Gera uma versão LOD igual ao objeto na mesma posição. Versões LOD são visíveis a grandes distâncias. end end) As casas vão passar de 150m para 400m de visibilidade.
    1 point
×
×
  • Create New...