The variable victim contains extra information. It is optional.
function cameraFireing(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement)
iprint("event is fired")
if getElementData(localPlayer, "char.inMarkerZone") then
iprint("source is in zone")
local victim = isElement(hitElement) and getElementType(hitElement) == "player" and hitElement or false
local zoneName = getElementData(localPlayer,"char.MarkerZoneName")
triggerServerEvent("sendGroupMessage", resourceRoot, victim, victim and getPlayerName(victim), zoneName)
end
end
addEventHandler("onClientPlayerWeaponFire", localPlayer, cameraFireing)
addEvent("sendGroupMessage", true)
addEventHandler("sendGroupMessage", resourceRoot,
function (victim, victimName, zoneName)
local message = "#ffffffThe camera: #ca5454(".. zoneName ..") #ffffffdetected shots. "
if victimName then
message = message .. " You hit this player: " .. victimName
end
outputChatBox(message, client)
if isElement(victim) then
outputChatBox(getPlayerName(client) .. " hits you and he doesn't feel sorry for it.", victim)
end
local players = getElementsByType("player")
for i=1, #players do
local player = players[i]
if player ~= client and player ~= victim then
outputChatBox(getPlayerName(client) .. " loves sheeps.", player)
end
end
end, false)