addEvent("wystawM", true)
addEventHandler("wystawM", getRootElement(),
function (mandat, score, gracz)
local daj = getPlayerFromName(gracz)
if (daj) then
local money = getPlayerMoney(daj)
local pkt = getElementData(daj,"Score")
if (tonumber(money) < tonumber(mandat)) then
if (tonumber(pkt) < tonumber(score)) then
outputChatBox("Dany gracz posiada tylko #FF0000"..money.."$,#FFFFFF. Nie starczy mu na mandat!", getRootElement(), 255, 255, 255, true)
outputChatBox("Dany gracz posiada tylko #FF0000"..pkt.."$,#FFFFFF. Nie starczy mu na mandat!", getRootElement(), 255, 255, 255, true)
else
takePlayerMoney(daj, mandat)
setElementData(daj,pkt,true)
outputChatBox("Wystawi?e? "..gracz.." mandat w wysoko?ci #00FF00"..mandat.."$#FFFFFF.", getRootElement(), 255, 255, 255, true)
outputChatBox("Otrzyma?e? mandat w wysoko?ci #00FF00"..mandat.."$#FFFFFF.", daj, 255, 255, 255, true)
triggerClientEvent("closeM", getRootElement())
end
end
end
end)