Jump to content

Duda con god mode


El.Stark

Recommended Posts

Bueno lo que pasa es que estoy creando una zona de descanso por decirlo, es decir que cuando entro a la zona de descanso no me quiten energia desde afuera y que no me quite energia las caidas etc, tengo el script listo solo me falta la funcion de god mode o no se como se dira aqui el script:

function ZonadescansoEntrada ( thePlayer, matchingDimension ) 
if getElementType( thePlayer ) ~= "player" then return end 
outputChatBox ( "entraste a la zona de descanso", thePlayer, 177, 252, 3 ) 
toggleControl ( thePlayer, "fire", false ) 
toggleControl ( thePlayer, "next_weapon", false ) 
toggleControl ( thePlayer, "previous_weapon", false ) 
setPedWeaponSlot ( thePlayer, 0 ) 
toggleControl ( thePlayer, "aim_weapon", false ) 
toggleControl ( thePlayer, "vehicle_fire", false ) 
toggleControl ( thePlayer, "vehicle_secondary_fire", false ) 
end 
addEventHandler ( "onColShapeHit", zonadescanso, ZonadescansoEntrada ) 
  
function zonadescansoSalida ( thePlayer, matchingDimension ) 
if getElementType( thePlayer ) ~= "player" then return end 
outputChatBox ( "Te has ido de la zona de descanso", thePlayer, 255, 0, 0 ) 
toggleControl ( thePlayer, "fire", true ) 
toggleControl ( thePlayer, "next_weapon", true ) 
toggleControl ( thePlayer, "previous_weapon", true ) 
toggleControl ( thePlayer, "aim_weapon", true ) 
toggleControl ( thePlayer, "vehicle_fire", true ) 
toggleControl ( thePlayer, "vehicle_secondary_fire", true ) 
end 
  
addEventHandler ( "onColShapeLeave", zonadescanso, zonadescansoSalida ) 

Lo ideal seria que al entrar se active y al salir quede desactivado como podria hacerlo?

Nota: El script no esta funcionando ya que esta incompleto, esta la parte mas importante para asi ahorrar tiempo.

Link to comment

Puedes hacer algo asi:

client-side

--Copias tu colShape para crearlo del lado del cliente  
col = createColshape() 
addEventHandler("onClientColshapeHit", col, function() addEventHandler("onClientPlayerDamage", getLocalPlayer(), cancel) end) 
  
addEventHandler("onClientColshapeLeave", col, function() removeEventHandler("onClientPlayerDamage", getLocalPlayer(), cancel) end) 
  
function cancel () 
cancelEvent() 
end 
  

Y asi ya no se dañara el player con eso te puedes ir guiando

Link to comment

-- server side:

function ZonadescansoEntrada ( thePlayer, matchingDimension ) 
if getElementType( thePlayer ) ~= "player" then return end 
outputChatBox ( "entraste a la zona de descanso", thePlayer, 177, 252, 3 ) 
toggleControl ( thePlayer, "fire", false ) 
toggleControl ( thePlayer, "next_weapon", false ) 
toggleControl ( thePlayer, "previous_weapon", false ) 
setPedWeaponSlot ( thePlayer, 0 ) 
toggleControl ( thePlayer, "aim_weapon", false ) 
toggleControl ( thePlayer, "vehicle_fire", false ) 
toggleControl ( thePlayer, "vehicle_secondary_fire", false ) 
setElementData( thePlayer, "descansando", true) 
end 
addEventHandler ( "onColShapeHit", zonadescanso, ZonadescansoEntrada ) 
  
function zonadescansoSalida ( thePlayer, matchingDimension ) 
if getElementType( thePlayer ) ~= "player" then return end 
outputChatBox ( "Te has ido de la zona de descanso", thePlayer, 255, 0, 0 ) 
toggleControl ( thePlayer, "fire", true ) 
toggleControl ( thePlayer, "next_weapon", true ) 
toggleControl ( thePlayer, "previous_weapon", true ) 
toggleControl ( thePlayer, "aim_weapon", true ) 
toggleControl ( thePlayer, "vehicle_fire", true ) 
toggleControl ( thePlayer, "vehicle_secondary_fire", true ) 
setElementData( thePlayer, "descansando", false) 
end 
addEventHandler ( "onColShapeLeave", zonadescanso, zonadescansoSalida ) 

-- client side:

addEventHandler("onClientPlayerDamage",root, 
function () 
  if getElementData(source, "descansando") then 
        cancelEvent() 
   end 
end) 

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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