Search the Community
Showing results for tags 'colshape'.
-
I've recently found out that onClientColshapeHit triggers only when object's center hit the colshape Functions like getElementsWithinColShape and isElementWithinColShape work on the same principle. It's kinda bad because it affects the whole gamemode i make and makes it impossible to complete. I tried to use isLineOfSightClear function however i should use it on each unit of a single object. 9x9x9 object cause performance loss so this is a bad idea. Is there any other ideas?
- 8 replies
-
- object
- intersection
-
(and 3 more)
Tagged with:
-
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.
-
Hi everyone! have here server-side script local col = createColCircle(170, -377, 15) local object = createObject(737, 175, -377, 6) print(isElementWithinColShape(object, col)) -- print false Can anyone tell me, why i got false, when object IN colshape? Object and colshape have same coordinates.