Hey
I try use this command and it dont work.. Is it correct?
CLIENT SIDE
function destroy(source, cmd)
local px, py, pz = getElementPosition(getLocalPlayer())
local rx, ry, rz = getElementRotation(getLocalPlayer())
local tz, ty = getPointFromDistanceRotation(x, y, 2, rz)
local hit, hitX, hitY, hitZ, hitlineElement, normalX, normalY, normalZ = processLineOfSight(px, py, pz, tx, ty, pz+5, true, true, false, true, false, true, false, true, getLocalPlayer())
if isElement(hitlineElement) then
if getElementModel(hitlineElement) == 979 then
triggerServerEvent ("destroyRoadblock", getLocalPlayer(), hitlineElement )
end
end
end
addCommandHandler("destroyroadblock", destroy)
function getPointFromDistanceRotation(x, y, dist, angle)
local a = math.rad(90 - angle);
local dx = math.cos(a) * dist;
local dy = math.sin(a) * dist;
return x+dx, y+dy;
end
Serverside
addEvent("destroyRoadblock", true)
function destroyRoadblock()
destroyElement(roadblock)
end
addEventHandler("destroyRoadblock", root, destroyRoadblock)