Jump to content

Antidamage greenzone


DRW

Recommended Posts

Posted

Hello, I want to disable damage dealing only to players if they are in a colshape.

I mean, if a player shoots me he won't deal any damage, but if a zombie attacks me, then he will deal damage to me, it's not working.

Client-sided

colRec = createColRectangle (-1203.599609375, 2814.75, 500,500) 
colRad = createRadarArea (-782.689453125, 656.4794921875, 1700,2200,0,0,0,100) 
  
addEventHandler ("onClientPlayerDamage",localPlayer,  
function (attacker) 
if isElementWithinColShape (localPlayer, colRec) and getElementData (attacker, "player") 
then 
cancelEvent () 
  
end 
end 
) 
  
  

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
local colRec = createColRectangle (-1203.599609375, 2814.75, 500,500) 
local colRad = createRadarArea (-782.689453125, 656.4794921875, 1700,2200,0,0,0,100) 
local col = {colRec,colRad} 
  
addEventHandler ("onClientPlayerDamage",localPlayer, 
function (attacker) 
    for i , v in pairs (col) do 
        if isElementWithinColShape (source, v) then  
            cancelEvent () 
        end 
    end  
end 
) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
local colRec = createColRectangle (-1203.599609375, 2814.75, 500,500) 
local colRad = createRadarArea (-782.689453125, 656.4794921875, 1700,2200,0,0,0,100) 
local col = {colRec,colRad} 
  
addEventHandler ("onClientPlayerDamage",localPlayer, 
function (attacker) 
    for i , v in pairs (col) do 
        if isElementWithinColShape (source, v) then  
            cancelEvent () 
        end 
    end  
end 
) 

Seems to not be working.

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
colRec = createColRectangle (-1203.599609375, 2814.75, 500,500) 
colRad = createRadarArea (-782.689453125, 656.4794921875, 1700,2200,0,0,0,100) 
  
addEventHandler ( "onClientPlayerDamage", localPlayer, 
    function (attacker) 
        if getElementType ( attacker ) == "player" then 
            if isElementWithinColShape ( source, colRec ) then 
                cancelEvent () 
            end 
        end 
    end 
) 

Posted
colRec = createColRectangle (-1203.599609375, 2814.75, 500,500) 
colRad = createRadarArea (-782.689453125, 656.4794921875, 1700,2200,0,0,0,100) 
  
addEventHandler ( "onClientPlayerDamage", localPlayer, 
    function (attacker) 
        if getElementType ( attacker ) == "player" then 
            if isElementWithinColShape ( source, colRec ) then 
                cancelEvent () 
            end 
        end 
    end 
) 

getElementType expected element at argument 1, got boolean

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
colRec = createColRectangle (-1203.599609375, 2814.75, 500,500) 
colRad = createRadarArea (-782.689453125, 656.4794921875, 1700,2200,0,0,0,100) 
  
addEventHandler ( "onClientPlayerDamage", localPlayer, 
    function (attacker) 
        if isElement ( attacker ) and getElementType ( attacker ) == "player" then 
            if isElementWithinColShape ( source, colRec ) then 
                cancelEvent () 
            end 
        end 
    end 
) 

Posted
colRec = createColRectangle (-1203.599609375, 2814.75, 500,500) 
colRad = createRadarArea (-782.689453125, 656.4794921875, 1700,2200,0,0,0,100) 
  
addEventHandler ( "onClientPlayerDamage", localPlayer, 
    function (attacker) 
        if isElement ( attacker ) and getElementType ( attacker ) == "player" then 
            if isElementWithinColShape ( source, colRec ) then 
                cancelEvent () 
            end 
        end 
    end 
) 

Doesn't work :/

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted

Try this it should work

colRec = createColRectangle (-1203.599609375, 2814.75, 500,500) 
colRad = createRadarArea (-782.689453125, 656.4794921875, 1700,2200,0,0,0,100) 
col = {colRec,colRad} 
  
addEventHandler("onClientPlayerDamage", root, 
function() 
    if isElementWithinGreenzone(source) then  
        cancelEvent() 
    end 
end) 
  
function isElementWithinGreenzone(element) 
    if (not isElement(element)) then return false end 
        for i, zone in pairs(col) do 
            if (isElementWithinColShape(element, zone)) then  
                return true  
            end 
        end 
    return false 
end 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
Try this it should work
colRec = createColRectangle (-1203.599609375, 2814.75, 500,500) 
colRad = createRadarArea (-782.689453125, 656.4794921875, 1700,2200,0,0,0,100) 
col = {colRec,colRad} 
  
addEventHandler("onClientPlayerDamage", root, 
function() 
    if isElementWithinGreenzone(source) then  
        cancelEvent() 
    end 
end) 
  
function isElementWithinGreenzone(element) 
    if (not isElement(element)) then return false end 
        for i, zone in pairs(col) do 
            if (isElementWithinColShape(element, zone)) then  
                return true  
            end 
        end 
    return false 
end 

Still not working D:

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted

Still not working D:

i already tested it and it's working fine.

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

Still not working D:

i already tested it and it's working fine.

Sure it's making attackers to not deal damage to players? Because people in my server keep DMing in those zones

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

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