-
Posts
212 -
Joined
-
Last visited
Everything posted by Gaimo
-
function startJob() outputChatBox("cheguei aqui") if client ~= source then outputChatBox("cheguei aqui1") return end --script para aqui, no debugscript 3 não aparece nada. if not table[source] then table[source] = {} outputChatBox("cheguei aqui2") elseif table[source] then return outputChatBox("Você já está trabalhando !", source, 255, 255, 255) end local rndR = routes[ math.random( #routes ) ] table[source]["car"] = createVehicle(482, 1361.106, -1277.579, 13.383) table[source]["marker"] = createMarker(rndR[1], rndR[2], rndR[3]-0.5, "cylinder", 1.5, 255, 0, 0, 255, source) setElementParent( createBlip(rndR[1], rndR[2], rndR[3], 53, 2, 255, 255, 255, 255, 0, 350, source), table[source]["marker"] ) addEventHandler("onMarkerHit", table[source]["marker"], job) end addEvent("start", true) addEventHandler("start", root, startJob) if client ~= source then outputChatBox("cheguei aqui1") return end | Chega só até aqui Pra não ficar te sugando ksksks vou praticando em outros scripts bem simples esse tá complicado pra mim.
-
table = {} routes = { {1345.973, -1243.223, 13.488}, {1371.559, -1234.667, 13.547}, {1389.106, -1246.985, 13.547}, } marker = createMarker(1366.15, -1275.507, 12.6, "cylinder", 1, 255, 0, 0, 35) createBlip (1366.15, -1275.507, 13, 42, 2, 255, 255, 255, 255, 0, 350) createObject (1210, 1366.15, -1275.507, 13, 1, 0, 0, true) addEventHandler("onMarkerHit", marker, function() triggerClientEvent(root, "showPanel", root) end) function startJob(element, dim) local element = client if not element then return end if not table[element] then table[element] = {} local rndR = routes[ math.random( #routes ) ] table[element]["car"] = createVehicle(482, 1361.106, -1277.579, 13.383) table[element]["marker"] = createMarker(rndR[1], rndR[2], rndR[3]-0.5, "cylinder", 1.5, 255, 0, 0, 255, element) createBlip(rndR[1], rndR[2], rndR[3], 53, 2, 255, 255, 255, 255, 0, 350, element) addEventHandler("onMarkerHit", table[element]["marker"], job) elseif table[element] then outputChatBox("Você já está trabalhando !", element, 255, 255, 255, false) end end addEvent("start", true) addEventHandler("start", root, startJob) -- AQUI TA O ERRO -- Não consigo detectar o que entra no marker, testei com element e source mas não foi. function job( element ) if element and isElement(element) and getElementType(element) == "vehicle" and dim then player = getVehicleOccupant( element, 0 ) if player and table[player] and table[player]["car"] and element == table[player]["car"] then outputChatBox("sucess") else outputChatBox("error") end else outputChatBox("error1") end end ----------------------------------------------------------- function endJob(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]["car"] and element == table[player]["car"] then destroyElement(element) destroyElement(table[player]["marker"]) table[player]["car"] = 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 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 ) Testei isso também: function job( source ) if source and isElement(source) and getElementType(source) == "vehicle" and dim then outputChatBox("sucess") else outputChatBox("error") end end Quando eu passo no table[element]["marker"], ele aparece o "error" 2 vezes, imagino que seja por causa que ele detecta o player e o veículo, só não sei como posso filtrar isso pra que seja o player que pegou o trabalho, com o carro que ele ganhou e passou no marker dele. Usar source ou element não funciona, imagino que estou fazendo o uso altamente errado, mas não consigo identificar o erro.
-
Okay desculpa mais uma vez, vou continuar as dúvidas no outro tópico.
-
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
-
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 ?
-
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?
-
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?
-
Nossa fiz muita merda, vou dormir amanhã eu arrumo isso. Vlw pela ajuda de todos ae!!
-
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
-
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
-
AEEEEEEE pouha consegui
-
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
-
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.
-
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?
-
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
-
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?
-
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
-
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.
-
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.
-
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?