function onPlayerChatSend(msg,type)
if type == 0 then
cancelEvent()
if ninjaban(msg) then
cancelEvent()
triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").."("..getElementData(source,"id")..") zosta? wyrzucony przez ANTY-REKLAMA")
kickPlayer (source, "ANTY-REKLAMA")
return end
if getElementData(source, "gracz_mute") then
outputChatBox("* Jeste? wyciszony!", source)
return
end
if not getElementData(source,"gracz_mute") then
triggerClientEvent("onDebugMessage", resourceRoot, "("..getElementData(source,"id")..") "..getPlayerName(source):gsub("#%x%x%x%x%x%x","")..": "..msg,1, "CZAT")
local x, y, z = getElementPosition(source)
local col = createColSphere(x, y, z, 50)
for i,v in ipairs(getElementsWithinColShape(col, "player")) do
if getElementData(source,"zamaskowany") then
outputChatBox( "#FFFFFFZamaskowana osoba #FF0011( #FFFFFF"..getElementData(source,"id").."#003C05 #FF0011) :#FFFFFF "..msg,v, 255, 255, 255, true)
else
outputChatBox( "#FFFFFF"..getPlayerName(source).." #FF0011( #FFFFFF"..getElementData(source,"id").."#003C05 #FF0011) :#FFFFFF "..msg,v, 255, 255, 255, true)
end
end
destroyElement(col)
end
end
end
addEventHandler("onPlayerChat", getRootElement(), onPlayerChatSend)
function onPrivateMessage(plr, cmd, target, ...)
if not (getElementData(plr, "player:logged") == true) then return end
if not target or not {...} then
outputChatBox('* U?yj /pm <nick/ID> <tre??>', plr)
return
end
if ninjaban(...) then
kickPlayer (plr, "ANTY-REKALAM")
triggerClientEvent(root, "admin:rendering", root, "* "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."("..getElementData(plr,"id")..") zosta? wyrzucony przez ANTY-REKLAMA")
return end
local text=table.concat({...}, ' ')
local target=exports["ms-core"]:findPlayer(plr,target)
if not target then
triggerClientEvent(plr,"dodaj:powiadomienie",root,'* Nie znaleziono podanego gracza.')
return
end
if not (getElementData(target, "player:logged") == true) then
triggerClientEvent(plr,"dodaj:powiadomienie",root,'* Gracz nie jest zalogowany.')
return end
local pmoff=getElementData(target,"pmoff")
if (pmoff) then
outputChatBox(getPlayerName(target):gsub("#%x%x%x%x%x%x","").." nie akceptuje wiadomo?ci PM.", plr)
if (type(pmoff)=="string") then
outputChatBox("Pow?d: " .. pmoff, plr)
end
return
end
if getElementData(plr,"pmoff") then
outputChatBox("* Posiadasz wy??czone wiadomo?ci PM. Ta osoba nie b?dzie mog?a Ci odpisa?.", plr)
end
if getElementData(plr, "gracz_mute") then
outputChatBox("* Jeste? wyciszony!", plr)
return
end
if getElementData(target, "zamaskowany") then
outputChatBox("* Ta osoba jest zamaskowana!!", plr, 255,0,0)
return
end
outputChatBox(">> "..getPlayerName(target).." #FF0011( #FFFFFF"..getElementData(target,"id").."#FF0011 ) #FF0011: #ffffff"..text.."", plr, _, _, _, true)
outputChatBox("<< "..getPlayerName(plr).." #FF0011( #FFFFFF"..getElementData(plr,"id").."#FF0011 ) #FF0011: #ffffff"..text.."", target, _, _, _, true)
local pm_text=('PM > %s(%d)(uid:%d) >> %s(%d)(uid:%d): %s'):format(getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"id"), getElementData(plr,"player:uid"), getPlayerName(target):gsub("#%x%x%x%x%x%x",""), getElementData(target,"id"),getElementData(target,"player:uid"), text)
triggerClientEvent("onDebugMessage", resourceRoot, pm_text,3, "PM")
end
addCommandHandler('pw', onPrivateMessage)
addCommandHandler('pm', onPrivateMessage)
addCommandHandler("pmon", function(plr,cmd)
removeElementData(plr,"pmoff")
outputChatBox("(( Akceptujesz wszystkie wiadomo?ci PM. ))", plr)
return
end)
addCommandHandler("pmoff", function(plr,cmd,...)
local powod=table.concat({...}, ' ')
if (not powod or string.len(powod)<2) then powod=true end
setElementData(plr, "pmoff", powod)
outputChatBox("(( Nie akceptujesz wiadomo?ci PM. ))", plr)
return
end)
function onTransferMoney(plr, cmd, target, value)
if not target or not tonumber(value) then
outputChatBox(' U?yj: /przelej <nick/ID> <kwota>', plr)
return
end
value=string.match(value, "%d*")
value=tonumber(value)
outputDebugString(type(value))
local target=exports["ms-core"]:findPlayer(plr,target)
if not target then
triggerClientEvent(plr,"dodaj:powiadomienie",root,'* Nie znaleziono podanego gracza.')
return
end
if not (getElementData(target, "player:logged") == true) then
outputChatBox('* Gracz nie jest zalogowany!', plr, 255, 0, 0)
return end
if getPlayerMoney(plr) < value then
triggerClientEvent(plr,"dodaj:powiadomienie",root,'* Nie masz wystarczajacych ?rodk?w.')
return
end
if value == 0 or value < 0 then
triggerClientEvent(plr,"dodaj:powiadomienie",root,"* Poda?e? nie prawid?ow? warto??.")
return
end
if getElementData(target, "zamaskowany") then
outputChatBox("* Ta osoba jest zamaskowana!!", plr, 255,0,0)
return
end
takePlayerMoney(plr, value)
givePlayerMoney(target ,value)
outputChatBox("#FF0011* Przela?e? Pieni?dze graczowi: #FFFFFF"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." #FF0011( #FFFFFF"..getElementData(target,"id").." #FF0011) Ilo?? przelanej got?wki: #ffffff"..value.." Funt?w.", plr, _, _, _, true)
outputChatBox("#FF0011* Dosta?e? pieni?dze od: #FFFFFF"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." #FF0011( #FFFFFF"..getElementData(plr,"id").." #FF0011) ilo?? otrzymanej got?wki: #ffffff"..value.." Funt?w.", target, _, _, _, true)
local transfer_text=('TRANSFER> %s(%d)(uid:%d)>> %s(%d)(uid:%d): %d'):format(getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), getElementData(plr,"id"), getElementData(plr,"player:uid"), getPlayerName(target):gsub("#%x%x%x%x%x%x",""), getElementData(target,"id"),getElementData(target,"player:uid"), value)
triggerClientEvent("onDebugMessage", resourceRoot, transfer_text,4, "TRANSFER")
end
addCommandHandler('przelej', onTransferMoney)
addCommandHandler('zaplac', onTransferMoney)
function ninjaban(ip)
-- must pass in a string value
if ip == nil or type(ip) ~= "string" then
return false
end
-- check for format 1.11.111.111 for ipv4
local chunks = {ip:match("(%d+)%.(%d+)%.(%d+)%.(%d+)")}
if (#chunks == 4) then
for _,v in pairs(chunks) do
if (tonumber(v) < 0 or tonumber(v) > 255) then
return false
else
return true
end
end
else
return false
end
return false
end