I tried to create Colshape-based antiDM system. It looks like this:
antiDeathMatchColShapes= {353.71392822266, 170.66009521484, 1005.3893432617, 100, 100, 1, 3}
animebankess = createPed (233, 359.71392822266, 173.66009521484, 1008.3893432617, -90)
outputChatBox(tostring(animebankess))
setElementDimension ( animebankess, 1 )
setElementInterior ( animebankess, 3 )
addEventHandler("onClientResourceStart", getRootElement(), function ()
outputChatBox("Yeah!")
outputChatBox(antiDeathMatchColShapes[1])
local i = 1
local count = 1
AntiDmZones = {}
repeat
outputChatBox("done once!")
colX = antiDeathMatchColShapes[i]
colY = antiDeathMatchColShapes[i+1]
colZ = antiDeathMatchColShapes[i+2]
colR = antiDeathMatchColShapes[i+3]
colH = antiDeathMatchColShapes[i+4]
colDim = antiDeathMatchColShapes[i+5]
colInt = antiDeathMatchColShapes[i+6]
table.insert(AntiDmZones, createColTube(colX, colY, colZ, colR, colH))
setElementDimension(AntiDmZones[count], colDim)
setElementInterior(AntiDmZones[count], colInt)
count = count + 1
i=i+8
until not antiDeathMatchColShapes[i]
addEventHandler("onClientPedDamage", getRootElement(), function (attacker)
local i = 1
while AntiDmZones[i]
do
outputChatBox(tostring(source))
checkOne = isElementWithinColShape(source, AntiDmZones[i])
checkTwo = isElementWithinColShape(attacker, AntiDmZones[i])
outputChatBox(tostring(checkOne))
outputChatBox(tostring(checkTwo))
if isElementWithinColShape(source, AntiDmZones[i]) or isElementWithinColShape(attacker, AntiDmZones[i]) then
cancelEvent()
end
i=i+1
end
end)
addEventHandler("onClientPlayerDamage", getRootElement(), function (attacker)
local i = 1
while AntiDmZones[i]
do
outputChatBox(tostring(getElementType(AntiDmZones[i])))
if isElementWithinColShape(source, AntiDmZones[i]) or isElementWithinColShape(attacker, AntiDmZones[i]) then
cancelEvent()
end
i=i+1
end
end)
addEventHandler("onClientVehicleDamage", getRootElement(), function (attacker)
local i = 1
while AntiDmZones[i]
do
outputChatBox(tostring(getElementType(AntiDmZones[i])))
if isElementWithinColShape(source, AntiDmZones[i]) or isElementWithinColShape(attacker, AntiDmZones[i]) then
cancelEvent()
end
i=i+1
end
end)
addEventHandler("onClientPlayerStealthKill", getRootElement(), function (attacker)
local i = 1
while AntiDmZones[i]
do
outputChatBox(tostring(getElementType(AntiDmZones[i])))
if isElementWithinColShape(source, AntiDmZones[i]) or isElementWithinColShape(attacker, AntiDmZones[i]) then
cancelEvent()
end
i=i+1
end
end)
end)
And even if ped inside the colshape, check returns false. But if player inside colshape - check returns true. Two hours spent to find out what is the problem - two hours just wasted.
Sorry for my weird usage of loops.