Jump to content

[HELP PLEASE] GODMOD


SpoC^

Recommended Posts

Hi friends, I created this function when the player puts your vehicle in the protected area, is indestructible, but when the player pushes the vehicle out of the protected area without being inside it, remains indestructible ... I do not want it

Please help, and complete the function :|

Server.lua

  
-- CRIATE BY *SpoC^ for TWD -- 
  
local PraiaProtegidax = createMarker (191, -1797, 4, "cylinder", 25, 255,0,0,0) 
  
function Protect1 (source) 
local carro = getPedOccupiedVehicle (source) 
outputChatBox ('#00bfff* Entrou na Área de Proteção: #ffffffSeu veículo ficou indestrutível!',source,255,255,255,true) 
setVehicleDamageProof (carro,true) 
toggleControl (source, "fire", true) 
toggleControl (source, "aim_weapon", true) 
triggerClientEvent (source, "enableGodMode",source) 
end 
addEventHandler ("onMarkerHit", PraiaProtegidax, Protect1) 
  
function Protect21 (source) 
local carro = getPedOccupiedVehicle (source) 
outputChatBox ('#00bfff* Saiu da Área de Proteção: #ffffffSeu veículo não esta mais indestrutível!',source,255,255,255,true) 
setVehicleDamageProof (carro,false) 
toggleControl (source, "fire", true) 
toggleControl (source, "aim_weapon", true) 
triggerClientEvent (source, "disableGodMode",source) 
setTimer (triggerClientEvent, 1000, 3, source, "disableGodMode", source) 
end 
addEventHandler ("onMarkerLeave", PraiaProtegidax, Protect21) 
  

Edited by Guest
Link to comment

try this

  
-- CRIATE BY *SpoC^ for TWD -- 
  
local PraiaProtegidax = createMarker (191, -1797, 4, "cylinder", 25, 255,0,0,0) 
  
function Protect1 (source, theVehicle) 
local carro = getPedOccupiedVehicle (source) 
outputChatBox ('#00bfff* Entrou na Área de Proteção: #ffffffSeu veículo ficou indestrutível!',source,255,255,255,true) 
setVehicleDamageProof (theVehicle, true) 
toggleControl (source, "fire", true) 
toggleControl (source, "aim_weapon", true) 
triggerClientEvent (source, "enableGodMode",source) 
end 
addEventHandler ("onMarkerHit", PraiaProtegidax, Protect1) 
  
function Protect21 (source, theVehicle) 
local carro = getPedOccupiedVehicle (source) 
outputChatBox ('#00bfff* Saiu da Área de Proteção: #ffffffSeu veículo não esta mais indestrutível!',source,255,255,255,true) 
setVehicleDamageProof (theVehicle, false) 
toggleControl (source, "fire", true) 
toggleControl (source, "aim_weapon", true) 
triggerClientEvent (source, "disableGodMode",source) 
setTimer (triggerClientEvent, 1000, 3, source, "disableGodMode", source) 
end 
addEventHandler ("onMarkerLeave", PraiaProtegidax, Protect21) 
   

Link to comment

"#RooTs"

Worked protection, but when push the vehicle out of the area without being inside the vehicle, remains shielded ... only removes protection while I'm at it ... I just want to protect the vehicle being within the marker, and unprotect if outside the marker without being occupying the vehicle

Edited by Guest
Link to comment

Here is the solution:

Only one file by server-side

  
-- CRIATE BY *SpoC^ for TWD -- 
  
local PraiaProtegidax = createMarker (191, -1797, 4, "cylinder", 25, 255,0,0,0) 
  
function Protect1(source,dimens) 
    local veh = getPedOccupiedVehicle(source) 
    outputChatBox('#00bfff* Entrou na Área de Proteção: #ffffffSeu veículo ficou indestrutível!',source,255,255,255,true) 
    setElementData(veh,"godmode",true) 
    toggleControl(source,"fire",true) 
    toggleControl(source,"aim_weapon",true) 
end 
addEventHandler("onMarkerHit",PraiaProtegidax,Protect1) 
  
function godmodeveh() 
godvar = getElementData(source,"godmode") 
if godvar and godvar == true then 
    setVehicleDamageProof(source,true) 
    setElementHealth(source,1000) 
    cancelEvent() 
end 
end 
addEventHandler("onPlayerDamage",getRootElement(),godmodeveh) 
  
function Protect21(source,dimens) 
    local veh = getPedOccupiedVehicle(source) 
    outputChatBox ('#00bfff* Saiu da Área de Proteção: #ffffffSeu veículo não esta mais indestrutível!',source,255,255,255,true) 
    setVehicleDamageProof (veh,false) 
    setElementData(veh,"godmode",false) 
    toggleControl(source, "fire", true) 
    toggleControl(source, "aim_weapon", true) 
end 
addEventHandler("onMarkerLeave",PraiaProtegidax,Protect21) 
  

Link to comment

Try it(now with colshape):

  
-- CRIATE BY *SpoC^ for TWD -- 
  
local PraiaProtegidax = createColCuboid(163.32458, -1840.56104, 2, 55, 65, 60)  
  
function Protect1(source,dimens) 
if getElementType(source) == "vehicle" then 
setElementData(source,"godmode",true) 
else 
    outputChatBox('#00bfff* Entrou na Área de Proteção: #ffffffSeu veículo ficou indestrutível!',source,255,255,255,true) 
    toggleControl(source,"fire",true) 
    toggleControl(source,"aim_weapon",true) 
end 
end 
addEventHandler("onColShapeHit",PraiaProtegidax,Protect1) 
  
function godmodeveh() 
godvar = getElementData(source,"godmode") 
if godvar then 
    setVehicleDamageProof(source,true) 
    setElementHealth(source,1000) 
    cancelEvent() 
end 
end 
addEventHandler("onPlayerDamage",getRootElement(),godmodeveh) 
  
function Protect21(source,dimens) 
if getElementType(source) == "vehicle" then 
    setVehicleDamageProof(source,false) 
    setElementData(source,"godmode",false) 
else 
    outputChatBox ('#00bfff* Saiu da Área de Proteção: #ffffffSeu veículo não esta mais indestrutível!',source,255,255,255,true) 
    toggleControl(source, "fire", true) 
    toggleControl(source, "aim_weapon", true) 
end 
end 
addEventHandler("onColShapeLeave",PraiaProtegidax,Protect21) 
  

Link to comment
Here is the solution:

Only one file by server-side

  
-- CRIATE BY *SpoC^ for TWD -- 
  
local PraiaProtegidax = createMarker (191, -1797, 4, "cylinder", 25, 255,0,0,0) 
  
function Protect1(source,dimens) 
    local veh = getPedOccupiedVehicle(source) 
    outputChatBox('#00bfff* Entrou na Área de Proteção: #ffffffSeu veículo ficou indestrutível!',source,255,255,255,true) 
    setElementData(veh,"godmode",true) 
    toggleControl(source,"fire",true) 
    toggleControl(source,"aim_weapon",true) 
end 
addEventHandler("onMarkerHit",PraiaProtegidax,Protect1) 
  
function godmodeveh() 
godvar = getElementData(source,"godmode") 
if godvar and godvar == true then 
    setVehicleDamageProof(source,true) 
    setElementHealth(source,1000) 
    cancelEvent() 
end 
end 
addEventHandler("onPlayerDamage",getRootElement(),godmodeveh) 
  
function Protect21(source,dimens) 
    local veh = getPedOccupiedVehicle(source) 
    outputChatBox ('#00bfff* Saiu da Área de Proteção: #ffffffSeu veículo não esta mais indestrutível!',source,255,255,255,true) 
    setVehicleDamageProof (veh,false) 
    setElementData(veh,"godmode",false) 
    toggleControl(source, "fire", true) 
    toggleControl(source, "aim_weapon", true) 
end 
addEventHandler("onMarkerLeave",PraiaProtegidax,Protect21) 
  

Neves768 no work :|

Instaid of saying no work, give us the problem that happens..

Link to comment
  
-- CRIATE BY *SpoC^ for TWD -- 
  
local PraiaProtegidax = createMarker (191, -1797, 4, "cylinder", 25, 255,0,0,0) 
  
function Protect1(element,dimens) 
    if getElementType(element) == "vehicle" then 
    setVehicleDamageProof(element,true) 
    elseif getElementType(element) == "player" then 
    outputChatBox('#00bfff* Entrou na Área de Proteção: #ffffffSeu veículo ficou indestrutível!',element,255,255,255,true) 
    toggleControl(element,"fire",true) 
    toggleControl(element,"aim_weapon",true) 
    end 
end 
addEventHandler("onMarkerHit",PraiaProtegidax,Protect1) 
  
function Protect21(element,dimens) 
    if getElementType(element) == "vehicle" then 
    setVehicleDamageProof (element,false) 
    elseif getElementType(element) == "player" then 
    outputChatBox ('#00bfff* Saiu da Área de Proteção: #ffffffSeu veículo não esta mais indestrutível!',element,255,255,255,true) 
    toggleControl(element,"fire",true) 
    toggleControl(element,"aim_weapon",true) 
    end 
end 
addEventHandler("onMarkerLeave",PraiaProtegidax,Protect21) 

Link to comment

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...