Jump to content

kevincouto6

Members
  • Posts

    235
  • Joined

  • Last visited

Everything posted by kevincouto6

  1. for id, plant in ipairs(getElementsByType("object")) do end porem sem esta parte ele remove apenas a ultima planta, tem um modo de juntar as duas será ?
  2. Lado Server function plantDestroy ( thePlayer ) for id, plant in ipairs(getElementsByType("object")) do if getElementModel( plant ) == 862 then destroyElement ( plant ) end end end addEvent ("onDestroyElement", true) addEventHandler ("onDestroyElement", getRootElement(), plantDestroy) Este formato destroy todos, porem ate o dos outros players que estão na missão, saberia como posso fazer para especificar que é pra destruir apenas as que eu plantei não a dos outros
  3. A função e iniada por guiwindonclient.lua, que esta em outra notePaf inicia8 () Testei o jeito que voçê falou mais ainda sim não e possivel destruir todos os objetos que foram criados
  4. obs: eu sei que eu postei este post em ingles e acho que ninguem pode me ajudar então decidi tentar aki, desculpem por em comodar. como funciona script: Primeiro um contador é criado, para calcular as plantas que foram adicionadas com o comando / d Só é possível plantar se você estiver na Zona Para cada planta que é adicionada, uma verificação é feita para ver se ela ainda não forneceu o total = 2 se igual a 2 então ativará a função para completar a missão onde ele irá ativar um gatilho que irá destruir os elementos, Onde estou com problemas? Você poderia me ajudar aqui? Estou desenvolvendo uma missão de plantio, tenho um problema em destruir elemento Está apenas destruindo o último a ser plantado se outro jogador fizer ao mesmo tempo destruir o do outro jogador Eu queria que a destruição das plantas funcionasse individualmente, tipo se 2 jogadores estão fazendo e 1 jogador completo remove apenas o seu Obrigado antecipadamente, ? Lado do server local plants = {} function iniciarFarm8 ( x, y, z ) animation = setPedAnimation(source, "medic", "CPR", -1, false, false, false, false) setTimer(function() plants[client] = createObject ( 862, x , y , z - 1 , 0, 0, 0 ) end, 6500, 1) end addEvent ("iniciaJob8", true) addEventHandler ("iniciaJob8", getRootElement(), iniciarFarm8) function plantDestroy (source) destroyElement ( plants[client] ) end addEvent ("onDestroyElement", true) addEventHandler ("onDestroyElement", getRootElement(), plantDestroy) Lado do client plantsPoints = 0 function inicio8 ( ) local retanguloParaPlantio = createColRectangle ( 209.52605, 1906.70947, 155, 155 ) hillRadar = createRadarArea ( 209.52605, 1906.70947, 155, 155, 0, 255, 0, 175 ) addEventHandler("onClientColShapeHit", retanguloParaPlantio, function ( theElement, matchingDimension ) if ( theElement == localPlayer ) then function plant () local block, anim = getPedAnimation( localPlayer ) if ( not( block == "medic" and anim == "CPR" ) ) then local x, y, z = getElementPosition ( localPlayer ) triggerServerEvent ("iniciaJob8", localPlayer, x, y, z ) setTimer(function() plantsPoints = plantsPoints+1 outputChatBox( "Foi plantado "..(plantsPoints).."/2" ) if plantsPoints >= 2 then completMission() end end, 6500, 1) else outputChatBox (" voçê deve esperar 6 sec para plantar novamente " ) end end addCommandHandler ( "d", plant ) end end ) addEventHandler("onClientColShapeLeave", retanguloParaPlantio, function ( theElement, matchingDimension ) if ( theElement == localPlayer ) then outputChatBox( "nop Function." ) removeCommandHandler ( "d", plant ) end end ) end function completMission () outputChatBox ("voçê plantou todos") plantsPoints = 0 destroyElement ( hillRadar ) triggerServerEvent ( "onDestroyElement", localPlayer ) end
  5. It worked at the time of specifying, the plant but the last object is still being destroyed, the others still exist, now I just have to destroy all
  6. how it works script : First a counter is created, to calculate the plants that were add with the command /d It is only possible to plant if you are in the Zone To each plant that is add, a check is made to see if it has not already given the total = 2 if equal to 2 then it will activate the function to complete the mission where it will activate a trigger that will destroy the elements, Where am I in trouble? Could you help me here? I'm developing a planting mission, I have a problem in destroy element It is only destroying last to be planted if another player does at the same time will destroy that of the other player I wanted the destruction of plants to work individually, Type if 2 players are doing and 1 player complete remove only his Thanks in advance, ? Server-side local plants = {} function iniciarFarm8 ( x, y, z ) --animation = setPedAnimation(source, "medic", "CPR", -1, false, false, false, false) --setTimer(function() plants[client] = createObject ( 862, x , y , z - 1 , 0, 0, 0 ) --end, 6500, 1) end addEvent ("iniciaJob8", true) addEventHandler ("iniciaJob8", getRootElement(), iniciarFarm8) function plantDestroy (source) destroyElement ( plants[client] ) end addEvent ("onDestroyElement", true) addEventHandler ("onDestroyElement", getRootElement(), plantDestroy) Client-side plantsPoints = 0 function inicio8 ( ) local retanguloParaPlantio = createColRectangle ( 209.52605, 1906.70947, 155, 155 ) hillRadar = createRadarArea ( 209.52605, 1906.70947, 155, 155, 0, 255, 0, 175 ) addEventHandler("onClientColShapeHit", retanguloParaPlantio, function ( theElement, matchingDimension ) if ( theElement == localPlayer ) then function plant () local block, anim = getPedAnimation( localPlayer ) if ( not( block == "medic" and anim == "CPR" ) ) then local x, y, z = getElementPosition ( localPlayer ) triggerServerEvent ("iniciaJob8", localPlayer, x, y, z ) setTimer(function() plantsPoints = plantsPoints+1 outputChatBox( "Foi plantado "..(plantsPoints).."/2" ) if plantsPoints >= 2 then completMission() end end, 6500, 1) else outputChatBox (" voçê deve esperar 6 sec para plantar novamente " ) end end addCommandHandler ( "d", plant ) end end ) addEventHandler("onClientColShapeLeave", retanguloParaPlantio, function ( theElement, matchingDimension ) if ( theElement == localPlayer ) then outputChatBox( "nop Function." ) removeCommandHandler ( "d", plant ) end end ) end function completMission () outputChatBox ("voçê plantou todos") plantsPoints = 0 destroyElement ( hillRadar ) triggerServerEvent ( "onDestroyElement", localPlayer ) end
  7. Okay, Me desculpem vou tentar me expresar melhor addEvent( "createMakerFim7", true ) addEventHandler( "createMakerFim7", getRootElement(), function( vehGuincho7, veh7, client, client ) timerBlip7 = setTimer( function() if ( getVehicleTowingVehicle ( vehGuincho7[client] ) == veh7[client] ) ~= true then -- if it attached if isElement(Bfim7) then destroyElement(Bfim7) end if isElement(Mfim7) then destroyElement(Mfim7) end if not isElement(BcarLocal7) then BcarLocal7 = createBlipAttachedTo ( vehGuincho7[client], 12 ) end elseif (getVehicleTowingVehicle ( vehGuincho7[client] ) == veh7[client]) ~= false then if isElement(Mfim7) ~= true then Mfim7 = createMarker (201.09660, 1902.68530, 17.64063 -1, "cylinder", 2, 0 ,255 ,0, 255) end if isElement(Bfim7) ~= true then Bfim7 = createBlipAttachedTo ( Mfim7, 19 ) end if isElement(BcarLocal7) then destroyElement(BcarLocal7) end end end, 200, 0 ) timerFinal7 = setTimer( function() if isElement ( Mfim7 ) then if isElement ( vehGuincho7[client] ) and isElement ( veh7[client] ) then addEventHandler("onClientMarkerHit", Mfim7, function ( hitPlayer, md ) local playerVeh = getPedOccupiedVehicle(hitPlayer) if hitPlayer == localPlayer and playerVeh and getElementData(playerVeh, "Owner7") == hitPlayer and md then if ( getVehicleTowingVehicle ( vehGuincho7[client] ) == veh7[client] ) then triggerServerEvent( "completedFinalMission7", localPlayer ) end end end ) end end end, 200, 0 ) end ) Queria a opinião de vcs sobre, crei dois 2 timer um para verificar o veiculo e o guincho, o outro timer fiz para verifica se o marker foi criado Explicando script * TimerBlip7 Faz as verificações para ver se o veiculo esta guinchado ou não *TimerFinal7 As primeira e a segunda verificação é se os elementos foram criados! A terceira e "getElementData" que vcs me ensinara a fazer para verificar se é o JOGADOR, é o player da missão A Quarta verificação é se o Veiculo esta Guinchado ao outro. esta e a parte que usei para destruir as coisas quando a missão for completa or falhada, tipo se destruir o "veh", ficar muito tempo fora do Veiculo. etc, tds iram ativar esta função function destroyMarker7 () if isTimer ( timerFinal7 ) then killTimer ( timerFinal7 ) end if isTimer ( timerBlip7 ) then killTimer ( timerBlip7 ) end if isElement ( BcarLocal7 ) then destroyElement ( BcarLocal7 ) end if isElement ( Mfim7 ) then destroyElement ( Mfim7 ) end if isElement ( Bfim7 ) then destroyElement ( Bfim7 ) end end addEvent ("destroyMarkerAndBlips7", true) addEventHandler ("destroyMarkerAndBlips7", getRootElement(), destroyMarker7) obs: tudo isso esta no lado Client queria a opnião de vocês sobre o que deve ser mudado ou o que esta errado, atualmente não encontrei nenhum erro já testei com outros jogadores. sobre o erro do "warp" eu não sei como explicar mas so funciona para min, quando outros jogadores tentam usar eles não são teleportados para dentro de veiculo. e um erro esquisito pois ele não aparece no "debugscript 3" ou talvez eu não consiga ver por não acontecer comigo, vcs tem alguma ideia do que seja o script do lado server esta aki a baixo local veh7 = {} local vehGuincho7 = {} local timerVeh7 = {} function inicio7 ( vxGuin7, vyGuin7, vzGuin7, vrotGuin7, vx7, vy7, vz7, vrot7 ) if client ~= source or not (vrot7) then return end -- cheater detected! if isElement (veh7[client]) then destroyElement (veh7[client]) end if client ~= source or not (vrotGuin7) then return end -- cheater detected! if isElement (vehGuincho7[client]) then destroyElement (vehGuincho7[client]) end setElementData( client, "Trabalho7", true, false ) -- seta o jogador no element-data "Trabalho"; sinc com o client desativada veh7[client] = createVehicle ( 525, vx7, vy7, vz7, 0, 0, vrot7 ) setElementData( veh7[client], "Owner7", client ) outputChatBox ("#ffff00Drive the vehicle to the checkpoint. Note: You cannot leave the car during the mission.", client, 0, 0, 0, true) warpPedIntoVehicle (client, veh7[client]) vehGuincho7[client] = createVehicle ( 602, vxGuin7, vyGuin7, vzGuin7, 0, 0, vrotGuin7 ) triggerClientEvent (client, "createMakerFim7", client, vehGuincho7, veh7, client, client ) end addEvent ("iniciaJob7", true) addEventHandler ("iniciaJob7", getRootElement(), inicio7) este script funciona assim, quando no Gui Window e seleciono a missão 7 e aperto Start onde vai iniciar a função "inicioJob7" # onde vair criar os veiculos # vai definir o setElementData # e vai ativar o #WarpPedIntoVehicle# ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- é Possivel criar um marker que seja visivel apenas para o player da missão Marker arrow " que fique em cima do veiculo para o jogador saber qual e o seu"
  8. Okay, eu tinha as exportado do tringgerEvent do lado server para client, teriam alguma sugestão de como eu poderia fazer para verificar se é o veiculo correto, o veiculo foi criado no lado server, devo usar um setElementData ou algo do tipo para detectar se é o jogador da missão se é o guincho da missão q foi criado pelo jogador da missão se o carro que precisa ser rebocado e o do jogador Tenho que fazer estas 3 verificações anter de completar a missão, o script esta acima, podem me sugerir algo? Fiz o marker do final no lado client para ser visto apenas pelo jogador da missão,
  9. Podemos dizer que meu inglês não é muito bom, mas consigo entender os erros porem não sei porque acontecem, não tenho curso de .lua ou de lógica de progamação, estou aprendendo muito com vcs do forum que me ajudam, mas tem coisas que tenho muita dificuldade como #tabelas, #for _player esta partes ainda não compreendi muito como funciona, sobre os erros Tipo aparece q o argumento 1 não foi especificado, porem na primeira vez q a missão é feita funciona sem erro, então significa q da primeira vez q foi feita a missão, o veh tinha sido especificado, porem na segunda vez não, por isso não compreendi o erro, se não tivesse funcionado a primeira vez eu saberia q estava errado porem como funcionou, eu não consegui encontrar o erro. Pude perceber uma coisa este erro apare x29 ou seja, acho q pode estar sendo causado pelo seTimer, será q meu killTimer não esta funcionado ?
  10. Tentei usar o que voçê me sugerio assima porem não funcionou no client, e nem no server, então me baseei no que você mandou e fiz assim, porem estou com um erro Mission_client localitionveh7 = { [1] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [2] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [3] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [4] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [5] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, } localitionGuinchoVeh7 = { [1] = {525, 224.94553, 1912.85986, 17.85481, 0, 0, 270}, [2] = {525, 224.94553, 1912.85986, 17.85481, 0, 0, 270}, [3] = {525, 224.94553, 1912.85986, 17.85481, 0, 0, 270}, [4] = {525, 224.94553, 1912.85986, 17.85481, 0, 0, 270}, [5] = {525, 224.94553, 1912.85986, 17.85481, 0, 0, 270}, } local i = 1 local iGuin = 1 function createPlayerLocation7() local vxGuin7 ,vyGuin7, vzGuin7, vrotGuin7 = localitionGuinchoVeh7[ iGuin ][ 2 ], localitionGuinchoVeh7[ iGuin ][ 3 ], localitionGuinchoVeh7[ iGuin ][ 4 ], localitionGuinchoVeh7[ iGuin ][ 7 ] iGuin = iGuin + 1 if iGuin > #localitionGuinchoVeh7 then iGuin = 1 end local vx7 ,vy7, vz7, vrot7 = localitionveh7[ i ][ 2 ], localitionveh7[ i ][ 3 ], localitionveh7[ i ][ 4 ], localitionveh7[ i ][ 7 ] i = i + 1 if i > #localitionveh7 then i = 1 end triggerServerEvent( "iniciaJob7", localPlayer, vxGuin7, vyGuin7, vzGuin7, vrotGuin7, vx7 ,vy7, vz7, vrot7 ) end addEvent( "createMakerFim7", true ) addEventHandler( "createMakerFim7", getRootElement(), function( vehGuincho7, veh7, client, client ) local timerBlip7 = setTimer( function() if ( getVehicleTowingVehicle ( vehGuincho7[client] ) == veh7[client] ) ~= true then -- if it attached if isElement(Bfim7) then destroyElement(Bfim7) end if isElement(Mfim7) then destroyElement(Mfim7) end if not isElement(BcarLocal7) then BcarLocal7 = createBlipAttachedTo ( vehGuincho7[client], 12 ) end --outputChatBox( "O veículo foi solto", player ) elseif (getVehicleTowingVehicle ( vehGuincho7[client] ) == veh7[client]) ~= false then if isElement(Mfim7) ~= true then Mfim7 = createMarker (201.09660, 1902.68530, 17.64063 -1, "cylinder", 2, 0 ,255 ,0, 255) end if isElement(Bfim7) ~= true then Bfim7 = createBlipAttachedTo ( Mfim7, 19 ) end if isElement(BcarLocal7) then destroyElement(BcarLocal7) end --outputChatBox( "Veículo anexado", player ) end end, 200, 0 ) local timerFinal7 = setTimer( function() if isElement ( Mfim7 ) then function finalmission7 () if ( getVehicleTowingVehicle ( vehGuincho7[client] ) == veh7[client] ) then -- if it attached if isTimer ( timerFinal7 ) ~= false then killTimer ( timerFinal7 ) end if isTimer ( timerBlip7 ) ~= false then killTimer ( timerBlip7 ) end triggerServerEvent( "completedFinalMission7", localPlayer ) end end addEventHandler("onClientMarkerHit", Mfim7, finalmission7) end end, 200, 0 ) end ) function destroyMarker7 () --completMission () if isElement ( BcarLocal7 ) then destroyElement ( BcarLocal7 ) end if isElement ( Mfim7 ) then destroyElement ( Mfim7 ) end if isElement ( Bfim7 ) then destroyElement ( Bfim7 ) end end addEvent ("destroyMarkerAndBlips7", true) addEventHandler ("destroyMarkerAndBlips7", getRootElement(), destroyMarker7) mission_sever local veh7 = {} local vehGuincho7 = {} local timerVeh7 = {} function inicio7 ( vxGuin7, vyGuin7, vzGuin7, vrotGuin7, vx7, vy7, vz7, vrot7 ) if client ~= source or not (vrot7) then return end -- cheater detected! if isElement (veh7[client]) then destroyElement (veh7[client]) end if client ~= source or not (vrotGuin7) then return end -- cheater detected! if isElement (vehGuincho7[client]) then destroyElement (vehGuincho7[client]) end setElementData( client, "Trabalho7", true, false ) -- seta o jogador no element-data "Trabalho"; sinc com o client desativada veh7[client] = createVehicle ( 525, vx7, vy7, vz7, 0, 0, vrot7 ) outputChatBox ("#ffff00Drive the vehicle to the checkpoint. Note: You cannot leave the car during the mission.", client, 0, 0, 0, true) warpPedIntoVehicle (client, veh7[client]) vehGuincho7[client] = createVehicle ( 602, vxGuin7, vyGuin7, vzGuin7, 0, 0, vrotGuin7 ) triggerClientEvent (client, "createMakerFim7", client, vehGuincho7, veh7, client, client ) timerVeh7[client] = setTimer( addEndMissionTimer7, 50000, 1, client ) local player = client addEventHandler ( "onVehicleExplode", veh7[player], function () destroyElement (source) destroyElement (vehGuincho7[player]) veh7[player] = nil vehGuincho7[player] = nil takePlayerMoney ( player, 5000 ) setElementData( player, "Trabalho7", nil, false ) outputChatBox("Mission failed, your veh6icle blew up.", player , 255, 0, 0) triggerClientEvent (player, "destroyMarkerAndBlips7", player) end) addEventHandler ( "onVehicleExplode", vehGuincho7[player], function () destroyElement (veh7[player]) destroyElement (source) veh7[player] = nil vehGuincho7[player] = nil takePlayerMoney ( player, 5000 ) setElementData( player, "Trabalho7", nil, false ) outputChatBox("Mission failed, your veh6icle blew up.", player , 255, 0, 0) triggerClientEvent (player, "destroyMarkerAndBlips7", player) end) function entrar7 (thePlayer) if isTimer (timerVeh7[thePlayer]) then killTimer (timerVeh7[thePlayer]) end end addEventHandler ("onVehicleEnter", veh7[client], entrar7) end addEvent ("iniciaJob7", true) addEventHandler ("iniciaJob7", getRootElement(), inicio7) function playerDead7() if veh7[source] or vehGuincho7[source] then outputChatBox ( "Missão falhou: Você morreu!", source, 255, 255, 255, true ) destroyElement (veh7[source]) destroyElement (vehGuincho7[source]) veh7[source] = nil vehGuincho7[source] = nil setElementData( source, "Trabalho7", nil, false ) triggerClientEvent (source, "destroyMarkerAndBlips7", source) end end addEventHandler ( "onPlayerWasted", getRootElement(), playerDead7) function sair7 (thePlayer) --If you leave the vehicle for more than 1 min and do not return then the vehicle will disappear and the mission will failled-- if source == veh7[thePlayer] then if isTimer (timerVeh7[thePlayer]) then resetTimer (timerVeh7[thePlayer]) else timerVeh7[thePlayer] = setTimer( addEndMissionTimer7, 50000, 1, thePlayer ) end end end addEventHandler ("onVehicleExit", getRootElement(), sair7) function addEndMissionTimer7( player ) if player then if not ( isElement( veh7[player] ) ) then return end if getVehicleController( veh7[player] ) ~= player then outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", player, 255, 255, 255, true ) destroyElement ( veh7[player] ) destroyElement (vehGuincho7[player]) veh7[player] = nil vehGuincho7[player] = nil setElementData( player, "Trabalho7", nil, false ) triggerClientEvent (player, "destroyMarkerAndBlips7", player) end end end function completedMission7 () if veh7[source] then outputChatBox ( "Completou a missão!", source, 255, 255, 255, true ) destroyElement (veh7[source]) destroyElement (vehGuincho7[source]) veh7[source] = nil vehGuincho7[source] = nil setElementData( source, "Trabalho7", nil, false ) triggerClientEvent (source, "destroyMarkerAndBlips7", source) end end addEvent ("completedFinalMission7", true) addEventHandler ("completedFinalMission7", getRootElement(), completedMission7) function abandenedMission7 () outputChatBox ( "Mission abandoned", source, 255, 255, 255, true ) destroyElement (veh7[source]) destroyElement (vehGuincho7[source]) veh7[source] = nil vehGuincho7[source] = nil setElementData( source, "Trabalho7", nil, false ) triggerClientEvent (source, "destroyMarkerAndBlips7", source) end addEvent ("abandenedMission7", true) addEventHandler ("abandenedMission7", getRootElement(), abandenedMission7) porem a só acontece após fazer a primeira vez a missão exemplo: fiz a missão normalmente tudo funcionando, quando vou Refaze-la, ou seja iniciar novamente ela aparece o erro ao completa-la WARNING: GUImision/c.mission.lua:106: Bad argument @ 'getVehicleTowingVehicle' [Expected vehicle at argument 1] e tambem tenho o problema com warpPedIntoVehicle ( client, veh7[client] ) não aparece nenhum erro no debug, mas funciona apenas em mim, nos outros jogadores não funciona
  11. Eu não entendi muito bem como fazer usando o setTimer. Tentei este modo porem so funciona uma vez, depois para de funcionar não aparece bug no debugscript 3, porem acho que o erro esta nesta parte, onde e verificado se o veiculo não esta guinchado " if not ( getVehicleTowingVehicle ( veh7[client] ) == vehGuincho7[client] ) then " function vehNotTowingVeh7 () if not ( getVehicleTowingVehicle ( veh7[client] ) == vehGuincho7[client] ) then -- if it attached if not isElement (BcarLocal7) then BcarLocal7 = createBlipAttachedTo ( veh7[client], 13 ) end if isElement (Mfim7) and isElement (Bfim7) then destroyElement (Mfim7) destroyElement (Bfim7) end end end addEventHandler ( "onClientRender", getRootElement(), vehNotTowingVeh7 ) function vehTowingVeh7 () if ( getVehicleTowingVehicle ( veh7[client] ) == vehGuincho7[client] ) then -- if it attached Mfim7 = createMarker (201.09660, 1902.68530, 17.64063 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim7 = createBlipAttachedTo ( Mfim7, 19 ) destroyElement (BcarLocal7) outputDebugString("destruido o criar Bcar") end end addEventHandler ( "onClientRender", getRootElement(), vehTowingVeh7 )
  12. Eu decidi remover o PED, pois não consegui resolver o bug do ped dentro do veiculo então até agora não encontrei mais bugs porem aqui não sei como fazer BcarLocal7 = seria onde o veiculo de ser encontrado, Ou seja o veiculo que precisa ser guinchado, eu gostaria de fazer um detector para destruir e para criar "BcarLocal7" Quando estiver guinchado (" destroy BcarLocal7") Quando não estiver guinchado (" create BcarLocal7") como não existe uma função "onVehicleTowedByVehicle" para usar no EventHandler eu usei "onClientRender" para fazer varios detectamentos até o veiculo esta guinchado, isso esta certo ou existe outra forma mais correta de fazer "nenhum bug encontrado no debugscript 3" Client Side function finalCarMission7 ( veh7, client, vehGuincho7 ) BcarLocal7 = createBlipAttachedTo ( veh7[client], 13 ) function vehTowingVeh7 () if ( getVehicleTowingVehicle ( veh7[client] ) == vehGuincho7[client] ) then -- if it attached Mfim7 = createMarker (201.09660, 1902.68530, 17.64063 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim7 = createBlipAttachedTo ( Mfim7, 19 ) destroyElement (BcarLocal7) removeEventHandler("onClientRender", getRootElement(), vehTowingVeh7) end end addEventHandler ( "onClientRender", getRootElement(), vehTowingVeh7 ) function finalmissionRender7 () if isElement ( Mfim7 ) then removeEventHandler("onClientRender", getRootElement(), vehTowingVeh7) if isElement ( Mfim7 ) then function finalmission7 () if ( getVehicleTowingVehicle ( veh7[client] ) == vehGuincho7[client] ) then -- if it attached triggerServerEvent( "completedFinalMission7", localPlayer ) else outputChatBox ("testing") end end addEventHandler("onClientMarkerHit", Mfim7, finalmission7) end end end addEventHandler ( "onClientRender", getRootElement(), finalmissionRender7 ) end addEvent ("createMakerFim7", true) addEventHandler ("createMakerFim7", getRootElement(), finalCarMission7)
  13. Server-side local veh7 = {} local vehGuincho7 = {} local timerVeh7 = {} function inicio7 ( vx7, vy7, vz7, vrot7, vxGuin7, vyGuin7, vzGuin7, vrotGuin7 ) if client ~= source or not (vrot7) then return end -- cheater detected! if isElement (veh7[client]) then destroyElement (veh7[client]) end setElementData( client, "Trabalho7", true, false ) -- seta o jogador no element-data "Trabalho"; sinc com o client desativada veh7[client] = createVehicle ( 525, vx7, vy7, vz7, 0, 0, vrot7 ) outputChatBox ("#ffff00Drive the vehicle to the checkpoint. Note: You cannot leave the car during the mission.", client, 0, 0, 0, true) warpPedIntoVehicle (client, veh7[client]) vehGuincho7[client] = createVehicle ( 602, vxGuin7, vyGuin7 + 5, vzGuin7, 0, 0, vrotGuin7 ) GuinchoPed = createPed ( 120, vxGuin7 ,vyGuin7, vzGuin7 ) warpPedIntoVehicle ( GuinchoPed, vehGuincho7[client] ) setVehicleEngineState ( vehGuincho7[client], false ) --setElementData( vehGuincho7[client], "Owner7", client ) triggerClientEvent (client, "createMakerFim7", client, GuinchoPed) timerVeh7[client] = setTimer( addEndMissionTimer7, 5000, 1, client ) local player = client addEventHandler ( "onVehicleExplode", veh7[player], function () destroyElement (source) veh7[player] = nil takePlayerMoney ( player, 5000 ) setElementData( player, "Trabalho7", nil, false ) setElementData( player, "Owner7", nil ) outputChatBox("Mission failed, your veh6icle blew up.", player , 255, 0, 0) triggerClientEvent (player, "destroyMarkerAndBlips7", player) end) function entrar7 (thePlayer) if isTimer (timerVeh7[thePlayer]) then killTimer (timerVeh7[thePlayer]) end end addEventHandler ("onVehicleEnter", veh7[client], entrar7) end addEvent ("iniciaJob7", true) addEventHandler ("iniciaJob7", getRootElement(), inicio7) function playerDead7() if veh7[source] then outputChatBox ( "Missão falhou: Você morreu!", source, 255, 255, 255, true ) destroyElement (veh7[source]) veh7[source] = nil setElementData( source, "Trabalho7", nil, false ) setElementData( source, "Owner7", nil ) triggerClientEvent (source, "destroyMarkerAndBlips7", source) end end addEventHandler ( "onPlayerWasted", getRootElement(), playerDead7) function sair7 (thePlayer) --If you leave the vehicle for more than 1 min and do not return then the vehicle will disappear and the mission will failled-- if source == veh7[thePlayer] then if isTimer (timerVeh7[thePlayer]) then resetTimer (timerVeh7[thePlayer]) else timerVeh7[thePlayer] = setTimer( addEndMissionTimer7, 5000, 1, thePlayer ) end end end addEventHandler ("onVehicleExit", getRootElement(), sair7) function addEndMissionTimer7( player ) if player then if not ( isElement( veh7[player] ) ) then return end if getVehicleController( veh7[player] ) ~= player then outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", player, 255, 255, 255, true ) destroyElement ( veh7[player] ) veh7[player] = nil setElementData( player, "Trabalho7", nil, false ) setElementData( player, "Owner7", nil ) triggerClientEvent (player, "destroyMarkerAndBlips7", player) end end end function completedMission7 () if veh7[source] then outputChatBox ( "Completou a missão!", source, 255, 255, 255, true ) destroyElement (veh7[source]) veh7[source] = nil setElementData( source, "Trabalho7", nil, false ) setElementData( source, "Owner7", nil ) triggerClientEvent (source, "destroyMarkerAndBlips7", source) end end addEvent ("completedFinalMission7", true) addEventHandler ("completedFinalMission7", getRootElement(), completedMission7) function abandenedMission7 () outputChatBox ( "Mission abandoned", source, 255, 255, 255, true ) destroyElement (veh7[source]) veh7[source] = nil setElementData( source, "Trabalho7", nil, false ) setElementData( source, "Owner7", nil ) triggerClientEvent (source, "destroyMarkerAndBlips7", source) end addEvent ("abandenedMission7", true) addEventHandler ("abandenedMission7", getRootElement(), abandenedMission7) Client-side localitionveh7 = { [1] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [2] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [3] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [4] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [5] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, } localitionGuinchoVeh7 = { [1] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [2] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [3] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [4] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, [5] = {525, 212.63116, 1906.95349, 17.64063, 0, 0, 270}, } local i = 1 local iGuin = 1 function createPlayerLocation7() local vx7 ,vy7, vz7, vrot7 = localitionveh7[ i ][ 2 ], localitionveh7[ i ][ 3 ], localitionveh7[ i ][ 4 ], localitionveh7[ i ][ 7 ] i = i + 1 if i > #localitionveh7 then i = 1 end local vxGuin7 ,vyGuin7, vzGuin7, vrotGuin7 = localitionGuinchoVeh7[ iGuin ][ 2 ], localitionGuinchoVeh7[ iGuin ][ 3 ], localitionGuinchoVeh7[ iGuin ][ 4 ], localitionGuinchoVeh7[ iGuin ][ 7 ] iGuin = iGuin + 1 if iGuin > #localitionGuinchoVeh7 then iGuin = 1 end triggerServerEvent( "iniciaJob7", localPlayer, vxGuin7, vyGuin7, vzGuin7, vrotGuin7, vx7 ,vy7, vz7, vrot7 ) end function finalCarMission7 ( GuinchoPed ) Mfim7 = createMarker (201.09660, 1902.68530, 17.64063 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim7 = createBlipAttachedTo ( Mfim7, 19 ) function finalmission7 () if isPedInVehicle ( GuinchoPed ) then triggerServerEvent( "completedFinalMission7", localPlayer ) end end addEventHandler("onClientMarkerHit", Mfim7, finalmission7) end addEvent ("createMakerFim7", true) addEventHandler ("createMakerFim7", getRootElement(), finalCarMission7) function destroyMarker7 () --completMission () if isElement ( Mfim7 ) then destroyElement ( Mfim7 ) end if isElement ( Bfim7 ) then destroyElement ( Bfim7 ) end end addEvent ("destroyMarkerAndBlips7", true) addEventHandler ("destroyMarkerAndBlips7", getRootElement(), destroyMarker7) Estou Projetando uma missão de guincho ou seja, algumas coisas funcionaram me b mas preciso especificar alguma coisas e resolver erros podem me ajudar * O guincho não consegue puxar o veiculo com o PED dentro, ache q fosse devido o carro ficar ligado então tentei "setVehicleEngineState ( vehGuincho7[client], false )" para desligar o veiculo enquanto o PED estava dentro porem mesmo assim não funcionou. * No final da missão onde voçê encontra o Marker, eu consegui especificar que o PED esta no veiculo, mas na hora do "onClientMarkerHit" ele vai funcionar apenas se eu passar com o veiculo não vai detectar se o carro guinchado esta junto. *o warpPedIntoVehicle, que puxa o jogador para o veiculo da missão tem um problema, ele funciona normalmente comigo, mas quando online ele não funciona com os outros jogadores, mas ainda sim continua funcionando comigo
  14. Eu devo usar isso neste element data ? quando terminar a missão, ou morrer ou explodir o veiculo ? setElementData( source, "Owner", nil, false ) e Obrigado pela ajuda
  15. Eu testei oq vc pediu pra mim fazer, porem não funcionou, no lado client. Porem no debug não aparece nenhum erro, onclientHitmarker esta funcionando porem na hora de detectar o setElementData q foi criado no lado server não e possivel Sobre o tempo de 5 meses eu estava ocupado com a escola e trabalho mas agor estou de ferias então posso me dedicar mais
  16. @DNL291 Aqui esta o lado client local localitionveh6 = { [1] = {401, 213.33366, 1871.35400, 13.14063, 0, 0, 270}, [2] = {401, 213.33366, 1871.35400, 13.14063, 0, 0, 270}, [3] = {401, 213.33366, 1871.35400, 13.14063, 0, 0, 270}, [4] = {401, 213.33366, 1871.35400, 13.14063, 0, 0, 270}, [5] = {401, 213.33366, 1871.35400, 13.14063, 0, 0, 270}, } local i = 1 function createPlayerLocation6() local vx ,vy, vz, vrot = localitionveh6[ i ][ 2 ], localitionveh6[ i ][ 3 ], localitionveh6[ i ][ 4 ], localitionveh6[ i ][ 7 ] i = i + 1 if i > #localitionveh6 then i = 1 end triggerServerEvent( "iniciaJob6", localPlayer, vx, vy, vz, vrot ) end function finalCarMission6 ( veh6 ) Mfim6 = createMarker (213.45134, 1908.39001, 17.64063 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim6 = createBlipAttachedTo ( Mfim6, 19 ) function finalmission6 (hitElement, md) if getElementType(hitElement) == "vehicle" and getElementData(hitElement, "Owner") == localPlayer and md then outputChatBox ("funcionado") end end addEventHandler("onClientMarkerHit", Mfim6, finalmission6) end addEvent ("final6car", true) addEventHandler ("final6car", getRootElement(), finalCarMission6) Aqui esta o lado Server local veh6 = {} local timerVeh6 = {} function inicio6 ( vx, vy, vz, vrot ) if client ~= source or not (vrot) then return end -- cheater detected! if isElement (veh6[client]) then destroyElement (veh6[client]) end setElementData( client, "Trabalho", true, false ) -- seta o jogador no element-data "Trabalho"; sinc com o client desativada veh6[client] = createVehicle ( 401, vx, vy, vz, 0, 0, vrot ) outputChatBox ("#ffff00Drive the vehicle to the checkpoint. Note: You cannot leave the car during the mission.", client, 0, 0, 0, true) timerVeh6[client] = setTimer( addEndMissionTimer, 60000, 1, client ) local Bfim6 = createBlipAttachedTo ( veh6[client], 15 ) local player = client addEventHandler ( "onVehicleExplode", veh6[player], function () destroyElement (source) veh6[player] = nil takePlayerMoney ( player, 5000 ) setElementData( player, "Trabalho", nil, false ) outputChatBox("Mission failed, your veh6icle blew up.", player , 255, 0, 0) end) function entrar6 (thePlayer) if isTimer (timerVeh6[thePlayer]) then killTimer (timerVeh6[thePlayer]) outputChatBox("Você entrou no veiculo", player , 255, 0, 0) destroyElement( Bfim6 ) triggerClientEvent (thePlayer, "final6car", thePlayer, veh6[client]) end end addEventHandler ("onVehicleEnter", veh6[client], entrar6) end addEvent ("iniciaJob6", true) addEventHandler ("iniciaJob6", getRootElement(), inicio6) function playerDead6() if veh6[source] then outputChatBox ( "Missão falhou: Você morreu!", source, 255, 255, 255, true ) destroyElement (veh6[source]) veh6[source] = nil setElementData( source, "Trabalho", nil, false ) end end addEventHandler ( "onPlayerWasted", getRootElement(), playerDead6) function sair6 (thePlayer) --If you leave the vehicle for more than 1 min and do not return then the vehicle will disappear and the mission will failled-- if source == veh6[thePlayer] then if isTimer (timerVeh6[thePlayer]) then resetTimer (timerVeh6[thePlayer]) else timerVeh6[thePlayer] = setTimer( addEndMissionTimer, 60000, 1, thePlayer ) end end end addEventHandler ("onVehicleExit", getRootElement(), sair6) function addEndMissionTimer( player ) if player then if not ( isElement( veh6[player] ) ) then return end if getVehicleController( veh6[player] ) ~= player then outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", player, 255, 255, 255, true ) destroyElement ( veh6[player] ) veh6[player] = nil setElementData( player, "Trabalho", nil, false ) end end end Okay eu add o script completo, Este setElementData( client, "Trabalho", true, false ) e ativado quando a missão e ativada, porem ele não especifica o Veh tentei fazer do jeito que você sugerio porem não funcionou, and no debug não aparece nenhum erro
  17. Eu editei o post acima, se tiver como usar aquele, me avise, vou tentar fazer no formato que você falou modo server ! function entrar6 (thePlayer) if isTimer (timerVeh6[thePlayer]) then killTimer (timerVeh6[thePlayer]) outputChatBox("Você entrou no veiculo", player , 255, 0, 0) destroyElement( Bfim6 ) --triggerClientEvent (thePlayer, "final6car", thePlayer, veh6) aposEstarVeh6 ( ) end end addEventHandler ("onVehicleEnter", veh6[client], entrar6) function aposEstarVeh6 () Mfim6 = createMarker (213.45134, 1908.39001, 17.64063 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim6 = createBlipAttachedTo ( Mfim6, 19 ) function missionCompleted6 (client) if veh6[client] and isElement(veh6[client]) then destroyElement (veh6[client]) destroyElement (Mfim6) destroyElement (Bfim6) veh6[client] = nil setElementData( client, "Trabalho", nil, false ) end end addEventHandler ("onMarkerHit", Mfim6, missionCompleted6) end modo client function finalCarMission6 ( veh6 ) Mfim6 = createMarker (213.45134, 1908.39001, 17.64063 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim6 = createBlipAttachedTo ( Mfim6, 19 ) function finalmission6 (source) if veh6[source] and isElement(veh6[source]) then outputDebugString("Test") else end end addEventHandler("onClientMarkerHit", Mfim6, finalmission6) end addEvent ("final6car", true) addEventHandler ("final6car", getRootElement(), finalCarMission6) modo client no lado serve function entrar6 (thePlayer) if isTimer (timerVeh6[thePlayer]) then killTimer (timerVeh6[thePlayer]) outputChatBox("Você entrou no veiculo", player , 255, 0, 0) destroyElement( Bfim6 ) triggerClientEvent (thePlayer, "final6car", thePlayer, veh6) end end addEventHandler ("onVehicleEnter", veh6[client], entrar6) porem ambos os modos tem o mesmo problema e possivel completar com qualquer veiculo qual modo devo usar, e como resolver na hora de detectar o veiculo e o jogador ?
  18. porém como vou definir que o marker vai ser para apenas o player que esta na missão no lado server ? este é o modo que eu estava tentando Client-side function finalCarMission6 ( veh6 ) Mfim6 = createMarker (213.45134, 1908.39001, 17.64063 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim6 = createBlipAttachedTo ( Mfim6, 19 ) function finalmission6 (source) if veh6[source] and isElement(veh6[source]) then outputDebugString("Test") else end end addEventHandler("onClientMarkerHit", Mfim6, finalmission6) end addEvent ("final6car", true) addEventHandler ("final6car", getRootElement(), finalCarMission6) Server-side function entrar6 (thePlayer) if isTimer (timerVeh6[thePlayer]) then killTimer (timerVeh6[thePlayer]) outputChatBox("Você entrou no veiculo", player , 255, 0, 0) destroyElement( Bfim6 ) triggerClientEvent (thePlayer, "final6car", thePlayer, veh6) end end addEventHandler ("onVehicleEnter", veh6[client], entrar6) Porem e possivel completar com qualquer carro, eu não consegui especificar o player da missão e o veiculo da missão
  19. O marker é o final da missão, onde voçê deve ir depois de pegar o veiculo
  20. Olá novamente, esqueci de perguntar uma coisa, o market devo criar no lado server ou no client se eu criar no client como vou fazer para detectar o veiculo que foi criado no lado server ? Mfim6 = createMarker (213.45134, 1908.39001, 17.64063 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim6 = createBlipAttachedTo ( Mfim6, 19 )
  21. @DNL291 Aqui esta server-side local veh6 = {} function inicio6 ( vx, vy, vz, vrot ) if client ~= source then return end -- cheater detected! if isElement (veh6[client]) then destroyElement (veh6[client]) end setElementData( client, "Trabalho", true, false ) -- seta o jogador no element-data "Trabalho"; sinc com o client desativada veh6[client] = createVehicle ( 401, vx, vy, vz, 0, 0, vrot ) outputChatBox ("#ffff00Drive the vehicle to the checkpoint. Note: You cannot leave the car during the mission.", client, 0, 0, 0, true) setTimer( function(p) if not ( isElement( veh6[p] ) ) then return end if getVehicleController( veh6[p] ) ~= p then outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", p, 255, 255, 255, true ) destroyElement ( veh6[p] ) veh6[p] = nil end end, 5000, 1, client ) local player = client addEventHandler ( "onVehicleExplode", veh6[player], function () destroyElement (source) veh6[player] = nil takePlayerMoney ( player, 5000 ) outputChatBox("Mission failed, your veh6icle blew up.", player , 255, 0, 0) end) function playerDead6() if veh6[client] and isElement(veh6[client]) then outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", client, 255, 255, 255, true ) destroyElement (veh6[client]) else end end addEventHandler ( "onPlayerWasted", getRootElement(), playerDead6) timerVeh6 = {} function sair6 (thePlayer) --If you leave the vehicle for more than 1 min and do not return then the vehicle will disappear and the mission will failled-- if source == veh6[thePlayer] then if isTimer (timerVeh6[source]) then resetTimer (timerVeh6[source]) else timerVeh6[source] = setTimer (function () destroyElement(veh6[thePlayer]) veh6[thePlayer] = nil triggerClientEvent (thePlayer, "failPlayerLeave5", thePlayer) end, 5000, 1) end end end addEventHandler ("onVehicleExit", getRootElement(), sair6) function entrar6 (thePlayer) if isTimer (timerVeh6[source]) then killTimer (timerVeh6[source]) end end addEventHandler ("onVehicleEnter", getRootElement(), entrar6) addEvent( "completedMisionVeh6", true ) addEventHandler( "completedMisionVeh6", getRootElement(), function() if source and isElement(veh6[client]) then destroyElement (veh6[client]) veh6[client] = nil end end ) end addEvent ("iniciaJob6", true) addEventHandler ("iniciaJob6", getRootElement(), inicio6) mission.client.lua local localitionveh6 = { [1] = {401, 213.33366, 1871.35400, 13.14063, 0, 0, 270}, [2] = {401, 213.33366, 1871.35400, 13.14063, 0, 0, 270}, [3] = {401, 213.33366, 1871.35400, 13.14063, 0, 0, 270}, [4] = {401, 213.33366, 1871.35400, 13.14063, 0, 0, 270}, [5] = {401, 213.33366, 1871.35400, 13.14063, 0, 0, 270}, } local i = 1 function createPlayerLocation6() local vx ,vy, vz, vrot = localitionveh6[ i ][ 2 ], localitionveh6[ i ][ 3 ], localitionveh6[ i ][ 4 ], localitionveh6[ i ][ 7 ] i = i + 1 if i > #localitionveh6 then i = 1 end triggerServerEvent( "iniciaJob6", localPlayer, vx, vy, vz, vrot ) Mfim6 = createMarker (213.00009, 1914.55029, 17.64063 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim6 = createBlipAttachedTo ( Mfim6, 19 ) end function vehiclePartsMission6 ( veh6 ) function finalmission6 () if veh6 and isElement(veh6) then outputChatBox("Mission Completed") destroyElement( Mfim6 ) destroyElement( Bfim6 ) triggerServerEvent("completedMisionVeh6",localPlayer) else end end addEventHandler("onClientMarkerHit",Mfim6 ,finalmission6) end addEvent ("partesMissionSix", true) addEventHandler ("partesMissionSix", getRootElement(), vehiclePartsMission GuiMission.lua elseif (guiGridListGetSelectedItem(ListMissions) == 5) then outputDebugString("6 was selected") createPlayerLocation6 () guiSetVisible (WinMission, me) showCursor (me) for wnd, id in pairs(elementos.window) do guiSetVisible (wnd, false) end end
  22. Olá, no começo o script esta, no lado server, então voçê pediu para min pasar pra client para evitar bugs, ou talvez eu tenha entendido errado então pesso desculpa, okay eu vou passa-lo pro lado server e quando pronto eu add aqui para ver se esta tudo correto.
  23. Então devo deixa o timer na lado server? E as outras funções como sair do veh, explodir veh e suicidio com /kill, estas funções devem estar no client,
  24. "E pare de usar Ç na palavra você" okay tentei fazer dentro da função mais não esta funcionando, poderia me mostrar como ?
×
×
  • Create New...