Jump to content

MoneyZone y Greenzone


Chaz-CR

Recommended Posts

Bueno esta es la situacion tengo en un mismo resource dos areas diferentes, una en la que te quedas ahi cada 5 segundos y ganas dinero (dos zonas) y tengo las greenzone de los hospitales(todos los hospitales de SA) el problema es que quiera separar estas zonas por el auto nada mas, osea que en las greenzones puedas entrar con el auto sin que desaparezca pero cuando spawneas un auto en las MoneyZones no aparezca el auto. Este es un problema... El otro es que cuando intento spawnear un vehiculo en la afk zone esta me lo elimina del panel del vehiculo que tengo puesto en otro resource! ya que en este momento tengo que cuando entres a cualquier greenzone desaparezca el auto :?

Dejare el ServerSide de este y les agradeceria que me dijeran que puedo cambiar gracias!

addEventHandler ("onResourceStart", getRootElement(),  
function() 
setTimer (moneyZoneTimerFunction, 4000, 0) 
setTimer (moneyZoneTimerFunction2,4000,0) 
  local allGreenzones = getElementsByType ("radararea") 
  for i,v in ipairs (allGreenzones) do 
    local r,g,b,a = getRadarAreaColor (v) 
    if (r == 0) and (g == 255) and (b == 0) and (a == 127) then 
      local x,y = getElementPosition (v) 
      local sx,sy = getRadarAreaSize (v) 
      local col = createColCuboid (x,y, -50, sx,sy, 7500) 
      setElementID (col, "greenzoneColshape") 
    end 
  end 
end) 
  
addEventHandler ("onColShapeHit", getRootElement(),  
function(hitElement, matchingDimension) 
  if (getElementType (hitElement) == "player") and (getElementID (source) == "greenzoneColshape") then 
    outputChatBox ("You entered the greenzone", hitElement, 255, 0, 0, false) 
    toggleControl (hitElement, "fire", false) 
    toggleControl (hitElement, "next_weapon", false) 
    toggleControl (hitElement, "previous_weapon", false) 
    toggleControl (hitElement, "sprint", false) 
    toggleControl (hitElement, "aim_weapon", false) 
    toggleControl (hitElement, "vehicle_fire", false) 
    showPlayerHudComponent (hitElement, "ammo", false) 
    showPlayerHudComponent (hitElement, "weapon", false) 
    triggerClientEvent (hitElement, "enableGodMode", hitElement) 
  end 
  if (source == moneyZoneCol) and (getElementType (hitElement) == "vehicle") then 
    setElementVelocity (hitElement, 0, 0, 0) 
    setElementPosition (hitElement, 2040.1574707031, 1343.474609375, 10.081565856934) 
    setVehicleRotation (hitElement, 0,0,180) 
    if (getVehicleOccupant (hitElement, 0)) then 
      outputChatBox ("You can't enter the moneyzone with your car!", getVehicleOccupant (hitElement, 0), 255, 0, 0, false) 
    end 
  end 
end) 
  
addEventHandler ("onColShapeLeave", getRootElement(),  
function(leaveElement, matchingDimension) 
  if (getElementType (leaveElement) == "player") and (getElementID (source) == "greenzoneColshape") then 
    outputChatBox ("You left the greenzone", leaveElement, 255, 0, 0, false) 
    toggleControl (leaveElement, "fire", true) 
    toggleControl (leaveElement, "next_weapon", true) 
    toggleControl (leaveElement, "previous_weapon", true) 
    toggleControl (leaveElement, "sprint", true) 
    toggleControl (leaveElement, "aim_weapon", true) 
    toggleControl (leaveElement, "vehicle_fire", true) 
    showPlayerHudComponent (leaveElement, "ammo", true) 
    showPlayerHudComponent (leaveElement, "weapon", true) 
    triggerClientEvent (leaveElement, "disableGodMode", leaveElement) 
  end 
end) 
  
--money zone col 
moneyZoneCol = createColCuboid (1874.13, 1322.1, 22.73, 55, 55, 55) 
--stop moneyzone col 
  
function moneyZoneTimerFunction () 
  local allPlayersInCol = getElementsWithinColShape (moneyZoneCol, "player") 
  for i,v in ipairs (allPlayersInCol) do 
    givePlayerMoney (v, 5) 
  end 
end 
  
--money zone col 
moneyZoneCol2 = createColCuboid (1209.5705566406, -1679.49, 11.79, 60, 60, 60) 
--stop moneyzone col 
  
function moneyZoneTimerFunction2 () 
  local allPlayersInCol = getElementsWithinColShape (moneyZoneCol2, "player") 
  for i,v in ipairs (allPlayersInCol) do 
    givePlayerMoney (v, 5) 
  end 
end 

Link to comment
Bueno esta es la situacion tengo en un mismo resource dos areas diferentes, una en la que te quedas ahi cada 5 segundos y ganas dinero (dos zonas) y tengo las greenzone de los hospitales(todos los hospitales de SA) el problema es que quiera separar estas zonas por el auto nada mas, osea que en las greenzones puedas entrar con el auto sin que desaparezca pero cuando spawneas un auto en las MoneyZones no aparezca el auto. Este es un problema... El otro es que cuando intento spawnear un vehiculo en la afk zone esta me lo elimina del panel del vehiculo que tengo puesto en otro resource! ya que en este momento tengo que cuando entres a cualquier greenzone desaparezca el auto :?

Dejare el ServerSide de este y les agradeceria que me dijeran que puedo cambiar gracias!

addEventHandler ("onResourceStart", getRootElement(),  
function() 
setTimer (moneyZoneTimerFunction, 4000, 0) 
setTimer (moneyZoneTimerFunction2,4000,0) 
  local allGreenzones = getElementsByType ("radararea") 
  for i,v in ipairs (allGreenzones) do 
    local r,g,b,a = getRadarAreaColor (v) 
    if (r == 0) and (g == 255) and (b == 0) and (a == 127) then 
      local x,y = getElementPosition (v) 
      local sx,sy = getRadarAreaSize (v) 
      local col = createColCuboid (x,y, -50, sx,sy, 7500) 
      setElementID (col, "greenzoneColshape") 
    end 
  end 
end) 
  
addEventHandler ("onColShapeHit", getRootElement(),  
function(hitElement, matchingDimension) 
  if (getElementType (hitElement) == "player") and (getElementID (source) == "greenzoneColshape") then 
    outputChatBox ("You entered the greenzone", hitElement, 255, 0, 0, false) 
    toggleControl (hitElement, "fire", false) 
    toggleControl (hitElement, "next_weapon", false) 
    toggleControl (hitElement, "previous_weapon", false) 
    toggleControl (hitElement, "sprint", false) 
    toggleControl (hitElement, "aim_weapon", false) 
    toggleControl (hitElement, "vehicle_fire", false) 
    showPlayerHudComponent (hitElement, "ammo", false) 
    showPlayerHudComponent (hitElement, "weapon", false) 
    triggerClientEvent (hitElement, "enableGodMode", hitElement) 
  end 
  if (source == moneyZoneCol) and (getElementType (hitElement) == "vehicle") then 
    setElementVelocity (hitElement, 0, 0, 0) 
    setElementPosition (hitElement, 2040.1574707031, 1343.474609375, 10.081565856934) 
    setVehicleRotation (hitElement, 0,0,180) 
    if (getVehicleOccupant (hitElement, 0)) then 
      outputChatBox ("You can't enter the moneyzone with your car!", getVehicleOccupant (hitElement, 0), 255, 0, 0, false) 
    end 
  end 
end) 
  
addEventHandler ("onColShapeLeave", getRootElement(),  
function(leaveElement, matchingDimension) 
  if (getElementType (leaveElement) == "player") and (getElementID (source) == "greenzoneColshape") then 
    outputChatBox ("You left the greenzone", leaveElement, 255, 0, 0, false) 
    toggleControl (leaveElement, "fire", true) 
    toggleControl (leaveElement, "next_weapon", true) 
    toggleControl (leaveElement, "previous_weapon", true) 
    toggleControl (leaveElement, "sprint", true) 
    toggleControl (leaveElement, "aim_weapon", true) 
    toggleControl (leaveElement, "vehicle_fire", true) 
    showPlayerHudComponent (leaveElement, "ammo", true) 
    showPlayerHudComponent (leaveElement, "weapon", true) 
    triggerClientEvent (leaveElement, "disableGodMode", leaveElement) 
  end 
end) 
  
--money zone col 
moneyZoneCol = createColCuboid (1874.13, 1322.1, 22.73, 55, 55, 55) 
--stop moneyzone col 
  
function moneyZoneTimerFunction () 
  local allPlayersInCol = getElementsWithinColShape (moneyZoneCol, "player") 
  for i,v in ipairs (allPlayersInCol) do 
    givePlayerMoney (v, 5) 
  end 
end 
  
--money zone col 
moneyZoneCol2 = createColCuboid (1209.5705566406, -1679.49, 11.79, 60, 60, 60) 
--stop moneyzone col 
  
function moneyZoneTimerFunction2 () 
  local allPlayersInCol = getElementsWithinColShape (moneyZoneCol2, "player") 
  for i,v in ipairs (allPlayersInCol) do 
    givePlayerMoney (v, 5) 
  end 
end 

if (source == moneyZoneCol) and (getElementType (hitElement) == "vehicle") then 
    setElementVelocity (hitElement, 0, 0, 0) 
    setElementPosition (hitElement, 2040.1574707031, 1343.474609375, 10.081565856934) 
    setVehicleRotation (hitElement, 0,0,180) 
    if (getVehicleOccupant (hitElement, 0)) then 
      outputChatBox ("You can't enter the moneyzone with your car!", getVehicleOccupant (hitElement, 0), 255, 0, 0, false) 

esta es la parte que destruye el vehiculo

Link to comment

el problema es que al spawnear un auto dentro de ahi se me destruye y desaparece del panel de vehiculos que tengo (Por venta de vehiculos) como hago para cuando lo trates de spawnear adentro salga fuera de ese lugar introduciendo esa coordenada! Asi no se destruye y no desaparecerá! :S

Link to comment
el problema es que al spawnear un auto dentro de ahi se me destruye y desaparece del panel de vehiculos que tengo (Por venta de vehiculos) como hago para cuando lo trates de spawnear adentro salga fuera de ese lugar introduciendo esa coordenada! Asi no se destruye y no desaparecerá! :S

Osea quieres que al comprar un auto en esa zona salga de la zona afk?

PD:Es mejor que quites la parte que yo postie asi no se destruira el auto

Link to comment
  • Recently Browsing   0 members

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