Jump to content

Gaimo

Members
  • Posts

    209
  • Joined

  • Last visited

Everything posted by Gaimo

  1. table = {} markerJob = { {1366.15, -1275.507, 13.5}, } routes = { [1] = {1345.973, -1243.223, 13.488}, [2] = {1371.559, -1234.667, 13.547}, [3] = {1389.106, -1246.985, 13.547}, } function table.random ( theTable ) return theTable[math.random ( #theTable )] end for i,v in pairs (markerJob) do createObject ( 1210, v[1], v[2], v[3], 1, 0, 0, true) createMarker( v[1], v[2], v[3]-1, "cylinder", 1, 255, 0, 0, 35 ) createBlip( v[1], v[2], v[3], 42, 2, 255, 255, 255, 255, 0, 1000 ) local c = createColSphere( v[1], v[2], v[3]+1, 1 ) c.id = "showPanel" end addEventHandler( "onColShapeHit", root, function( player, dim ) if source.id == "showPanel" and player:getType() == "player" and dim and not table.player then triggerClientEvent(root, "showPanel", root) elseif table.player then outputChatBox("Você já está trabalhando.") end end) function startJob() local player = client if not player then return end if not table.player then table.player = {} end local RR = math.random(#routes) -- deu erro > bad argument #1 to 'random' (interval is empty) table.player.car = createVehicle(482, 1360.201, -1274.34, 13.383) table.player.marker = createMarker(RR[1], RR[2], RR[3], "cylinder", 2.5, 255, 0, 0, 255, player) table.player.car = createBlip(RR[1], RR[2], RR[3], 43, 2, 0, 0, 0, 255, 0, 400, player) addEventHandler("onMarkerHit", table.player.marker, job) end addEvent("start", true) addEventHandler("start", root, startJob) function job() outputChatBox("AHHHHHHHHHHHHHHH") end addEventHandler( "onPlayerQuit", root, function() if table[source] then for k,v in pairs(table[source]) do if isElement(v) then destroyElement(v) end end table[source] = nil end end ) bad argument #1 to 'random' (interval is empty) Deu esse erro
  2. Tá ainda não consegui fazer o que eu queria AHHHHHHHHHHHHHHHHH function table.random ( theTable ) return theTable[math.random ( #theTable )] end Essa parada não retorna o que eu quero, se eu colocar uma tabela assim: name{1, 2, 3 , "x", "TOPUTOD+"} Ela retorna certo, mas assim ela não retorna: name{ {1, 2, 3}, {"x", 2, 4}, } Como eu posso fazer ?
  3. routes = { {1345.973, -1243.223, 13.488}, {1371.559, -1234.667, 13.547}, {1389.106, -1246.985, 13.547}, } Como posso fazer pra escolher um index aleatório da tabela e adicionar ele para: createMarker(x, y, z, "cylinder", 2.5, 255, 0, 0, 255, player) createBlip(x, y, z, 43, player) x, y e z do marker e do blip? Não faço ideia de como usar o match.random nem como colocar o valor do index da tabela sem ser por: for i,v in pairs (Tabela) do createObject ( 1210, v[1], v[2], v[3], 1, 0, 0, true) createMarker( v[1], v[2], v[3]-1, "cylinder", 1, 255, 0, 0, 35 ) createBlip( v[1], v[2], v[3], 42, 2, 255, 255, 255, 255, 0, 1000 ) end Preciso de ajuda/explicação de: Como usar o valor de uma tabela em outro lugar por exemplo no XYZ de um marker table{{1,2,3}} createMarker (x, y, z, .......) e como escolher o valor aleatório de uma tabela. Enquanto aguardo resposta vou ficar pesquisando sobre o assunto ? Como deleta um post? PQP vou começar a usar a wiki antes de abrir coisa aqui no forum function table.random ( theTable ) return theTable[math.random ( #theTable )] end https://wiki.multitheftauto.com/wiki/Table.random Que burrice minha vei Agora como eu posso arrumar o valor que retorna em algum lugar tipo o XYZ do createMarker?
  4. Estou pensando em deixar uma maleta de trabalho girando infinitamente, esse tipo de loop pode prejudicar muito a performance do servidor?
  5. Tenho esse script > data.lua -- Marker para abrir o painel e pegar o emprego. markerJob = { {1366.15, -1275.507, 12.6}, } -- Onde o carro do emprego deve aparecer. spawnCar = {} -- Lugares onde o jogador deve ir. routes = {} -- Onde termina o trabalho e o jogador recebe. endJob = {} Quero usar esses arrays no meu outro script s.lua Meu meta.xml <meta> <info author="Gaimo" name="Trabalho test" /> <script src="s.lua" type="server"/> <script src="data.lua" type="server"/> <script src="c.lua" type="client"/> </meta> Meu s.lua for i,v in pairs (markerJob) do createMarker( v[1], v[2], v[3], "cylinder", 1, 255, 0, 0, 255 ) createBlip( v[1], v[2], v[3], 42, 2, 255, 255, 255, 255, 0, 1000 ) end Como eu posso fazer pra usar no s.lua os arrays que estão no data.lua?
  6. Nossa fiz muita merda, vou dormir amanhã eu arrumo isso. Vlw pela ajuda de todos ae!!
  7. Tem algum exemplo de como posso fazer um sistema random de entregas, tipo quero ter 10 pontos de entrega, mas que quando o jogador iniciar ele pegue um aleatoriamente. Enquanto isso vou finalizar o script Uma ajudinha pra melhorar o código kkkkk to repetindo muita coisa, acho que tenho que começar a usar loop table = {} marker = createMarker(1366.15, -1275.507, 12.6, "cylinder", 1, 255, 0, 0, 255) createBlip(1366.15, -1275.507, 11.5, 42) function showPanel(player, dim) if player and isElement(player) and getElementType(player) == "player" and dim and not table.player then triggerClientEvent(root, "showPanel", root) elseif table.player then outputChatBox("Você já está trabalhando.") end end addEventHandler("onMarkerHit", marker, showPanel) function startJob() local player = client if not player then return end if not table.player then table.player = {} end table.player["car"] = createVehicle(482, 1360.201, -1274.34, 13.383) table.player["marker"] = createMarker(1360.126, -1256.776, 13.383, "cylinder", 2.5, 255, 0, 0, 255, player) table.player["blip"] = createBlip(1360.126, -1256.776, 13.383, 43, player) addEventHandler("onMarkerHit", table.player["marker"], job) end addEvent("start", true) addEventHandler("start", root, startJob) function job(element, dim) if element and isElement(element) and getElementType(element) == "vehicle" and dim then player = getVehicleOccupant( element, 0 ) if player and element == table.player["car"] then table.player["marker"] = createMarker(-258.438, -2182.637, 29.004, "cylinder", 2.5, 255, 0, 0, 255, player) table.player["blip"] = createBlip(-258.438, -2182.637, 29.004, 43, player) addEventHandler("onMarkerHit", table.player["marker"], endJob) else outputChatBox("Esse não é o veículo que você recebeu!") end end end function endJob() if element and isElement(element) and getElementType(element) == "vehicle" and dim then player = getVehicleOccupant( element, 0 ) if player and element == table.player["car"] then table.player["marker"] = createMarker(1365.174, -1283.855, 13.547, "cylinder", 2.5, 255, 0, 0, 255, player) table.player["blip"] = createBlip(1365.174, -1283.855, 13.547, 43, player) else outputChatBox("Esse não é o veículo que você recebeu!") end end end addEventHandler( "onPlayerQuit", root, function() if table[source] then for k,v in pairs(table[source]) do if isElement(v) then destroyElement(v) end end table[source] = nil end end ) Sim ainda não arrumei para o jogador receber dinheiro vamos por partes ehhehe
  8. table = {} marker = createMarker(1366.15, -1275.507, 12.6, "cylinder", 1, 255, 0, 0, 255) createBlip(1366.15, -1275.507, 11.5, 42) function showPanel(player, dim) if player and isElement(player) and getElementType(player) == "player" and dim and not table.player then triggerClientEvent(root, "showPanel", root) elseif table.player then outputChatBox("Você já está trabalhando.") end end addEventHandler("onMarkerHit", marker, showPanel) function startJob(player) if not table.player then table.player = {} table.player["car"] = createVehicle(482, 1360.201, -1274.34, 13.383) table.player["marker"] = createMarker(1360.126, -1256.776, 13.383, "cylinder", 2.5, 255, 0, 0, 255, player) table.player["blip"] = createBlip(1360.126, -1256.776, 13.383, 43, player) addEventHandler("onMarkerHit", table.player["marker"], job) end end addEvent("start", true) addEventHandler("start", root, startJob) function job(element, dim) if element and isElement(element) and getElementType(element) == "vehicle" and dim then player = getVehicleOccupant( element, 0 ) if player and element == table.player["car"] then outputChatBox("sou eu kkkk") else outputChatBox("esse não é o veículo.") end end end Alguém só me confirma uma coisa, realmente vai criar um index para cada jogador ? Ou eles vão usar o mesmo e eu fiz cagada kkkkkk
  9. Okay agora estou com um problema na tabela table = {} marker = createMarker(1366.15, -1275.507, 12.6, "cylinder", 1, 255, 0, 0, 255) createBlip(1366.15, -1275.507, 11.5, 42) function showPanel(markerHit,Dim) if (Dim) then triggerClientEvent(root, "showPanel", root) end end addEventHandler("onPlayerMarkerHit",getRootElement(),showPanel) function startJob(player) if not table[player] then table[player] = {} -- table index is nill | SCRIPT não passa daqui table[player]["car"] = createVehicle(482, 1360.201, -1274.34, 13.383) outputChatBox("Cheguei aqui") else outputChatBox("você tem uma table") end end addEvent("start", true) addEventHandler("start", root, startJob) Imagino que estou fazendo merda com o startJob(player) Quero fazer igual eu vi em um script, se o carro do player que entrar na marker é o que foi criado para ele. Assim: VVVV function FinalDaMissao(element, dim) if element and isElement(element) and getElementType(element) == "vehicle" and dim then player = getVehicleOccupant( element, 0 ) if player and table[player] and table[player]["Carro"] and element == table[player]["Carro"] then destroyElement(element) destroyElement(table[player]["Marker"]) table[player]["Carro"] = nil table[player]["Marker"] = nil table[player] = nil givePlayerMoney(player, 50) outputChatBox("Você concluiu seu trabalho é recebeu !", player, 0, 255, 0, false) else outputChatBox("Este não é o carro da empresa !", player, 255, 0, 0, false) end end end Vou ler o manual da lua sobre tabela para ver se consigo detectar o erro, mas se alguém identificar o erro e estiver disposto a dizer a solução, fico muito grato haha
  10. Não tenho print aqui dele, mas ele posso tentar explicar ele, imagine 5 marker do tipo cylinder cada um com um tamanho pequeno de altura bem fino 10px digamos, ficando assim um sim e um não: ---- marker espaço em branco -----marker espaço em branco -----marker espaço em branco -----marker espaço em branco -----marker é basicamente o cylinder mas listrado, só que em vez de ter outra cor é transparente.
  11. Que sacanagem kkkkkk, vlw mano, sabia que era algum erro bobo de 12.5 coloquei 12.6 foi. Essa eu não sabia que a marker contava em baixo dela. Eii... tu sabe como faz aquelas marker listrada?
  12. Estou começando a programar, então resolvi criar um script besta mas nem assim funcionou. marker = createMarker(2101.368, -1801.239, 12.5, "cylinder", 1, 0, 255, 0, 200 ) function startJob() carro = createVehicle(448, 2097.831, -1801.282, 13.383) end addEventHandler("onPlayerMarkerHit", marker, startJob) Testei trocar o OnPlayerMarkerHit por onMarkerHit e também não funcionou. Script é do servidor e no meta eu coloquei type="server" Estou assistindo um vídeo aqui e o cara fez EXATAMENTE assim, porém aqui não funciona
  13. Pior que eu não lembro de ter feito outra modificação além dessa, e no debuscript 3 não aparece nenhum erro referente ao voice kkkkkkkk
  14. Estou como uma dúvida sobre como começar a aprender programação, qual é melhor eu começar a programar meus scripts, ou tentar entender scripts feitos?
  15. Então como raios funcionou ? kkkkkk agora fiquei pensativo. if isVoiceEnabled() then addEventHandler ( "onPlayerQuit", root, function() local previousChannel = playerChannels[source] --Remove them from any previous channels if tonumber(previousChannel) then channels[previousChannel][source] = nil --Delete the empty table if he was the last player if not next(channels[previousChannel]) then channels[previousChannel] = nil end end playerChannels[source] = nil end ) function getPlayerChannel ( player ) if not checkValidPlayer ( player ) then return false end return playerChannels[player] end function setPlayerChannel ( player, id ) if not checkValidPlayer ( player ) then return false end id = tonumber(id) if not id then return setPlayerDefaultChannel ( player ) end local previousChannel = playerChannels[player] --Remove them from any previous channels if tonumber(previousChannel) then channels[previousChannel][player] = nil --Delete the empty table if he was the last player if not next(channels[previousChannel]) then channels[previousChannel] = nil end end playerChannels[player] = id --Insert them into the new channel channels[id] = channels[id] or {} channels[id][player] = true --Update all players in this channel of the new player in this channel playersInChannel = getPlayersInChannel ( id ) for i,v in ipairs(playersInChannel) do local volume = setPlayerVoiceBroadcastTo ( v, playersInChannel ) setSoundVolume (volume, 1) end return true end function getPlayersInChannel ( id ) if not isElement(id) then id = tonumber(id) if not id then outputDebugString ( "getPlayersInChannel: Bad 'id' argument", 2 ) return false end end return tableToArray(channels[id] or {}) end function getNextEmptyChannel() local emptyChannel = 1 while channels[emptyChannel] do emptyChannel = emptyChannel + 1 end return emptyChannel end else getPlayerChannel = outputVoiceNotLoaded setPlayerChannel = outputVoiceNotLoaded getPlayersInChannel = outputVoiceNotLoaded getNextEmptyChannel = outputVoiceNotLoaded end
  16. i got local volume = setPlayerVoiceBroadcastTo ( v, playersInChannel ) setSoundVolume (volume, 1)
  17. Eu tinha tentado isso antes de abrir o tópico, só que coloquei (volume, 2 ) já que 1 era 100% e tipo 0.5 era 50%, então pensei putz se eu colocar 2 vai ficar 200% perfeito kkkkkkkkk, mas não funfo, achei que o setSoundVolume não funcionava com setPlayerVoiceBroadcastTo
  18. BANKSLOT_BULLET_SOUNDS 3 -- eu não sei o que faz, mas não desativa o som do fundo. BANKSLOT_WEAPONS 5 -- desativa o som das armas, incluindo o do fundo kkkkk mas ai não adianta.
  19. Consegui, era só parar de ser burro e ler a wiki, usei o setSoundVolume local volume = setPlayerVoiceBroadcastTo ( v, playersInChannel ) setSoundVolume (volume, 1) Não sei como fecha tópico mas se algum moderador ver pode fechar.
  20. Mas infelizmente não funcionou, eu testei de varias maneiras: setAmbientSoundEnabled( "general", false ) setAmbientSoundEnabled( "gunfire", false ) Testei como ele mandou, testei fazer aqui como mais ou menos eu sei, testei em function pro cliente pro servidor e nada foi. Se eu não tivesse deletado os scripts eu mandava todos que eu testei aqui.
  21. factor = 0.5 function createVehicles(player) for i,v in ipairs(getElementsByType("vehicle")) do fuel = math.random(10,25) setElementData(v, "fuel", fuel) end end function processFuel(player) for i,v in ipairs(getElementsByType("vehicle")) do --if getVehicleNameFromModel(481) == false then local fuel = getElementData(v, "fuel") or math.random(10,25) if (getVehicleEngineState(v) and fuel > 0 ) then fuel = fuel - factor end if (fuel <= 0.99) then fuel = 0 setVehicleEngineState(v, false) end setElementData(v, "fuel", fuel) --end end end createVehicles() setTimer(processFuel, 1000, 0) O sistema de combustível esta funcionando em bikes, isso não é bom, tentei detectar com um getVehicleNameFromModel mas não funcionou, alguma solução, para fazer o script ignorar bikes?
  22. function onPlayerSpawnHandler ( ) local player = getLocalPlayer ( source ) setAmbientSoundEnabled( "general", false ) setAmbientSoundEnabled( "gunfire", false ) end addEventHandler( "onPlayerSpawn", root, onPlayerSpawnHandler ) Eu testei, mas não funcionou.
  23. Testei isso: Quero desativar os sons de fundo de tiro do gta, alguma solução?
×
×
  • Create New...