Jump to content

kevincouto6

Members
  • Posts

    235
  • Joined

  • Last visited

Everything posted by kevincouto6

  1. Could you help me with handlerRespawn? in debugscript no error appears, And the respawn function after death is not working ?Can you tell me what to do? local ped = {} local peds = { {-2374.55151, -595.38910, 132.11719}, {-2376.55908, -596.57813, 132.11719}, {-2376.33325, -591.77344, 132.11171}, } function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end local pedsParent = createElement("pedsParent") local id = {} -- do not edit this table for i=1,#peds do ped[i] = createPed(math.random(26,41),peds[i][1],peds[i][2],peds[i][3]) function spawnPed( peds,index) ped[i] = createPed(math.random(26,41),peds[i][1],peds[i][2],peds[i][3]) setElementParent(ped[i], pedsParent) id[ped[i]] = index end function handleRespawn() local index = id[source] if index then id[source] = nil local peds = peds[index] if peds then setTimer(destroyElement, 1000, 1, source) setTimer(spawnPed, 1500, 1, peds, index) end end end addEventHandler("onPedWasted", pedsParent, handleRespawn) function rotationpedd () local x1 ,y1, z = getElementPosition(ped[i]) local x2, y2, sz = getElementPosition(localPlayer) setPedAimTarget(ped[i], x2, y2, sz) setPedRotation(ped[i], findRotation( x1, y1, x2, y2 )) end addEventHandler("onClientRender", root, rotationpedd) function atirar () givePedWeapon(ped[i], 31, 500, true) setPedControlState(ped[i], "fire", true) end addEventHandler("onClientPedDamage", root, atirar) addEvent ("pedAtira", true) addEventHandler ("pedAtira", getRootElement(), atirar) function stopatirar () givePedWeapon(ped[i], 31, 500, false) setPedControlState(ped[i], "fire", false) end addEvent ("stopPedatira", true) addEventHandler ("stopPedatira", getRootElement(), stopatirar) end
  2. I wanted your help because the ped is not getting the getElementPosition of all ped, and the "setPedAimTarget" is not completely working because no errors appear Client-side local ped = {} local peds = { {-2374.55151, -595.38910, 132.11719}, {-2376.55908, -596.57813, 132.11719}, {-2376.33325, -591.77344, 132.11171}, } for i=1,#peds do ped[i] = createPed(math.random(26,41),peds[i][1],peds[i][2],peds[i][3]) end function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end function rotationpedd () local x1 ,y1, z = getElementPosition(peds[i]) local x2, y2, sz = getElementPosition(getLocalPlayer()) setPedAimTarget(ped[i], x2, y2, sz) setPedRotation(ped[i], findRotation( x1, y1, x2, y2 )) end addEventHandler("onClientRender", root, rotationpedd) function atirar () givePedWeapon(ped[i], 31, 500, true) setPedControlState(ped[i], "fire", true) end addEventHandler("onClientPedDamage", root, atirar) addEvent ("pedAtira", true) addEventHandler ("pedAtira", getRootElement(), atirar) function stopatirar () givePedWeapon(ped[i], 31, 500, false) setPedControlState(ped[i], "fire", false) end addEvent ("stopPedatira", true) addEventHandler ("stopPedatira", getRootElement(), stopatirar) ERROR: pedAtack/client.lua:12: attempt to peform arithmetic on local 'x1' (a boolean value) code server local zonaShot = createColRectangle ( -2400.04248, -620.97205, 50, 50 ) local radarShot = createRadarArea ( -2400.04248, -620.97205, 50, 50, 0, 255, 0, 175 ) function enterZone ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then triggerClientEvent (thePlayer, "pedAtira", thePlayer) end end addEventHandler ( "onColShapeHit", zonaShot, enterZone ) function sairZone ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then triggerClientEvent (thePlayer, "stopPedatira", thePlayer) end end addEventHandler ( "onColShapeLeave", zonaShot, sairZone )
  3. N esta funcionando, devido a não checagem da posição do ped, acredito que o erro seja na checagem de varios peds juntas se fosse apenas um funciona mas como tem mais de um ñ esta funcionando
  4. function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end function peds () local x1 ,y1, z = getElementPosition(ped[ i ]) local x2, y2, sz = getElementPosition(localPlayer) setPedAimTarget(ped[ i ], x2, y2, sz) setPedRotation(ped[ i ], findRotation( x1, y1, x2, y2 )) end addEventHandler("onClientRender", root, peds) Nesta função esta tendo um erro " local x1 ,y1, z = getElementPosition(ped[ i ]) " attlemp to index local 'data'( a nill value) "
  5. Desculpe por postar outro tropico, mas consegui usar as funções, porem agora tenho outro problema, eu criei a tabela com os PED porem não se as funções aplicam-se apenas no primeiro PED e não em todos client-side --client-side local ped = {} local peds = { {-2374.55151, -595.38910, 132.11719}, {-2376.55908, -596.57813, 132.11719}, {-2376.33325, -591.77344, 132.11171}, } for i=1,#peds do thePed = createPed(math.random(26,41),peds[i][1],peds[i][2],peds[i][3] +0.5, 269) end function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end function ped () local x1 ,y1, z = getElementPosition(thePed) local x2, y2, sz = getElementPosition(localPlayer) setPedAimTarget(thePed, x2, y2, sz) setPedRotation(thePed, findRotation( x1, y1, x2, y2 )) end addEventHandler("onClientRender", root, ped) function atirar () givePedWeapon(thePed, 31, 500, true) setPedControlState(thePed, "fire", true) end addEventHandler("onClientPedDamage", root, atirar) addEvent ("pedAtira", true) addEventHandler ("pedAtira", getRootElement(), atirar) function stopatirar () givePedWeapon(thePed, 31, 500, false) setPedControlState(thePed, "fire", false) end addEvent ("stopPedatira", true) addEventHandler ("stopPedatira", getRootElement(), stopatirar) server-side local zonaShot = createColRectangle ( -2400.04248, -620.97205, 25, 25 ) local radarShot = createRadarArea ( -2400.04248, -620.97205, 25, 25, 0, 255, 0, 175 ) --server-side function enterZone ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then triggerClientEvent (thePlayer, "pedAtira", thePlayer) end end addEventHandler ( "onColShapeHit", zonaShot, enterZone ) function sairZone ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then triggerClientEvent (thePlayer, "stopPedatira", thePlayer) end end addEventHandler ( "onColShapeLeave", zonaShot, sairZone )
  6. could you help me with the script I'm not very good at scripting I'm learning
  7. Hello, I would like to tell you some other tip, I think it is not working because I am specifying only the location of the player, but if I use the location of the ped of "a nill value", and the same thing is happening with just the location player thePed = createPed(104, -2406.92749, -593.24597, 132.64844) function onPedRender() local x ,y, z = getElementPosition(thePed) local sx, sy, sz = getElementPosition(localPlayer) local Dist = getDistanceBetweenPoints3D (x, y, z, sx, sy, sz) givePedWeapon(thePed, 31, 5000, true) setElementFrozen( thePed, true) setPedControlState(thePed, "fire", true) setPedAimTarget(thePed, sx, sy, sz) setPedRotation(thePed, findRotation(x , y)) end addEventHandler("onClientRender", root, onPedRender) addEventHandler("onClientPedDamage", root, onPedRender) Line 11 error " a nill value"
  8. client-side Olá teria como me dizer alguma outra dica, eu acho que não esta funcionando porque estou especificando apenas a localização do player, porem se eu usar a localização do ped ele da "a nill value", e a mesma coisa esta acontecendo com apenas a local do player function onPedRender() local ped = getElementsByType ( "ped" ) for theKey, thePed in ipairs(ped) do if getElementData(thePed, "shoot") then cancelEvent() local x ,y, z = getElementPosition(thePed) local sx, sy, sz = getElementPosition(localPlayer) local Dist = getDistanceBetweenPoints3D (x, y, z, sx, sy, sz) givePedWeapon(thePed, 31, 5000, true) setPedControlState(thePed, "fire", true) setPedAimTarget(thePed, sx, sy, sz) setPedRotation(player, findRotation(x , y)) end end end addEventHandler("onClientRender", root, onPedRender) addEventHandler("onClientPedDamage", root, onPedRender)
  9. Poderia me ajudar, Não estou conseguindo aplicar a função findRotation no script client-side local x1, y1 = getElementPosition( getLocalPlayer()) local x2, y2 = getElementPosition( ped ) function playerlocal () local x, y, z = getElementPosition( getLocalPlayer()) end addEventHandler ( "onClientRender", root, playerlocal ) function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end function ped1 () ped = createPed(104, -2406.92749, -593.24597, 132.64844) givePedWeapon( ped, 31, 5000, true) setElementFrozen( ped, true) setControlState( ped, "fire", true) setPedRotation ( ped, findRotation ) setPedAimTarget ( ped, playerlocal ) end addCommandHandler("ped",ped1 )
  10. desculpem outro post não consegui editar par givePlayerMoney eu fiz assim Sever-side function MissionWin () givePlayerMoney(client, 30000) end addEvent ("trueMission", true) addEventHandler ("trueMission", getRootElement(), MissionWin) client-side function ZedMissionWin () zombiesKilled = 0 outputChatBox( "Good job, mission completed!" ) triggerServerEvent ("trueMission", localPlayer) removeEventHandler("onClientPedWasted",getRootElement(),ZedMissionCheckKill) removeEventHandler ( "onClientRender",getRootElement(), createText ) end Queria saber se esta correto, no meus testes funcionaram, queria sabe opinião se esta correto ?
  11. Muito obrigado consegui resolver faltou especificar "client" no triggerClientEvent
  12. O script é client, o que vc me mandou no outro tópico eu peguei e usei para outra missão, agora preciso dessa para para matar os zombies que spanw no gamemode de zombies
  13. Alguem poderia me dar algum exemplo não estou conseguindo faze-lo, ea função findRotation e para server-side isso sig que vou ter que usar triggerServerEvent ?
  14. Funcionou corretamente, porem a função givePlayerMoney ( 50000 ) Não estão funcionando eles estão ficando visiveis para todos os player online function createText () dxDrawText("Killed Zombies "..(zombiesKilled).."/300", 348, 4, 582, 30, tocolor(255, 255, 255, 255), 0.50, "bankgothic", "left", "top" ) end
  15. yeah porem ele mira apenas no lugar que foi usado o commando, a mira não move acompanhando o player, eu modifiquei um pouco mais ainda n funciona --Client-siide function cmdArmedPed( command, thePlayer ) local x, y, z = getElementPosition(localPlayer) -- Get your position local thePed = createPed(12,-712.21143, 942.30859, 12.34728, 0, 0, 90) -- Create a CJ ped nearby givePedWeapon(thePed, 31, 5000, true) -- Give him 5000 rounds of M4 setControlState(thePed, "fire", true) -- Make him shoot continuously setPedAimTarget ( thePed, x, y, z ) setPedCameraRotation ( thePlayer, x, y, z ) end addEventHandler ( "onColShapeHit", createcol, cmdArmedPed ) function createcol () triggerServerEvent ( "mission", resourceRoot ) end server-side function areas () local hillArea = createColRectangle ( -715.63965, 989.01202, 155, 155 ) local hillRadar = createRadarArea ( -715.63965, 989.01202, 155, -155, 0, 255, 0, 175 ) end addEvent( "mission", true ) addEventHandler( "mission", resourceRoot, greetingHandler )
  16. --Client-siide function cmdArmedPed( command, thePlayer ) local x, y, z = getElementPosition(localPlayer) -- Get your position local thePed = createPed(12,-712.21143, 942.30859, 12.34728, 0, 0, 90) -- Create a CJ ped nearby givePedWeapon(thePed, 31, 5000, true) -- Give him 5000 rounds of M4 setControlState(thePed, "fire", true) -- Make him shoot continuously setPedAimTarget ( thePed, x, y, z ) setPedCameraRotation ( thePlayer, x, y, z ) end addCommandHandler("armedped", cmdArmedPed) Poderiam me ajudar, bom quero que os PED atire nos player que invadir a zona, porem o ped n pode caminhar, mas queria movesse junto com a arma para atirar ou seja que ele tivese rotação, podem me ajudar com isso ? --serve-side local hillArea = createColRectangle ( -715.63965, 989.01202, 15, 15 ) local hillRadar = createRadarArea ( -715.63965, 989.01202, 40, -40, 0, 255, 0, 175 )
  17. Desculpe, o script e o primeiro que postei porem ele esta ativando para todos jogadores o script e apenas este abaixo, nele estão as funções da missão e apenas Client o script, porem a missão ativa para todos jogadores, eu queria que se ativa-se apenas para o jogador que querese fazer
  18. Porem ainda a missão esta aparecendo para todos, queria deixar uma missão individual
  19. Server-side --mission 3-- function mission3 () triggerClientEvent ("mission", source) end addEvent ("mission", true) -- Cria o evento "iniciaJob e permite que ele seja chamado pelo client. addEventHandler ("mission", getRootElement(), mission3) -- Executa essa função quando o evento "iniciaJob" for chamado. Client-side addEventHandler ("onClientGUIClick", getRootElement(), function (button, state, absoluteX, absoluteY) local me = not guiGetVisible (windowMission) if (source == ExitButton) then guiSetVisible (windowMission, me) showCursor (me) elseif (source == FistButton) then triggerServerEvent ("iniciaJob", localPlayer) -- Inicia o evento "iniciarJob" que estiver no script server. E manda o localPlayer como elemento ativador. guiSetVisible(windowMission, false) showCursor( false ) elseif (source == SecondButton) then triggerServerEvent ("iniciaJob2", localPlayer) -- Inicia o evento "iniciarJob" que estiver no script server. E manda o localPlayer como elemento ativador. guiSetVisible(windowMission, false) showCursor( false ) elseif (source == ThirdButton ) then triggerServerEvent ("mission", localPlayer) -- Inicia o evento "iniciarJob" que estiver no script server. E manda o localPlayer como elemento ativador. guiSetVisible(windowMission, false) showCursor( false ) elseif (source == FourthButton ) then triggerServerEvent ("iniciaJob4", localPlayer) -- Inicia o evento "iniciarJob" que estiver no script server. E manda o localPlayer como elemento ativador. guiSetVisible(windowMission, false) showCursor( false ) end end) outro Client com a missão zombiesKilled = 0 function ZedMissionWin (thePlayer) zombiesKilled = 0 outputChatBox( "Good job, mission completed!" ) givePlayerMoney ( 50000 ) removeEventHandler("onClientPedWasted",getRootElement(),ZedMissionCheckKill) removeEventHandler ( "onClientRender",getRootElement(), createText ) end function ZedMissionCheckKill ( thePlayer ) if ( thePlayer and getElementType(thePlayer) == "player" and getElementType(source) == "ped" ) then zombiesKilled = zombiesKilled+1 end if zombiesKilled >= 300 then ZedMissionWin () end end function createText (thePlayer) dxDrawText("Killed Zombies "..(zombiesKilled).."/300", 348, 4, 582, 30, tocolor(255, 255, 255, 255), 0.50, "bankgothic", "left", "top" ) end function startZedMission (thePlayer) outputChatBox ( "Your Get Mission" ) addEventHandler ( "onClientPedWasted", getRootElement(), ZedMissionCheckKill ) addEventHandler ( "onClientRender", getRootElement(), createText ) end addEvent ("mission", true) addEventHandler ("mission", getRootElement(), startZedMission)
  20. Estou com esta missão, porem ele esta para todos jogadores completarem juntos, mas quero que seja individual, que cada jogador possa faze-la sozinho tentei de algumas formas mas acontecerem alguns erros, alguem pode ajudar zombiesKilled = 0 function ZedMissionWin (thePlayer) zombiesKilled = 0 outputChatBox( "Good job, mission completed!" ) givePlayerMoney ( 50000 ) removeEventHandler("onClientPedWasted",getRootElement(),ZedMissionCheckKill) removeEventHandler ( "onClientRender",getRootElement(), createText ) end function ZedMissionCheckKill ( thePlayer ) if ( thePlayer and getElementType(thePlayer) == "player" and getElementType(source) == "ped" ) then zombiesKilled = zombiesKilled+1 end if zombiesKilled >= 300 then ZedMissionWin () end end function createText (thePlayer) dxDrawText("Killed Zombies "..(zombiesKilled).."/300", 348, 4, 582, 30, tocolor(255, 255, 255, 255), 0.50, "bankgothic", "left", "top" ) end function startZedMission (thePlayer) outputChatBox ( "Your Get Mission" ) addEventHandler ( "onClientPedWasted", getRootElement(), ZedMissionCheckKill ) addEventHandler ( "onClientRender", getRootElement(), createText ) end addEvent ("mission", true) addEventHandler ("mission", getRootElement(), startZedMission)
  21. Muito Obrigado mais uma vez
×
×
  • Create New...