Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sql = exports.rise_mysql:getConnection()
- local sentAdv = {}
- local advTimers = {}
- local calls = {}
- function addPhone(p)
- local number = math.random(111111, 999999)
- exports.rise_item:giveItem(p,8,tonumber(number),1,0)
- end
- addEvent('phone:addPhone', true)
- addEventHandler('phone:addPhone', root, addPhone)
- function sendMessage(p, f, n, t)
- if tonumber(n) and tonumber(n) >= 111111 and tonumber(n) <= 999999 then
- local target = getPlayerPhoneNumber(tonumber(n))
- if target then
- exports.rise_chat:sendLocalMeAction(p, 'küldött egy sms-t.')
- exports.rise_chat:sendLocalMeAction(target, 'kapott egy sms-t.')
- triggerClientEvent(target, 'phone:createNewMessageC', target, f, t)
- dbExec(sql, 'INSERT INTO phone_sms SET fr=?, t=?, msg=?', f, tonumber(n), t)
- else
- outputChatBox('#DC143C[RiseMTA]:#ffffff Sikertelen üzenetküldés! Ezen a számon előfizető nem található!', p, 0, 0, 0, true)
- end
- else
- exports.rise_infobox:addNotificationFelsoS(p, 'Sikertelen üzenetküldés.\nHibás telefonszám.', 'info')
- end
- end
- addEvent('phone:sendMessageS', true)
- addEventHandler('phone:sendMessageS', root, sendMessage)
- function loadMessages(p, n)
- local qh = dbPoll(dbQuery(sql, 'SELECT fr, msg FROM phone_sms WHERE t=? ORDER BY dat DESC', n), -1)
- local t = {}
- for k, v in pairs(qh) do
- t[#t+1] = {v['fr'], v['msg']}
- end
- triggerClientEvent(p, 'phone:loadMessagesC', p, t)
- end
- addEvent('phone:loadMessagesS', true)
- addEventHandler('phone:loadMessagesS', root, loadMessages)
- function sendAdv(p, t, s, n)
- local price = string.len(t)*250
- if not (sentAdv[p] and advTimers[p]) then
- if price > 250 then
- if p:getData('char:money') >= price then
- outputChatBox("#DC143C[RiseMTA]:#ffffffA hírdetés feladása összesen "..price..'Ft-ba került. Köszönjük.', p, 0, 0, 0, true)
- if advTimers[p] then
- sentAdv[p] = setTimer(function(p) sentAdv[p] = nil end, 1000*5*60, 1, p)
- else
- advTimers[p] = setTimer(function(p) advTimers[p] = nil end, 1000*5*60, 1, p)
- end
- p:setData('char:money', p:getData('char:money')-price)
- for k, v in pairs(getElementsByType('player')) do
- if v:getData('phone:ads') then
- outputChatBox('#FFFFFF==================== [ #05afb5RiseCity újság#FFFFFF ] ====================', v, 2, 216, 55, true)
- outputChatBox('#05afb5HÍRDETÉS:#FFFFFF '..t..'', v, 2, 216, 55, true)
- outputChatBox('#05afb5Kapcsolat:#FFFFFF '..n..' (('..p:getData('char:name')..')).', v, 2, 216, 55, true)
- end
- end
- else
- exports.rise_infobox:addNotificationFelsoS(p, 'Nincs elég pénzed', 'error')
- end
- end
- else
- outputChatBox('#DC143C[RiseMTA]:#ffffff 5 percenként maximum 2 hírdetést tudsz feladni.', p, 0, 0, 0, true)
- end
- end
- addEvent('phone:sendAdvS', true)
- addEventHandler('phone:sendAdvS', root, sendAdv)
- function sendAdvIllegal(p, t, s, n)
- local price = string.len(t)*250
- if not (sentAdv[p] and advTimers[p]) then
- if price > 250 then
- local send = true
- for i, d in pairs(RisenionBlackList) do
- if exports.rise_dashboard:isInGroup(p, d) then
- send = false
- break
- end
- end
- if send then
- if p:getData('char:money') >= price then
- outputChatBox("#DC143C[RiseMTA]:#ffffffA hírdetés feladása összesen "..price..'Ft-ba került. Köszönjük.', p, 0, 0, 0, true)
- if advTimers[p] then
- sentAdv[p] = setTimer(function(p) sentAdv[p] = nil end, 1000*5*60, 1, p)
- else
- advTimers[p] = setTimer(function(p) advTimers[p] = nil end, 1000*5*60, 1, p)
- end
- p:setData('char:money', p:getData('char:money')-price)
- for k, v in pairs(getElementsByType('player')) do
- if v:getData('phone:ads') then
- local show = true
- for i, d in pairs(RisenionBlackList) do
- if exports.rise_dashboard:isInGroup(v, d) then
- show = false
- break
- end
- end
- if show then
- outputChatBox('#FFFFFF==================== [ #b54e05RiseCity DarkWeb#FFFFFF ] ====================', v, 2, 216, 55, true)
- outputChatBox('#b54e05HÍRDETÉS:#FFFFFF '..t..'', v, 2, 216, 55, true)
- outputChatBox('#b54e05Kapcsolat:#FFFFFF '..n..' (('..p:getData('char:name')..')).', v, 2, 216, 55, true)
- end
- end
- end
- else
- exports.rise_infobox:addNotificationFelsoS(p, 'Nincs elég pénzed', 'error')
- end
- end
- end
- else
- outputChatBox('#DC143C[RiseMTA]:#ffffff 5 percenként maximum 2 hírdetést tudsz feladni.', p, 0, 0, 0, true)
- end
- end
- addEvent('phone:sendAdvIllegalS', true)
- addEventHandler('phone:sendAdvIllegalS', root, sendAdvIllegal)
- function startCall(p, myNum, num)
- local t = getPlayerPhoneNumber(num)
- if t then
- if t ~= p then
- if not calls[t] then
- calls[p] = t
- calls[t] = p
- triggerClientEvent(t, 'phone:startRingC', t, myNum, num)
- triggerClientEvent(p, 'phone:setCallerScreenC', p)
- else
- outputChatBox('#DC143C[RiseMTA]:#ffffff A hívott szám pillanatnyilag nem kapcsolható!', p, 0, 0, 0, true)
- end
- else
- outputChatBox('#DC143C[RiseMTA]:#ffffff A hívott szám pillanatnyilag nem kapcsolható!', p, 0, 0, 0, true)
- end
- end
- end
- addEvent('phone:startCallS', true)
- addEventHandler('phone:startCallS', root, startCall)
- function endCall(p)
- triggerClientEvent(calls[p], 'phone:endCallC', calls[p])
- triggerClientEvent(root, 'phone:stopRingSoundC', root, calls[p])
- triggerClientEvent(root, 'phone:stopRingSoundC', root, p)
- outputChatBox('#DC143C[RiseMTA]:#ffffff Vége a hívásnak!', p, 0, 0, 0, true)
- outputChatBox('#DC143C[RiseMTA]:#ffffff Vége a hívásnak!', calls[p], 0, 0, 0, true)
- calls[calls[p]] = nil
- calls[p] = nil
- end
- addEvent('phone:endCallS', true)
- addEventHandler('phone:endCallS', root, endCall)
- function sendPlayerCallerText(p, n, t)
- exports.rise_chat:localIC(p, t, '', ' ((telefonba))')
- triggerClientEvent(calls[p], 'phone:addPlayerCallerTextC', calls[p], n, t)
- triggerClientEvent(p, 'phone:addPlayerCallerTextC', p, n, t)
- end
- addEvent('phone:sendPlayerCallerTextS', true)
- addEventHandler('phone:sendPlayerCallerTextS', root, sendPlayerCallerText)
- function startRingSound(p, n)
- triggerClientEvent(root, 'phone:startRingSoundC', root, p, n)
- end
- addEvent('phone:startRingSoundS', true)
- addEventHandler('phone:startRingSoundS', root, startRingSound)
- function stopRingSound(p)
- triggerClientEvent(root, 'phone:stopRingSoundC', root, p)
- end
- addEvent('phone:stopRingSoundS', true)
- addEventHandler('phone:stopRingSoundS', root, stopRingSound)
- function getPlayerPhoneNumber(n)
- local r = false
- for k, v in pairs(getElementsByType('player')) do
- if exports.rise_item:hasItem(v, 8, n) or exports.rise_item:hasItem(v, 8, tostring(n)) then
- r = v
- break
- end
- end
- return r
- end
Advertisement
Add Comment
Please, Sign In to add comment