local wezwanie = createElement("wezwanie")
function sapd(plr,commands, ...)
if not ... then outputChatBox("Zapomnia?e? doda? powodu! (/997 [pow?d])!",plr,255,255,255) return end
local msg = table.concat ( {...}, " " )
local x,y,z = getElementPosition(plr)
local ulica = getZoneName(x,y,z, false)
local ulica2 = getZoneName(x,y,z, true)
if ulica2~=ulica then ulica = ""..ulica.." - "..ulica2 else ulica = ""..ulica.." - Poza miastem" end
if not getElementData ( wezwanie, "ogloszenie" ) then
blippolicja = createBlip(x,y,z, 41)
setElementData ( wezwanie, "ogloszenie", true )
outputChatBox("Wezwa?e? SAPD, z powodu #3399ff"..msg:gsub("#%x%x%x%x%x%x","").."#ffffff! Czekaj, a? kto? przyjedzie.",plr,255,255,255, true)
for k,v in ipairs(getElementsByType("player")) do
if getElementData(v, "player:faction")=="SAPD" then
setElementVisibleTo(blippolicja, v, true)
local markerek = createMarker ( x, y, z-8, "cylinder", 40, 0, 0, 0, 100)
outputChatBox("\n#ffff00==============================\n#ffffffWezwanie od gracza: #3399ff"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."\n#ffffffPow?d: #3399ff"..msg:gsub("#%x%x%x%x%x%x","").."\n#ffffffLokalizacja gracza: #3399ff"..ulica.."\n#ffff00==============================\n",v, 255,255,0, true)
end
end
setTimer(function()
setElementData(wezwanie, "wezwanie", false)
end,60000,1)
else
outputChatBox("Wezwanie mo?esz wysy?a? raz na minut?!", plr, 255, 255, 255, true)
end
end
addCommandHandler("wezwij.sapd",sapd)
addEventHandler("onClientMarkerHit", markerek, function(plr)
local v = getElementData(plr,"player:faction") == "SAPD"
if getElementData(plr, "player:faction")=="SAPD" then
outputChatBox("Dojecha? na miejsce zdarzenia!",v,255,255,255, true)
setElementVisibleTo(blippolicja, plr, false)
end
end)