okienka={
{-1620.77, 699.33, 18.00},
{-1617.88, 700.18, 18.00},
}
function pokaz(el,md)
if source==mandatmarker then
local accName=getAccountName(getPlayerAccount(el))
if (getElementData(el,'player:rank') or 0)>=99 or isObjectInACLGroup("user."..accName,aclGetGroup("Admin")) then
nieoplacone=exports["ogrpg-db"]:dbGet("select sum(kwota) as a from Mandaty where oplacony=0 && wystawil=-1 limit 1")[1].a
oplacone=exports["ogrpg-db"]:dbGet("select sum(kwota) as a from Mandaty where oplacony=1 && wystawil=-1 limit 1")[1].a
oplaconenie=exports["ogrpg-db"]:dbGet("select sum(kwota) as a from Mandaty where oplacony=0 && wystawil>0 limit 1")
if not oplaconenie[1].a then
oplaconenie=0
else
oplaconenie=oplaconenie[1].a
end
oplaconetak=exports["ogrpg-db"]:dbGet("select sum(kwota) as a from Mandaty where oplacony=1 && wystawil>0 limit 1")
if not oplaconetak[1].a then
oplaconetak=0
else
oplaconetak=oplaconetak[1].a
end
outputChatBox("=== Dane z mandat?w ===",el,0,0,255)
outputChatBox("Fotoradary: "..nieoplacone+oplacone.."PLN",el,0,255,255)
outputChatBox("=> Nieop?acone: "..nieoplacone.."PLN",el,0,255,255)
outputChatBox("=> Op?acone: "..oplacone.."PLN",el,0,255,255)
outputChatBox("Policjanci: "..oplaconenie+oplaconetak.."PLN",el,0,255,255)
outputChatBox("=> Nieop?acone: "..oplaconenie.."PLN",el,0,255,255)
outputChatBox("=> Op?acone: "..oplaconetak.."PLN",el,0,255,255)
outputChatBox("=== Dane z mandat?w ===",el,0,0,255)
else
outputChatBox("Brak uprawnie?",el,255,0,0)
end
return
end
q=exports["ogrpg-db"]:dbGet("select *,IF(data_wystawienia+interval 3 day>now(),0,floor(kwota*0.25)) as odsetki from Mandaty where gracz=? && oplacony=0",getElementData(el,"player:uid"))
if #q>0 then
triggerClientEvent(el,"SAPD:mandaty:pokaz",resourceRoot,q)
else
outputChatBox("Nie masz ?adnego mandatu do op?acenia :)",el,0,255,0)
end
end
for i,v in ipairs(okienka) do
createMarker(v[1],v[2],v[3]-1,"cylinder",1,170,170,170,170)
local t=createElement("text")
setElementData(t,"name","Op?acanie mandat?w")
setElementPosition(t,v[1],v[2],v[3]-0.2)
end
addEventHandler("onMarkerHit",resourceRoot,pokaz)
mandatmarker=createMarker(594.56, -332.91, 1340.51,"cylinder",1.5,255,0,0,170)
function zaplacmandat(id)
q=exports["ogrpg-db"]:dbGet("select *,IF(data_wystawienia+interval 3 day>now(),0,floor(kwota*0.25)) as odsetki from Mandaty where gracz=? && oplacony=0 limit 1",getElementData(client,"player:uid"),tonumber(id))
if #q>0 then
q=q[1]
kwotamandatu=q.kwota+q.odsetki
if kwotamandatu>getPlayerMoney(client) then
outputChatBox("Nie sta? ci? na op?acenie mandatu!",client,255,0,0)
else
exports["ogrpg-db"]:dbSet("update Mandaty set oplacony=1,data_oplacenia=now() where ID=? limit 1",id)
takePlayerMoney(client,kwotamandatu)
outputChatBox("Pomy?lnie op?aci?e? mandat!",client,0,255,0)
q=exports["ogrpg-db"]:dbGet("select *,IF(data_wystawienia+interval 3 day>now(),0,floor(kwota*0.25)) as odsetki from Mandaty where gracz=? && oplacony=0",getElementData(client,"player:uid"))
exports["ogrpg-db"]:dbSet("update ogrpg_users set bank_money=bank_money+? where id=4",kwotamandatu)
triggerClientEvent(client,"SAPD:mandaty:pokaz",resourceRoot,q)
end
else
outputChatBox("Wyst?pi? b??d",client,255,0,0)
end
end
addEvent("SAPD:mandaty:zaplac",true)
addEventHandler("SAPD:mandaty:zaplac",resourceRoot,zaplacmandat)
function mandat(plr, cmd, target,kwota, ...)
if getElementData(plr,"player:duty") and getElementData(plr,"player:duty") == "SAPD" then
if not (target) or not (kwota) or not (...) then
outputChatBox('B??d! U?yj: /'..cmd..' <nick/ID> <kwota> <pow?d/numer pomiaru>',plr,255,0,0)
else
if getElementData(plr,"player:rank") < 1 then outputChatBox("*Nie masz uprawnien",plr,255,0,0) return end
kwota=tonumber(kwota)
if kwota<=10 then
outputChatBox('Najmniejsza kwota mandatu to 10 PLN!',plr,255,0,0)
return
elseif kwota>15000 then
outputChatBox('Kwota mandatu jest zbyt du?a (max. 15.000 PLN).',plr,255,0,0)
return
end
local target=exports['ogrpg-core']:findPlayer(plr,target)
if target then
local x1,y1,z1=getElementPosition(plr)
local x2,y2,z2=getElementPosition(target)
local distance=getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2)
powod=table.concat({...},' ')
if tonumber(powod) then
powod=tonumber(powod)
q=exports["ogrpg-db"]:dbGet("select gracz_pozycja,predkosc,id_pojazdu from SAPD_pomiary where ID=? limit 1",powod)
if #q>0 then
if q[1].id_pojazdu=="0" then
q[1].id_pojazdu="publiczny"
else
q[1].id_pojazdu="UID: "..q[1].id_pojazdu
end
powod="Miejsce pomiaru: "..fromJSON(q[1].gracz_pozycja)[1]..", pojazd "..q[1].id_pojazdu..", pr?dko??: "..math.floor(q[1].predkosc).."km/h"
else
return outputChatBox("Nie ma takiego pomiaru pr?dko?ci!",plr,255,0,0)
end
end
if distance<250 then
outputChatBox("#356dceWystawi?es mandat dla "..getPlayerName(target).."#356dce na kwot?#1f7a03 "..kwota.."PLN#356dce. Pow?d:#ff0000 "..powod,plr,0,255,0,true)
outputChatBox("#356dceOtrzyma?e? mandat od "..getPlayerName(plr).."#356dce na kwot?#1f7a03 "..kwota.."PLN#356dce. Pow?d:#ff0000 "..powod,target,0,255,0,true)
outputChatBox("Funkcjonariusza SAPD wystawi? w komputerze pok?adowym mandat na ciebie, pieni?dze zosta?y pobrane automatycznie!",target,0,255,0)
takePlayerMoney(target, kwota)
exports["ogrpg-db"]:dbSet("insert into Mandaty values(null,?,?,now(),?,?,?,?,0,0)",getElementData(target,"player:uid"),getPlayerSerial(plr),toJSON({x1,y1,z1},true),getElementData(plr,"player:uid"),powod,kwota)
else
if getElementData(plr,"OstatniPomiar")==target then
if getElementData(plr,"OstatniPomiarCzas")>getTickCount() then
outputChatBox("#356dceWystawi?es mandat dla "..getPlayerName(target).."#356dce na kwot?#1f7a03 "..kwota.."PLN#356dce. Pow?d:#ff0000 "..powod,plr,0,255,0,true)
outputChatBox("#356dceOtrzyma?e? mandat od "..getPlayerName(plr).."#356dce na kwot?#1f7a03 "..kwota.."PLN#356dce. Pow?d:#ff0000 "..powod,target,0,255,0,true)
outputChatBox("Mandat mo?esz op?aci? na komisariacie Policji. Po trzech dniach nieop?acenia s? naliczane odsetki w wysoko?ci 25%!",plr,0,255,0)
exports["ogrpg-db"]:dbSet("insert into Mandaty values(null,?,?,now(),?,?,?,?,0,0)",getElementData(target,"player:uid"),getPlayerSerial(plr),toJSON({x1,y1,z1},true),getElementData(plr,"player:uid"),powod..". Mandat wystawiony na odleg?o??/ucieczka. Pomiar #"..tostring(getElementData(plr,"OstatniPomiarID")),kwota)
setElementData(plr,"OstatniPomiar",nil,true)
setElementData(plr,"OstatniPomiarID",nil,true)
else
outputChatBox("Mo?liwo?? wystawienia mandatu na odleg?o?? jest przedawniona!",plr,255,0,0)
setElementData(plr,"OstatniPomiar",nil,true)
setElementData(plr,"OstatniPomiarID",nil,true)
end
end
outputChatBox('Jeste? za daleko gracza, ?eby m?c wystawi? mandat.',plr,255,0,0)
end
else
outputChatBox("Nie ma takiego gracza!",plr,255,0,0)
end
end
end
end
addCommandHandler('mandat', mandat)
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach