Jump to content

[Solved] Help with greenzone godmode


Erknneto

Recommended Posts

Hey, sup guys... I need some help with my greenzone godmode system, I created everythink, it's a base protector, but I need a godmode for cars inside the base, I tried, but I can't. Can someone help me?

-Just add a godmode for the vehicle if it's inside of the base (colshape)

-And add a setting like (godmodeveh = true or false) if you can

Server

-- // Settings \\ -- 
shadyisback = createColCuboid(353.8819, 2450.4045, 14.984375, 25.5, 28, 10) --Base location (colshape) 
local x,y,z = 363.466796875,2495.1606445313,16.484375 --Player teleport location 
local xc,yc,zc = 325.2177734375,2527.9711914063,25.934555053711 --Car teleport location 
  
local groupName = "SkyBreaker" -- Group name 
local reason = "Você entrou na Área da Base do grupo "..groupName.."." --Kick message 
  
kickarplayer = false -- Enable player kick if he got a vehicle (True or False) // Default: False // 
-- // Settings \\ -- 
  
function shadyisbackEnter ( thePlayer, matchingDimension ) 
if getElementType( thePlayer ) ~= "player" then return end 
local gangName = getElementData(thePlayer, "gang") 
  
if isPedInVehicle(thePlayer) then --If the invader try to enter with a vehicle 
    if gangName ~= groupName then 
    local vehcara = getPedOccupiedVehicle(thePlayer) 
        if kickarplayer == true then 
            kickPlayer(thePlayer, reason) --Kick the player if 'kickarplayer' = true 
            setElementPosition(vehcara, xc,yc,zc) --Set the vehicle position to a safe place 
        elseif kickarplayer == false then 
            setElementPosition(vehcara, xc,yc,zc) --Set the vehicle position to a safe place 
        end 
    end 
end 
  
if gangName == groupName then --Player enter successfully 
     
else 
    setElementPosition(thePlayer, x,y,z) --Set player position to a safe location 
    outputChatBox("Você não é membro do grupo "..groupName.." para entrar nessa base.", thePlayer) --Message on the player's chat 
end 
end 
addEventHandler ( "onColShapeHit", shadyisback, shadyisbackEnter ) 

Edited by Guest
Link to comment
Use getPedOccupiedVehicle with setVehicleDamageProof and when the player leaves the area (onColShapeLeave) you use setVehicleDamageProof again...

Thanks man, it works :D. But, if I'm out of the vehicle and drag the vehicle outside of the colshape the vehicle will stay with godmode, and if I drag the vehicle inside, the vehicle doesn't will get godmode! But it works anyway, but you know a way to solve this problem?

Link to comment
Thanks man, it works :D. But, if I'm out of the vehicle and drag the vehicle outside of the colshape the vehicle will stay with godmode, and if I drag the vehicle inside, the vehicle doesn't will get godmode! But it works anyway, but you know a way to solve this problem?

The 'problem' is caused when you check if the element who is entering the area is different than a player (in line 13) just make other check (elseif) to know if it is a vehicle.

Link to comment
Thanks man, it works :D. But, if I'm out of the vehicle and drag the vehicle outside of the colshape the vehicle will stay with godmode, and if I drag the vehicle inside, the vehicle doesn't will get godmode! But it works anyway, but you know a way to solve this problem?

The 'problem' is caused when you check if the element who is entering the area is different than a player (in line 13) just make other check (elseif) to know if it is a vehicle.

It works! Thanks dude.

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