Jump to content

kevincouto6

Members
  • Posts

    235
  • Joined

  • Last visited

Everything posted by kevincouto6

  1. Tudo que voçê falou foi feito, porem quando eu estava testando percebi algo, tipo ele so vai detectar se voçê esta no veiculo depois que der o tempo maximo tipo 1 min, se o player entrar no veiculo com 12 sec ele tera que esperar mais 48 sec para receber a messagem de que esta no veiculo. exite alguma forma de eu fazer que assim que ele entre no veiculo inicie ? local counter = 0 setTimer( function() if not ( isElement( veh6 ) ) then return end for seat, player in pairs (getVehicleOccupants(veh6)) do counter = counter + 1 end if counter > 0 then outputChatBox ( "Voçê esta no Vehicle", 255, 255, 255, true ) else outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", 255, 255, 255, true ) triggerServerEvent("delVeh6",localPlayer) end counter = 0 end, 15000, 1, client ) Esta é a parte no lado client que eu uso pra, dar 2 min fora do veiculo se não mission failed, eu poderia usar a função entrar6 para ativar a função de cima. Eu tentei de uma fora tipo usar counter = counter +1 a cada vez que ele entrar no veiculo, mas não funcionou deve ser devido estar dentro de um timer, alguem poderia me dizer como fazer ? OBG ! function sair6 () if source == veh6 then if isTimer (timerVeh[source]) then resetTimer (timerVeh[source]) else timerVeh[source] = setTimer (function () outputChatBox("Voçê ficou mais de 2 min fora do Veiculo, missão failed") triggerServerEvent("timerDestroyVeh6",localPlayer) end, 60000, 1) end end end addEventHandler ("onClientVehicleExit", getRootElement(), sair6) function entrar6 () if isTimer (timerVeh[source]) then killTimer (timerVeh[source]) end end addEventHandler ("onClientVehicleEnter", getRootElement(), entrar6)
  2. Me baseando no que voçê me enviou fiz isso gui.client.lua Neste aqui eu troquei tringgerEvent por "createPlayerLocalition" assim ativa a localisão e depois ativa a criação do veiculo, elseif (guiGridListGetSelectedItem(ListMissions) == 5) then outputDebugString("6 was selected") createPlayerLocation () guiSetVisible (WinMission, me) showCursor (me) for wnd, id in pairs(elementos.window) do guiSetVisible (wnd, false) end end mission.client.lua Como voçês tinham falado anteriormente para passar tudo para o lado CLIENT então passei, bom o timer esta funcionando, porem a função que foi me recomendado usar "getVehicleController" para detectar se quem entrou no veh é o player da mission, não funcionou pois como esta no lado server não estou conseguindo detectar o jogador, e outra coisa que tenho que resolver e o destroyElement ( veh6 ) ele não esta funcionando, 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 createPlayerLocation() 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 vehiclePartsMission6 ( veh6 ) outputDebugString("funcionando") local counter = 0 setTimer( function() if not ( isElement( veh6 ) ) then return end for seat, player in pairs (getVehicleOccupants(veh6)) do counter = counter + 1 end if counter > 0 then if getVehicleController(veh6) == p then outputChatBox ( "Voçê esta no Vehicle", 255, 255, 255, true ) Mfim6 = createMarker (-1828.72888, -1627.62219, 23.23001 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim6 = createBlipAttachedTo ( Mfim6, 19 else outputChatBox ( "Voçê não é o player da mission, Por favor saia do veiculo !" ) end else outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", 255, 255, 255, true ) destroyElement ( veh6[localPlayer] ) veh6 = nil end counter = 0 end, 5000, 1, client ) function blowvehicle6 () if veh6 and isElement(veh6) then outputChatBox("Mission failed, your veh6icle blew up.") destroyElement (veh6) else end end addEventHandler ( "onClientVehicleExplode", veh6, blowvehicle6) function sair6 (thePlayer) if source == veh6[thePlayer] then if isTimer (timerVeh[source]) then resetTimer (timerVeh[source]) else timerVeh[source] = setTimer (function () destroyElement(veh6[thePlayer]) veh6[thePlayer] = nil triggerClientEvent (thePlayer, "failPlayerLeave5", thePlayer) end, 60000, 1) end end end addEventHandler ("onClientVehicleExit", getRootElement(), sair6) function entrar6 (thePlayer) if isTimer (timerVeh[source]) then killTimer (timerVeh[source]) end end addEventHandler ("onClientVehicleEnter", getRootElement(), entrar6) function playerDead5() if veh6 and isElement(veh6) then outputChatBox("Mission failed, your veh6icle blew up.") else end end addEventHandler("onClientPlayerWasted", root, playerDead5) function finalmission6 () if veh6 and isElement(veh6) then outputChatBox("Mission failed, your veh6icle blew up.") else end end addEventHandler("onClientMarkerHit",Mfim6 ,finalmission6) end addEvent ("partesMissionSix", true) addEventHandler ("partesMissionSix", getRootElement(), vehiclePartsMission6) server.lua aqui foi como ficou o lado server 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) triggerClientEvent (client, "partesMissionSix", client, veh6[client]) end addEvent ("iniciaJob6", true) addEventHandler ("iniciaJob6", getRootElement(), inicio6) Então o que tenho que resolver 1) add a verificação se o jogador da missião que esta entrando no veiculo 2)destruir o veiculo no lado Client, se não for possível, vou tentar com tringgerEvents poderiam me ajudar com isso, e se tiver mais alguma coisa a ser mudado pf avise-me, obrigado desde já
  3. Eu poderia add o script inteiro se nessesario porem e bastante coisa, eu tentei modificar o lado client, mas sempre aparecem esses erros @Lord Henry @DNL291 mission2/c.mission.lua252: Bad argument @'getVehicleOccupants'[Expecred vehicle at argument 1, got nill] mission2/c.mission.lua252: Bad argument #1 to 'pairs' (table expected, got boolean) ou attempt to index a userdata value Gui.Client.lua addEventHandler ("onClientGUIClick", getRootElement(), function (button, state, absoluteX, absoluteY) outputDebugString("onClientGUIClick called.") local me = not guiGetVisible (WinMission) if (source == accepted) then outputDebugString("guiGridListGetSelectedItem(ListMissions): "..guiGridListGetSelectedItem(ListMissions)) elseif (guiGridListGetSelectedItem(ListMissions) == 5) then outputDebugString("6 was selected") triggerServerEvent ("iniciaJob6", localPlayer) guiSetVisible (WinMission, me) showCursor (me) for wnd, id in pairs(elementos.window) do guiSetVisible (wnd, false) end end end end ) Server.lua veh6 = {} 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}, } i = 1 function inicio6 () if isElement (veh6[client]) then destroyElement (veh6[client]) veh6[client] = nil end 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 Trabalho = true veh6[client] = createVehicle ( 401, vx, vy, vz, 0, 0, vrot ) setElementVisibleTo (Bfim6, client, true) outputChatBox ("#ffff00Drive the vehicle to the checkpoint. Note: You cannot leave the car during the mission.", client, 0, 0, 0, true) triggerClientEvent (client, "mission6", client, veh6[source]) end addEvent ("iniciaJob6", true) addEventHandler ("iniciaJob6", getRootElement(), inicio6) mission.client.lua function timesveh ( veh6) outputDebugString("funcionando") local counter = 0 setTimer(function(p) for seat, player in pairs (getVehicleOccupants(veh6[p])) do counter = counter + 1 end if counter > 0 then outputChatBox ( "Voçê esta no Vehicle", p, 255, 255, 255, true ) else outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", p, 255, 255, 255, true ) destroyElement (veh6[p]) end counter = 0 end, 1000, 1, p) end addEvent ("mission6", true) addEventHandler ("mission6", localPlayer, timesveh)
  4. mission2/c.mission.lua252: Bad argument @'getVehicleOccupants'[Expecred vehicle at argument 1, got nill] mission2/c.mission.lua252: Bad argument #1 to 'pairs' (table expected, got boolean) now appears this bug, how do I specify a table that is server side?
  5. "for seat, player in pairs??(getVehicleOccupants(veh6[p])) do " o e rro que aparece no debbug é "do" ( expected near ) line 5
  6. A tabela não foi removida apenas esqueci de copiar tudo copiei apenas do inicio para baixo Mfim6 = createMarker (-1828.72888, -1627.62219, 23.23001 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim6 = createBlipAttachedTo ( Mfim6, 19 ) setElementVisibleTo ( Bfim6, root, false ) veh6 = {} 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}, } i = 1 function inicio6 () if isElement (veh6[client]) then destroyElement (veh6[client]) veh6[client] = nil end 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 Trabalho = true veh6[client] = createVehicle ( 401, vx, vy, vz, 0, 0, vrot ) setElementVisibleTo (Bfim6, client, true) outputChatBox ("#ffff00Drive the vehicle to the checkpoint. Note: You cannot leave the car during the mission.", client, 0, 0, 0, true) triggerClientEvent (client, "mission6", client,veh6) end addEvent ("iniciaJob6", true) addEventHandler ("iniciaJob6", getRootElement(), inicio6) lado client function partClientSixMission (veh6) local counter = 0 setTimer(function(p) for seat, player in pairs??(getVehicleOccupants(veh6[p])) do counter = counter + 1 end if counter > 0 then outputChatBox ( "Voçê esta no Vehicle", p, 255, 255, 255, true ) else outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", p, 255, 255, 255, true ) destroyElement (veh6[p]) end counter = 0 end, 5000, 1) local player6 = client addEventHandler ( "onClientVehicleExplode", veh6[client], function () if (veh6[player6]) and isElement(veh6[player6]) then destroyElement (source) takePlayerMoney ( player6, 5000 ) setElementVisibleTo ( Bfim6, player6, false ) outputChatBox("Mission failed, your veh6icle blew up.", player6 , 255, 0, 0) end end) end addEvent ("mission6", true) addEventHandler ("mission6", localPlayer, partClientSixMission) o e rro que aparece no debbug é "do" ( expected near ) line 5
  7. Olá deixei apenas a parte de criar o veiculo agora esta é a parte server function inicio6 () if isElement (veh6[client]) then destroyElement (veh6[client]) veh6[client] = nil end 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 Trabalho = true veh6[client] = createVehicle ( 401, vx, vy, vz, 0, 0, vrot ) setElementVisibleTo (Bfim6, client, true) outputChatBox ("#ffff00Drive the vehicle to the checkpoint. Note: You cannot leave the car during the mission.", client, 0, 0, 0, true) triggerClientEvent (client, "mission6", client,veh6) end addEvent ("iniciaJob6", true) addEventHandler ("iniciaJob6", getRootElement(), inicio6) e este o lado server , o primeiro erro que aparece no debbug é "do" ( expected near ) function partClientSixMission (veh6) local counter = 0 setTimer(function(p) for seat, player in pairs??(getVehicleOccupants(veh6[p])) do counter = counter + 1 end if counter > 0 then outputChatBox ( "Voçê esta no Vehicle", p, 255, 255, 255, true ) else outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", p, 255, 255, 255, true ) destroyElement (veh6[p]) end counter = 0 end, 5000, 1) local player6 = client addEventHandler ( "onClientVehicleExplode", veh6[client], function () if (veh6[player6]) and isElement(veh6[player6]) then destroyElement (source) takePlayerMoney ( player6, 5000 ) setElementVisibleTo ( Bfim6, player6, false ) outputChatBox("Mission failed, your veh6icle blew up.", player6 , 255, 0, 0) end end) end addEvent ("mission6", true) addEventHandler ("mission6", localPlayer, partClientSixMission)
  8. Olá denovo estou tentando passar para o lado Client como vcs recomendaram, algumas coisa eu consegui fazer porem exitem alguns erros que não estou conseguindo resolver * o veiculo esta dando spawn eu um local totalmente aleatorio * o timer parou de funcionar, para entrar no veiculo poderiam me dizer o que fazer, pois quero aprender -----------------------------------------------------------------------Client-side-------------------------------------------------------------------- veh6 = {} localitionveh6 = { [1] = {401, 213.3, 1871.3, 13.1, 30, 30, 270}, [2] = {401, 213.3, 1871.3, 13.1, 30, 30, 270}, [3] = {401, 213.3, 1871.3, 13.1, 30, 30, 270}, [4] = {401, 213.3, 1871.3, 13.1, 30, 30, 270}, [5] = {401, 213.3, 1871.3, 13.1, 30, 30, 270}, } i = 1 function inicio6 () if isElement (veh6[client]) then destroyElement (veh6[client]) veh6[client] = nil end 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 ) Trabalho = true outputChatBox ("Drive the vehicle to the checkpoint. Note: You cannot leave the car during the mission.") counter = 0 setTimer(function(p) for seat, player in pairs(getVehicleOccupants(veh6[p])) do counter = counter + 1 end if counter > 0 then outputChatBox ( "Voçê esta no Vehicle") else outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed") destroyElement (veh6[p]) end counter = 0 end, 5000, 1, client) end addCommandHandler ( "go", inicio6 ) este é o lado server --------------------------------------------------------------------------server---------------------------------------------------------------------------- function callClientFunction (inicio6, vx ,vy, vz, vrot) veh6 = createVehicle ( 401, vx, vy, vz, 0, 0, vrot ) end addEvent ("iniciaJob6", true) addEventHandler ("iniciaJob6", getRootElement(), callClientFunction)
  9. Eu estou meio confuso, não sei como fazer poderia me mostrar, ou dizer quais partes deveriam ir para o outro lado?
  10. Obg pela dica, devo pasar todo o script para o lado CLIENT ou apenas a parte do time?
  11. conhece algum tutorial que possa me ajudar a compreender tablas e loops? e obrigado pela ajuda
  12. Desculpe, postar 2 veses, não consegui editar aqui esta a parte onde os torna visível addEventHandler ("onClientGUIClick", getRootElement(), function (button, state, absoluteX, absoluteY) outputDebugString("onClientGUIClick called.") local me = not guiGetVisible (WinMission) if (source == info) then outputDebugString("guiGridListGetSelectedItem(ListMissions): "..guiGridListGetSelectedItem(ListMissions)) if (guiGridListGetSelectedItem(ListMissions) == 0) then outputDebugString("1 was selected") guiSetVisible (infoMission, true) guiSetVisible (infoMission2, me) guiSetVisible (infoMission3, me) elseif (guiGridListGetSelectedItem(ListMissions) == 1) then outputDebugString("2 was selected") guiSetVisible (infoMission2, true) guiSetVisible (infoMission, me) guiSetVisible (infoMission3, me) elseif (guiGridListGetSelectedItem(ListMissions) == 2) then outputDebugString("3 was selected") guiSetVisible (infoMission3, true) guiSetVisible (infoMission2, me) guiSetVisible (infoMission, me) elseif (guiGridListGetSelectedItem(ListMissions) == 3) then outputDebugString("4 was selected") end end end )
  13. É possivel evitar de fazer tudo isso, talvez uma tabela ou algo do tipo, tenho que criar mais ou menos 20 "guiCreateMemo", exite uma maneira mais facil de fazer, se tiver poderia me ensinar ? GUIEditor = { button = {}, window = {}, memo = {} } addEventHandler("onClientResourceStart", resourceRoot, function() infoMission = guiCreateWindow(939, 156, 196, 329, "Mission Description", false) guiSetVisible (infoMission, false) guiWindowSetSizable(infoMission, false) memo = guiCreateMemo(9, 32, 175, 196, "You must kill 50 zombies in area 51\n\n \n Reward\nMoney: R$ 5,000.00 \nEXP : 3555 ", false, infoMission) exitBuInfo = guiCreateButton(10, 280, 174, 40, "EXIT", false, infoMission) copyButton = guiCreateButton(9, 233, 175, 37, "COPY", false, infoMission) end ) addEventHandler("onClientResourceStart", resourceRoot, function() infoMission2 = guiCreateWindow(939, 156, 196, 329, "Mission Description", false) guiSetVisible (infoMission2, false) guiWindowSetSizable(infoMission, false) memo2 = guiCreateMemo(9, 32, 175, 196, "123456", false, infoMission2) exitBuInfo2 = guiCreateButton(10, 280, 174, 40, "EXIT", false, infoMission2) copyButton2 = guiCreateButton(9, 233, 175, 37, "COPY", false, infoMission2) end ) addEventHandler("onClientResourceStart", resourceRoot, function() infoMission3 = guiCreateWindow(939, 156, 196, 329, "Mission Description", false) guiSetVisible (infoMission3, false) guiWindowSetSizable(infoMission3, false) memo3 = guiCreateMemo(9, 32, 175, 196, "KEVIN", false, infoMission3) exitBuInfo3 = guiCreateButton(10, 280, 174, 40, "EXIT", false, infoMission3) copyButton3 = guiCreateButton(9, 233, 175, 37, "COPY", false, infoMission3) end ) addEventHandler ("onClientGUIClick", getRootElement(), function (button, state, absoluteX, absoluteY) local me = not guiGetVisible (infoMission) if (source == exitBuInfo) then guiSetVisible (infoMission, me) end end) addEventHandler ("onClientGUIClick", getRootElement(), function (button, state, absoluteX, absoluteY) local me = not guiGetVisible (infoMission2) if (source == exitBuInfo2) then guiSetVisible (infoMission2, me) end end) addEventHandler ("onClientGUIClick", getRootElement(), function (button, state, absoluteX, absoluteY) local me = not guiGetVisible (infoMission3) if (source == exitBuInfo3) then guiSetVisible (infoMission3, me) end end)
  14. Continua aparecendo o mesmo erro --mission six-- Mfim6 = createMarker (-1828.72888, -1627.62219, 23.23001 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim6 = createBlipAttachedTo ( Mfim6, 19 ) setElementVisibleTo ( Bfim6, root, false ) veh6 = {} -- Recomendo que evite posi��es decimais muito grandes. Use s� at� 3 casas decimais. 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}, -- O primeiro, quinto e sexto valor das posi��es n�o est�o sendo usados. Recomendo que delete-os. } i = 1 -- contador global function inicio6 () if isElement (veh6[client]) then -- Client = localPlayer, somente neste caso. destroyElement (veh6[client]) veh6[client] = nil end local vx ,vy, vz, vrot = localitionveh6[ i ][ 2 ], localitionveh6[ i ][ 3 ], localitionveh6[ i ][ 4 ], localitionveh6[ i ][ 7 ] i = i + 1 if i > #localitionveh6 then -- se i > 5, ent�o: i = 1 end Trabalho = true veh6[client] = createVehicle ( 401, vx, vy, vz, 0, 0, vrot ) setElementVisibleTo (Bfim6, client, true) outputChatBox ("#ffff00Drive the vehicle to the checkpoint. Note: You cannot leave the car during the mission.", client, 0, 0, 0, true) local counter = 0 setTimer(function(source) for seat, player in pairs(getVehicleOccupants(veh6[client])) do counter = counter + 1 end if counter > 0 then outputChatBox ( "Voçê esta no Vehicle", getRootElement(), 255, 255, 255, true ) else outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", getRootElement(), 255, 255, 255, true ) destroyElement (veh6[client]) end counter = 0 end, 5000, 1) WARNING:GUimission/server.lua:439: Bad argument @ 'getVehicleOccupants' [expected vewhicle at argument 1, got table] ERROR: GUimission/server.lua:439:bad argument #1 to 'pairs' (table expected, got boolean)
  15. Ops, me desculpe este é o erro WARNING:GUimission/server.lua:439: Bad argument @ 'getVehicleOccupants' [expected vewhicle at argument 1, got table] ERROR: GUimission/server.lua:439:bad argument #1 to 'pairs' (table expected, got boolean)
  16. Saberia me dizer como fazer para funcionar, pois --mission six-- Mfim6 = createMarker (-1828.72888, -1627.62219, 23.23001 -1, "cylinder", 2, 0 ,255 ,0, 255) Bfim6 = createBlipAttachedTo ( Mfim6, 19 ) setElementVisibleTo ( Bfim6, root, false ) veh6 = {} -- Recomendo que evite posi��es decimais muito grandes. Use s� at� 3 casas decimais. 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}, -- O primeiro, quinto e sexto valor das posi��es n�o est�o sendo usados. Recomendo que delete-os. } i = 1 -- contador global function inicio6 () if isElement (veh6[client]) then -- Client = localPlayer, somente neste caso. destroyElement (veh6[client]) veh6[client] = nil end local vx ,vy, vz, vrot = localitionveh6[ i ][ 2 ], localitionveh6[ i ][ 3 ], localitionveh6[ i ][ 4 ], localitionveh6[ i ][ 7 ] i = i + 1 if i > #localitionveh6 then -- se i > 5, ent�o: i = 1 end Trabalho = true veh6[client] = createVehicle ( 401, vx, vy, vz, 0, 0, vrot ) setElementVisibleTo (Bfim6, client, true) outputChatBox ("#ffff00Drive the vehicle to the checkpoint. Note: You cannot leave the car during the mission.", client, 0, 0, 0, true) local counter = 0 setTimer(function(source) for seat, player in pairs(getVehicleOccupants(veh6)) do counter = counter + 1 end if counter > 0 then outputChatBox ( "Voçê esta no Vehicle", getRootElement(), 255, 255, 255, true ) else outputChatBox ( "Voçê Nao entrou no veiculo a tempo mission failed", getRootElement(), 255, 255, 255, true ) destroyElement (veh[source]) end counter = 0 end, 5000, 1)
  17. Este é um script server, queria add a função setTimer, se o jogador sair do veh, porem quero desativar se o jogador retornar para o veh antes de ser destruido , achei melhor botar esta parte do script apenas, se nessesario posso mostra-lo completo, Obrigado dede Já function sair5 (source) if (veh5[source]) and isElement(veh5[source]) then destroyElement(veh5[source]) triggerClientEvent (source, "failPlayerLeave5",source ) else end end addEventHandler ( "onVehicleExit", getRootElement(), sair5 )
  18. Assim esta o script porem agora tenho que Deletar os BLIP conforme os jogador coletar os Marker, só q para isso a função que deixa invisivel funciona apenas no lado server, e os BLIP foram criados no lado Client como fasso para deixa-los invisiveis Client-side ---------------------------------------------------------------------------------------- cardrivepoints = 0 local createMarkerLocations1 = { {231.41704, 1877.68689, 17.64063 -1, "cylinder", 4, 0 ,255 ,0, 255}, {231.41704, 1877.68689, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170 }, {231.41704, 1877.68689, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170}, {231.41704, 1877.68689, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170 }, {231.41704, 1877.68689, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170}, } local createMarkerLocations2 = { {231.85756, 1892.57666, 17.64063 -1, "cylinder", 4, 0 ,255 ,0, 255}, {231.85756, 1892.57666, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170 }, {231.85756, 1892.57666, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170}, {231.85756, 1892.57666, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170 }, {231.85756, 1892.57666, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170}, } local createMarkerLocations3 = { {229.22476, 1906.36658, 17.64063 -1, "cylinder", 4, 0 ,255 ,0, 255}, {229.22476, 1906.36658, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170 }, {229.22476, 1906.36658, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170}, {229.22476, 1906.36658, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170 }, {229.22476, 1906.36658, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170}, } local createMarkerLocations4 = { {212.10025, 1908.91870, 17.64063 -1, "cylinder", 4, 0 ,255 ,0, 255}, {212.10025, 1908.91870, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170 }, {212.10025, 1908.91870, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170}, {212.10025, 1908.91870, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170 }, {212.10025, 1908.91870, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170}, } local createMarkerLocations5 = { {192.29828, 1911.02271, 17.64063 -1, "cylinder", 4, 0 ,255 ,0, 255}, {192.29828, 1911.02271, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170 }, {192.29828, 1911.02271, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170}, {192.29828, 1911.02271, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170 }, {192.29828, 1911.02271, 17.64063 -1, "cylinder", 4, 255, 255, 0, 170}, } function outher () function createRandomMarker(table) local randomRow = math.random(1,#table) return createMarker(table[randomRow][1], table[randomRow][2], table[randomRow][3], table[randomRow][4], table[randomRow][5], table[randomRow][6], table[randomRow][7], table[randomRow][8], table[randomRow][9]) end markerElement1 = createRandomMarker(createMarkerLocations1) markerFim1 = createBlipAttachedTo ( markerElement1, 19 ) markerElement2 = createRandomMarker(createMarkerLocations2) markerFim2 = createBlipAttachedTo ( markerElement2, 19 ) markerElement3 = createRandomMarker(createMarkerLocations3) markerFim3 = createBlipAttachedTo ( markerElement3, 19 ) markerElement4 = createRandomMarker(createMarkerLocations4) markerFim4 = createBlipAttachedTo ( markerElement4, 19 ) markerElement5 = createRandomMarker(createMarkerLocations5) markerFim5 = createBlipAttachedTo ( markerElement5, 19 ) end addEvent ("mission5", true) addEventHandler ("mission5", getRootElement(), outher) function callServerFunction (veh5) function partfim1 (source) if veh5[source] and isElement(veh5[source]) then cardrivepoints = cardrivepoints+1 destroyElement (markerElement1) end if cardrivepoints >= 1 then triggerServerEvent ("completedMissionCollect", localPlayer) end end addEventHandler("onClientMarkerHit",markerElement1 ,partfim1) function partfim2 (source) if veh5[source] and isElement(veh5[source]) then cardrivepoints = cardrivepoints+1 destroyElement (markerElement2) end if cardrivepoints >= 1 then triggerServerEvent ("completedMissionCollect", localPlayer) end end addEventHandler("onClientMarkerHit",markerElement2 ,partfim2) function partfim3 (source) if veh5[source] and isElement(veh5[source]) then cardrivepoints = cardrivepoints+1 destroyElement (markerElement3) end if cardrivepoints >= 1 then triggerServerEvent ("completedMissionCollect", localPlayer) end end addEventHandler("onClientMarkerHit",markerElement3 ,partfim3) function partfim4 (source) if veh5[source] and isElement(veh5[source]) then cardrivepoints = cardrivepoints+1 destroyElement (markerElement4) end if cardrivepoints >= 1 then triggerServerEvent ("completedMissionCollect", localPlayer) end end addEventHandler("onClientMarkerHit",markerElement4 ,partfim4) function partfim5 (source) if veh5[source] and isElement(veh5[source]) then cardrivepoints = cardrivepoints+1 destroyElement (markerElement5) end if cardrivepoints >= 1 then triggerServerEvent ("completedMissionCollect", localPlayer) end end addEventHandler("onClientMarkerHit",markerElement5 ,partfim5) end addEvent ("mission5", true) addEventHandler ("mission5", getRootElement(), callServerFunction) server-side --mission five-- i = 1 -- contador global veh5 = {} -- Recomendo que evite posi趥s decimais muito grandes. Use s?頳 casas decimais. localitionveh55 = { [1] = {401, 216.82504, 1870.22961, 17.3440, 0, 0, 270}, [2] = {401, 216.82504, 1870.22961, 17.3440, 0, 0, 270}, [3] = {401, 216.82504, 1870.22961, 17.3440, 0, 0, 270}, [4] = {401, 216.82504, 1870.22961, 17.3440, 0, 0, 270}, [5] = {401, 216.82504, 1870.22961, 17.3440, 0, 0, 270}, -- O primeiro, quinto e sexto valor das posi趥s n䯠est䯠sendo usados. Recomendo que delete-os. } function inicio5 () if isElement (veh5[client]) then -- Client = localPlayer, somente neste caso. destroyElement (veh5[client]) veh5[client] = nil end local vx ,vy, vz, vrot = localitionveh55[ i ][ 2 ], localitionveh55[ i ][ 3 ], localitionveh55[ i ][ 4 ], localitionveh55[ i ][ 7 ] i = i + 1 if i > #localitionveh55 then -- se i > 5, ent䯺 i = 1 end Trabalho = true veh5[client] = createVehicle ( 401, vx, vy, vz, 0, 0, vrot ) warpPedIntoVehicle (client, veh5[client]) outputChatBox ("#ffff00Drive the veh5icle to the checkpoint. Note: You cannot leave the car during the mission.", client, 0, 0, 0, true) triggerClientEvent (client, "mission5", client,veh5) local player2 = client addEventHandler ( "onVehicleExplode", veh5[client], function () if (veh5[player2]) and isElement(veh5[player2]) then destroyElement (source) takePlayerMoney ( player2, 5000 ) outputChatBox("Mission failed, your veh5icle blew up.", player2 , 255, 0, 0) end end) end addEvent ("iniciaJob5", true) -- Cria o evento "iniciaJob e permite que ele seja chamado pelo client. addEventHandler ("iniciaJob5", getRootElement(), inicio5) -- Executa essa fun褯 quando o evento "iniciaJob" for chamado. function sair5 (source) if (veh5[source]) and isElement(veh5[source]) then destroyElement (veh5[source]) takePlayerMoney ( source, 5000 ) outputChatBox("#ff0000Mission failed, you have left the veh5icle.", source ,0,0,0,true) else end end addEventHandler ( "onVehicleExit", getRootElement(), sair5 ) function morrer5() if (veh5[source]) and isElement(veh5[source]) then destroyElement (veh5[source]) takePlayerMoney ( source, 5000 ) outputChatBox("#ff0000Mission failed, you have left the veh5icle.", source ,0,0,0,true) else end end addEventHandler("onPlayerWasted", root, morrer5) function completed(source) if veh5[source] and isElement(veh5[source]) then destroyElement (veh5[source]) givePlayerMoney(source,20000) cardrivepoints = 0 outputChatBox("#00ff00Mission passed. You successfully completed this task. You've received $10.000!",source,0,0,0,true) else end end addEvent ("completedMissionCollect", true) addEventHandler ("completedMissionCollect", getRootElement(), MissionWin)
  19. Olá funcionou porem um pouco diferente, agora tenho que descobrir como usar o "setElementVisibleTo" essa função só funciona no server estao estou tentando usar triggerServerEvent Porem não consigo fazer não detecta o "CreateBlipAttachedTo" que foi criado no client tem alguma dica ou idea para eu usar ?
  20. O codigo esta completo unica parte que falta e da "iniciajob5" e onde esta a GuiList, queria saber como fazer para detectar o veh5 que esta no lado serve, no lado client. Exemplo quando passo em cima do "Marker" a função não funciona devido o veh estar no lado server, exeste uma maneira de faze-lo detectar o veh ?
×
×
  • Create New...