Jump to content

[Ajuda] Safezone


Recommended Posts

Posted

Galera, eu to achando que essa parte que verifica se o player é ped (zombie) e mata ele, está matando até mesmo os que não estão aqui dentro, to postando aqui só para ter certeza mesmo, pois não faz muito sentido só que eu percebo que os zombies não nascem mais em nenhum outro lugar

  
safearea = createColSphere(  -2337.722, -1666.026733, 483.50674438, 400 ) 
  
function savezoneenter( thePlayer, matchingDimension ) 
    if(getElementType(thePlayer) == "ped") then 
        killPed( thePlayer ) 
    end 
    if getElementType( thePlayer ) == "player" then 
        toggleControl ( thePlayer, "fire", false ) 
        toggleControl ( thePlayer, "next_weapon", true ) 
        toggleControl ( thePlayer, "previous_weapon", true ) 
        setPedWeaponSlot ( thePlayer, 0 ) 
        toggleControl ( thePlayer, "aim_weapon", false ) 
        toggleControl ( thePlayer, "vehicle_fire", false ) 
        toggleControl ( thePlayer, "vehicle_secondary_fire", false ) 
        end 
end 
addEventHandler ( "onColShapeHit", safearea, savezoneenter ) 
  

Posted

Não testei, apenas tente isso !

Se der certo me avise !

safearea = createColSphere(  -2337.722, -1666.026733, 483.50674438, 400 ) 
  
function savezoneenter( thePlayer, matchingDimension ) 
    if(getElementType(thePlayer) == "ped") then 
       if (isElementWithinColShape(thePlayer , safearea )) then 
        killPed( thePlayer ) 
         end 
    end 
    if getElementType( thePlayer ) == "player" then 
        toggleControl ( thePlayer, "fire", false ) 
        toggleControl ( thePlayer, "next_weapon", true ) 
        toggleControl ( thePlayer, "previous_weapon", true ) 
        setPedWeaponSlot ( thePlayer, 0 ) 
        toggleControl ( thePlayer, "aim_weapon", false ) 
        toggleControl ( thePlayer, "vehicle_fire", false ) 
        toggleControl ( thePlayer, "vehicle_secondary_fire", false ) 
        end 
end 
addEventHandler ( "onColShapeHit", safearea, savezoneenter ) 

Posted

Não deu certo! Os zombies que estão fora continuam não nascendo..

Eu criei um comando que spawna bot e os que estão dentro realmente estão morrendo, porem os de fora não nascem mais.. :/

Posted

Demorei para fazer pq eu não sabia

testa isso aqui...

mude o final do createRadarArea para que a area nao fique visivel caso voce queira!

  
VerArea = createRadarArea(-159.143, 980.239,50, 50, 0, 255, 0, 100)  --Esta em LV  
safearea = createColSphere( -159.143, 980.239, 50, 50 ) 
  
function SafeZone() 
       for _,v in ipairs (getElementsByType("ped")) do 
        if (isElementWithinColShape(v , safearea )) then 
        killPed(v)   
        end 
        end 
        for _,v in ipairs (getElementsByType("player")) do 
        if (isElementWithinColShape(v , safearea )) then 
        setPedWeaponSlot ( v, 0 ) 
        toggleControl ( v, "next_weapon", true ) 
        toggleControl ( v, "previous_weapon", true ) 
        toggleControl ( v, "fire", false ) 
        toggleControl ( v, "aim_weapon", false ) 
        toggleControl ( v, "vehicle_fire", false ) 
        toggleControl ( v, "vehicle_secondary_fire", false ) 
        else 
        toggleControl ( v, "fire", true ) 
        toggleControl ( v, "aim_weapon", true ) 
        toggleControl ( v, "vehicle_fire", true ) 
        toggleControl ( v, "vehicle_secondary_fire", true )  
       end 
   end 
end 
setTimer(SafeZone, 50, 0 ) 

  • 2 weeks later...
Posted

Ainda não deu :/

Por algum motivo quando o player sai desse colShape não nasce mais zombies perto dele.

Já tentei usar o seu codigo de umas 10 formas diferentes, fiz funcão chamando onColShapeLeave, usei simplesmente o seu codigo sem mais nada junto, fiz de tudo!

Ainda estou precisando dessa resource, se alguem souber o que pode estar faltando. Obrigado.

Posted

Testei o primeiro código que você passou e ele está funcionando, só mata peds dentro do colshape, tem certeza que é esse script que não deixa eles nascerem em outro lugar ?

Posted

É que enquanto estou fora dessa colShape os zombies nascem de boa perto de mim, após entrar na colShape eles param de nascer e o problema vem ao sair dela novamente porque eles não nascem mais (mesmo fora) e nem se matando arruma, só relogando. Fiz um teste e tentei setar eles como Frozen

setPedFrozen ( thePlayer, true )  

Ao invés de mata-los, mas tanto dentro quanto fora eles não ficaram freezados.

Posted

Como eu já disse não é esse script que faz isso, Provavelmente outro que use o evento onColShapeHit e bloqueie o spawn de zumbis

  • 3 weeks later...
Posted

é outro script que esta interferindo nesse ai, eu fiz e testei esta tudo correto.

talvez o outro script que esta interferindo no seu nao tenha isso if (isElementWithinColShape(source, Nome da area aqui )) then

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...