Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local connection = exports['mta_connection']:getConnection()
- local adminlog = "INSERT INTO paylog SET playername=?, playerid=?, tevkod=?, log=?, targetname=?, targetid=?, date=CURDATE(), time=CURTIME()"
- -------------------------------------------------------------------------------------<[ BANK ]>-------------------------------------------------------------------------------------
- local robberBlip = {}
- local theFlex = {}
- local atmBlip = {}
- local pedX, pedY, pedZ = 1930.0418701172, -1789.4986572266, 13.3828125
- local rot1, rot2, rot3 = -0, 0, 266.65075683594
- local pedDim = 0
- local pedInt = 0
- local pedSkin = 60
- local pedName = "A RainbowSix egy szar"
- local pedNameTags = "Kazetta"
- local casettePed = createPed(pedSkin, pedX, pedY, pedZ)
- setElementRotation(casettePed,rot1, rot2, rot3)
- setElementDimension(casettePed,pedDim)
- setElementInterior(casettePed,pedInt)
- setElementData(casettePed,"casettePed",true)
- setElementFrozen(casettePed,true)
- setElementData(casettePed,"ped:name",pedName)
- setElementData(casettePed,"name:tags",pedNameTags)
- function checkBankCardsFunction(playerSource)
- local checkID = dbPoll(dbQuery(connection, "SELECT * FROM characters WHERE charname=?",getElementData(playerSource,"char:name")), -1)
- if checkID then
- for i,v in ipairs(checkID) do
- triggerClientEvent(playerSource, "panelCreateClient" ,playerSource, v)
- playerSource:setData("char:bankmoney", v["bankmoney"])
- end
- end
- end
- addEvent("checkBankCards", true)
- addEventHandler("checkBankCards", root, checkBankCardsFunction)
- addEvent("updateToAll",true)
- function updateToAllHandler()
- triggerClientEvent("update",root)
- end
- addEventHandler("updateToAll",root,updateToAllHandler)
- function checkBankCardsFunction(playerSource, money, kivettMoney, type, ATMID, atmMoney)
- if type == 1 then
- if playerSource and tonumber(money) then
- setTimer( function()
- playerSource:setData("char:bankmoney", playerSource:getData("char:bankmoney") - kivettMoney)
- dbExec(connection, "UPDATE characters SET bankmoney=? WHERE charname = ?", money,getElementData(playerSource,"char:name"))
- triggerClientEvent(playerSource, "UpdateClinet", playerSource, money, kivettMoney, 1)
- setElementData(playerSource, "char:money", getElementData(playerSource, "char:money") + kivettMoney)
- end, 502, 1)
- end
- elseif type == 2 then
- if ATMID and tonumber(money) then
- setTimer( function()
- playerSource:setData("char:bankmoney", playerSource:getData("char:bankmoney") - kivettMoney)
- dbExec(connection, "UPDATE characters SET bankmoney=? WHERE charname = ?", money,getElementData(playerSource,"char:name"))
- dbExec(connection, "UPDATE atms SET Money=? WHERE ID = ?", atmMoney,ATMID)
- triggerClientEvent(playerSource, "UpdateClinet", playerSource, money, kivettMoney, 1)
- setElementData(playerSource, "char:money", getElementData(playerSource, "char:money") + kivettMoney)
- end, 502, 1)
- end
- end
- end
- addEvent("penzkivetel", true)
- addEventHandler("penzkivetel", root, checkBankCardsFunction)
- function penzberakasFunction(playerSource, money, kivettMoney)
- if isElement(playerSource) and tonumber(money) then
- setTimer( function()
- setElementData(playerSource, "char:money", getElementData(playerSource, "char:money") - kivettMoney)
- playerSource:setData("char:bankmoney", playerSource:getData("char:bankmoney") + kivettMoney)
- dbExec(connection, "UPDATE characters SET bankmoney=? WHERE charname = ?", money,getElementData(playerSource,"char:name"))
- triggerClientEvent(playerSource, "UpdateClinet", playerSource, money, kivettMoney, 2)
- end, 501, 1)
- end
- end
- addEvent("penzberakas", true)
- addEventHandler("penzberakas", root, penzberakasFunction)
- function payDayServer(playerSource, money, updateMoney)
- if playerSource and tonumber(money) then
- playerSource:setData("char:bankmoney", playerSource:getData("char:bankmoney") + math.floor(money))
- dbExec(connection, "UPDATE characters SET bankmoney=? WHERE charname = ?", tonumber(updateMoney), getElementData(playerSource,"char:name"))
- end
- end
- addEvent("payDayServer", true)
- addEventHandler("payDayServer", root, payDayServer)
- function giveGOV(playerSource, money)
- if tonumber(money) then
- exports.exg_dashboard:giveGroupBalance(29, math.floor(tonumber(money)))
- end
- end
- addEvent("giveGOV", true)
- addEventHandler("giveGOV", root, giveGOV)
- addEvent("paydayExec",true)
- function paydayExecHandler(player)
- dbExec(connection, "UPDATE characters SET paydayMinutes=? WHERE id=?",getElementData(player,"paydayMinutes"),getElementData(player,"acc:id"))
- end
- addEventHandler("paydayExec",root,paydayExecHandler)
- --------------------------------------------------- ATM RABLÁS ---------------------------------------------------
- local width = 1
- local depth = 1
- local height = 0.75
- local festekesArcIdo = 4 -- festékes arc ideje órában
- local theClickObject = createObject(1429,2558.4213867188, -1294.8, 1045.35-1,0,0,0,false)
- setElementDimension(theClickObject,93)
- setElementInterior(theClickObject,2)
- setElementAlpha(theClickObject,0)
- setElementData(theClickObject,"unlockCasette",true)
- addEvent("execTimes2",true)
- function execTimesHandler2(player,leftMinutes)
- local playerID = getElementData(player,"acc:id")
- setElementData(player,"festekesArcIdo",leftMinutes)
- dbExec(connection,"UPDATE characters SET festekesarcPerc=? WHERE id=?",leftMinutes,playerID)
- end
- addEventHandler("execTimes2",root,execTimesHandler2)
- function removefestek(thePlayer, commandName, targetPlayer)
- if getElementData(thePlayer, "acc:admin") >= 7 then
- if not (targetPlayer) then
- outputChatBox("#08c927Használat:#ffffff /" .. commandName .. " [Név / ID]", thePlayer, 255, 255, 255, true)
- else
- local targetPlayer, targetPlayerName = exports.mta_main:findPlayer(thePlayer, targetPlayer)
- if (targetPlayer) then
- setElementData(targetPlayer, "festekes:arc", false)
- setElementData(targetPlayer, "festekesArcIdo", 0)
- outputChatBox("#08c927[Next-Gaming]: #FFFFFFSikeresen leszedted a festéket #08c927" .. targetPlayerName:gsub("_"," ") .. "#FFFFFF arcáról.", thePlayer, 255, 255, 255, true)
- outputChatBox("#08c927[Next-Gaming]: #08c927" .. getPlayerName(thePlayer):gsub("_"," ") .. "#FFFFFF leszedte az arcodról a festéket.", targetPlayer, 255, 255, 255, true)
- execTimesHandler2(targetPlayer,0)
- else
- outputChatBox("#08c927[Next-Gaming]: #FFFFFFNincs ilyen játékos.", thePlayer, 255, 255, 255, true)
- end
- end
- end
- end
- addCommandHandler("removefestek", removefestek, false, false)
- addEvent("cancelFlex",true)
- function cancelFlexHandler(flex,player)
- if isElement(flex) then
- destroyElement(flex)
- end
- setPedAnimation(player)
- triggerClientEvent("cancelFlexhandler",root,player)
- end
- addEventHandler("cancelFlex",root,cancelFlexHandler)
- addEvent("updateFace",true)
- function updateFaceHandler(player)
- local time = festekesArcIdo*60
- local playerID = getElementData(player,"acc:id")
- setElementData(player,"festekesArcIdo",time)
- dbExec(connection,"UPDATE characters SET festekesarcPerc=? WHERE id=?",time,playerID)
- end
- addEventHandler("updateFace",root,updateFaceHandler)
- function quitHandler()
- local player = source
- if (getElementData(player,"myFlex")) then
- local theOwnFlex = getElementData(player,"myFlex")
- triggerClientEvent("quitPlayerHandler",root,player)
- if isElement(theOwnFlex) then
- destroyElement(theOwnFlex)
- end
- end
- if getElementData(player,"festekesArcIdo") then
- local theTimeForUS = getElementData(player,"festekesArcIdo")
- execTimesHandler2(player,theTimeForUS)
- end
- end
- addEventHandler("onPlayerQuit",root,quitHandler)
- addEvent("attachTheElements",true)
- function attachTheElementsHandler(theCriminal)
- local myPed = theCriminal
- triggerClientEvent("attacher",root,myPed)
- end
- addEventHandler("attachTheElements",root,attachTheElementsHandler)
- addEvent("giveCasette",true)
- function giveCasetteHandler(player)
- exports["mta_item"]:giveItem(player, 168, 1, 1, 0)
- end
- addEventHandler("giveCasette",root,giveCasetteHandler)
- addEvent("createPedFlex",true)
- function createPedFlexHandler (player,theATM)
- setPedAnimation( player, "SWORD", "sword_idle", -1, true, false, false)
- local pX, pY, pZ = getElementPosition(player)
- theFlex[player] = createObject(1655, pX, pY, pZ,0,0,0,true)
- local aX, aY, aZ = getElementPosition(theATM)
- setElementData(player,"myFlex",theFlex[player])
- triggerClientEvent("syncFlexSound",root,aX, aY, aZ,player)
- exports.bone_attach:attachElementToBone(theFlex[player],player,12,0,0,0.06,180,90,-90)
- end
- --addCommandHandler("flex",createPedFlexHandler)
- addEventHandler("createPedFlex",root,createPedFlexHandler)
- addEvent("atmRobTexts",true)
- function atmRobTextsHandler(robber,theATM)
- end
- addEventHandler("atmRobTexts",root,atmRobTextsHandler)
- function theSpawnHandler()
- local player = source
- if getElementData(player,"myFirstLogin") then
- if (getElementData(player,"myFirstLogin") == true) then
- setElementData(player,"myFirstLogin",false)
- for i, thePlayers in ipairs(getElementsByType("player")) do
- if getElementData(thePlayers,"underATMRob") then
- if (getElementData(thePlayers,"underATMRob") == true) then
- local robberATM = getElementData(thePlayers,"myATM")
- loginBlipMaker(player,robberATM)
- end
- end
- end
- end
- end
- end
- function atmLoginHandler ()
- local player = source
- setElementData(player,"myFirstLogin",true)
- end
- addEventHandler("onPlayerLogin",root,atmLoginHandler)
- addEvent("syncServerside",true)
- function syncServersideHandler(player,theATM)
- local aX, aY, aZ = getElementPosition(theATM)
- atmBlip[theATM] = createBlip(aX, aY, aZ, 0, 1, 255, 0, 0, 255, 0, 16383.0)
- setElementData(atmBlip[theATM], "tooltipText", "Üzemképtelen ATM")
- for i2, theTarget2 in ipairs(getElementsByType("player")) do
- --setElementVisibleTo(atmBlip[theATM],theTarget2,false)
- end
- for i, theTarget in ipairs(getElementsByType("player")) do
- local inSpecFaction = false
- local check1 = exports.exg_dashboard:isPlayerInFaction(theTarget, 7)
- local check2 = exports.exg_dashboard:isPlayerInFaction(theTarget, 9)
- local check3 = exports.exg_dashboard:isPlayerInFaction(theTarget, 10)
- local check4 = exports.exg_dashboard:isPlayerInFaction(theTarget, 12)
- if check1 or check2 or check3 or check4 then
- inSpecFaction = true
- else
- inSpecFaction = false
- end
- if inSpecFaction then
- --setElementVisibleTo(atmBlip[theATM],theTarget,true)
- end
- end
- end
- addEventHandler("syncServerside",root,syncServersideHandler)
- addEvent("factionCheck",true)
- function factionCheckHandler(player,theATM,robber)
- local atmX, atmY, atmZ = getElementPosition(theATM)
- local theZone = getZoneName(atmX, atmY, atmZ)
- local thetext = "Egy "..theZone.."-i ATM biztonsági rendszere riasztást adott ki! A térképen megjelöltük a koordinátákat! Siess!"
- exports["mta_factionscripts"]:sendGroupMessage(7, "#598ED7[ATM-RABLÁS]: " .. thetext .. "")
- exports["mta_factionscripts"]:sendGroupMessage(9, "#598ED7[ATM-RABLÁS]: " .. thetext .. "")
- exports["mta_factionscripts"]:sendGroupMessage(10, "#598ED7[ATM-RABLÁS]: " .. thetext .. "")
- exports["mta_factionscripts"]:sendGroupMessage(12, "#598ED7[ATM-RABLÁS]: " .. thetext .. "")
- triggerClientEvent("blipMaker",root,theATM)
- end
- addEventHandler("factionCheck",root,factionCheckHandler)
- addEvent("getCasette",true)
- function getCasetteHandler(player)
- setPedAnimation( player, "INT_HOUSE", "wash_up", -1, false, false, false,false)
- end
- addEventHandler("getCasette",root,getCasetteHandler)
- addEvent("endRobHandler",true)
- function endRob(robber)
- for i, theTarget in ipairs(getElementsByType("player")) do
- local inSpecFaction = false
- setPedAnimation( robber)
- local check1 = exports.exg_dashboard:isPlayerInFaction(theTarget, 7)
- local check2 = exports.exg_dashboard:isPlayerInFaction(theTarget, 9)
- local check3 = exports.exg_dashboard:isPlayerInFaction(theTarget, 10)
- local check4 = exports.exg_dashboard:isPlayerInFaction(theTarget, 12)
- if (getElementData(robber,"myFlex")) then
- local theOwnFlex = getElementData(robber,"myFlex")
- if isElement(theOwnFlex) then
- destroyElement(theOwnFlex)
- end
- end
- if check1 or check2 or check3 or check4 then
- inSpecFaction = true
- else
- inSpecFaction = false
- end
- if inSpecFaction then
- local pX, pY, pZ = getElementPosition(robber)
- robberBlip[theTarget] = createBlip(pX, pY, pZ, 0, 1, 104, 205, 50, 255, 0, 16383.0, theTarget)
- triggerClientEvent("stopFlexSound",root,robber)
- setElementData(robberBlip[theTarget], "tooltipText", "Pénzkazetta")
- attachElements(robberBlip[theTarget],robber)
- setTimer(function()
- if isElement(robberBlip[theTarget]) then
- destroyElement(robberBlip[theTarget])
- else
- end
- end,3000,1)
- end
- end
- end
- addEventHandler("endRobHandler",root,endRob)
- addEvent("endRobHandler2",true)
- function endRob2(player,theATM)
- setElementData(theATM,"brokenATM",false)
- local atm = getElementData(player,"myATM")
- if isElement(atmBlip[atm]) then
- destroyElement(atmBlip[atm])
- end
- local fixerName = getElementData(player,"char:name")
- local thetext = "#08C927"..fixerName.."#FFFFFF megjavított egy sérült ATM-et."
- exports["mta_factionscripts"]:sendGroupMessage(7, "#08C927[ATM-RABLÁS]: #FFFFFF" .. thetext .. "")
- exports["mta_factionscripts"]:sendGroupMessage(9, "#08C927[ATM-RABLÁS]: #FFFFFF" .. thetext .. "")
- exports["mta_factionscripts"]:sendGroupMessage(10, "#08C927[ATM-RABLÁS]: #FFFFFF" .. thetext .. "")
- exports["mta_factionscripts"]:sendGroupMessage(12, "#08C927[ATM-RABLÁS]: #FFFFFF" .. thetext .. "")
- end
- addEventHandler("endRobHandler2",root,endRob2)
- addEvent("robberBlipp",true)
- --[[function goColShape(player)
- setElementDimension(player,93)
- setElementInterior(player,2)
- setElementPosition(player,2559.4333496094, -1296.4914550781, 1044.125)
- end
- addCommandHandler("gocol",goColShape)]]
- function clickHandler (button, state, clickedElement, wX, wY, wZ, sX, sY)
- local player = source --2942
- if (button == "left") then
- if (state == "up") then
- if clickedElement then
- if (getElementModel(clickedElement) == 2942) then
- --outputChatBox(tostring(clickedElement))
- local inSpecFaction = false
- local check1 = exports.exg_dashboard:isPlayerInFaction(player, 15)
- local check2 = exports.exg_dashboard:isPlayerInFaction(player, 16)
- local check3 = exports.exg_dashboard:isPlayerInFaction(player, 18)
- local check4 = exports.exg_dashboard:isPlayerInFaction(player, 20)
- local check5 = exports.exg_dashboard:isPlayerInFaction(player, 22)
- local check6 = exports.exg_dashboard:isPlayerInFaction(player, 24)
- local check7 = exports.exg_dashboard:isPlayerInFaction(player, 26)
- local check8 = exports.exg_dashboard:isPlayerInFaction(player, 28)
- local check9 = exports.exg_dashboard:isPlayerInFaction(player, 31)
- if check1 or check2 or check3 or check4 or check5 or check6 or check7 or check8 or check9 then
- inSpecFaction = true
- else
- inSpecFaction = false
- end
- if inSpecFaction then
- local needthisATM = clickedElement
- local pX, pY, pZ = getElementPosition(player)
- local eX, eY, eZ = getElementPosition(clickedElement)
- local dis = getDistanceBetweenPoints3D(pX, pY, pZ, eX, eY, eZ)
- if not (getPedOccupiedVehicle(player)) then
- if (tonumber(dis) <= 1.45) then
- setElementData(player,"myATM",clickedElement)
- if not getElementData(clickedElement,"brokenATM") then
- outputChatBox(tostring(clickedElement))
- local counter = 0
- for i, target in ipairs(getElementsByType("player")) do
- if (exports.exg_dashboard:isPlayerInFaction(target, 7)) or (exports.exg_dashboard:isPlayerInFaction(target, 9)) or (exports.exg_dashboard:isPlayerInFaction(target, 7)) then
- if getElementData(target,"char:duty") then
- if (getElementData(target,"char:duty") == 1) then
- counter = counter + 1
- end
- end
- end
- end
- --if counter >= 1 then
- triggerClientEvent("atmClickHandler",root,player,atmState, sX, sY, needthisATM)
- --else
- -- outputChatBox("#08C927[Next-Gaming]: #FFFFFFMinimum 5 szolgálatban lévő rendőr esetés rabolható!",player,255,255,255,true)
- --end
- else
- if (getElementData(clickedElement,"brokenATM") == true) then
- triggerClientEvent("checkThePanel",root,player,buttonState)
- else
- for i, target in ipairs(getElementsByType("player")) do
- if (exports.exg_dashboard:isPlayerInFaction(target, 7)) or (exports.exg_dashboard:isPlayerInFaction(target, 9)) or (exports.exg_dashboard:isPlayerInFaction(target, 7)) then
- if getElementData(target,"char:duty") then
- if (getElementData(target,"char:duty") == 1) then
- counter = counter + 1
- end
- end
- end
- end
- if counter >= 5 then
- triggerClientEvent("atmClickHandler",root,player,atmState, sX, sY, needthisATM)
- else
- outputChatBox("#08C927[Next-Gaming]: #FFFFFFMinimum 5 szolgálatban lévő rendőr esetés rabolható!",player,255,255,255,true)
- end
- end
- end
- else
- outputChatBox("#08C927[Next-Gaming]: #FFFFFFTúl messze vagy az ATM-től!", player, 255,255,0,true)
- end
- else
- outputChatBox("#08C927[Next-Gaming]: Kocsiból nem!", player, 255,255,0,true)
- end
- end
- end
- if (getElementModel(clickedElement) == 2942) then -- új
- local inSpecFaction = false
- local check1 = exports.exg_dashboard:isPlayerInFaction(player, 7)
- if check1 then
- inSpecFaction = true
- else
- inSpecFaction = false
- end
- if inSpecFaction then
- local needthisATM = clickedElement
- local pX, pY, pZ = getElementPosition(player)
- local eX, eY, eZ = getElementPosition(clickedElement)
- local dis = getDistanceBetweenPoints3D(pX, pY, pZ, eX, eY, eZ)
- if not (getPedOccupiedVehicle(player)) then
- if (tonumber(dis) <= 1.45) then
- if getElementData(clickedElement,"brokenATM") then
- if (getElementData(clickedElement,"brokenATM") == true) then
- setElementData(player,"myATM",clickedElement)
- outputChatBox(tostring(clickedElement))
- triggerClientEvent("atmClickHandler2",root,player,clickedElement,atmState, sX, sY)
- end
- end
- else
- outputChatBox("#08C927[Next-Gaming]: #FFFFFFTúl messze vagy az ATM-től!", player, 255,255,0,true)
- end
- else
- outputChatBox("#08C927[Next-Gaming]: Kocsiból nem!", player, 255,255,0,true)
- end
- end
- end
- if getElementData(clickedElement,"unlockCasette") then
- local inSpecFaction = false
- local check1 = exports.exg_dashboard:isPlayerInFaction(player, 15)
- local check2 = exports.exg_dashboard:isPlayerInFaction(player, 16)
- local check3 = exports.exg_dashboard:isPlayerInFaction(player, 18)
- local check4 = exports.exg_dashboard:isPlayerInFaction(player, 20)
- local check5 = exports.exg_dashboard:isPlayerInFaction(player, 22)
- local check6 = exports.exg_dashboard:isPlayerInFaction(player, 24)
- local check7 = exports.exg_dashboard:isPlayerInFaction(player, 26)
- local check8 = exports.exg_dashboard:isPlayerInFaction(player, 28)
- local check9 = exports.exg_dashboard:isPlayerInFaction(player, 31)
- if check1 or check2 or check3 or check4 or check5 or check6 or check7 or check8 or check9 then
- inSpecFaction = true
- else
- inSpecFaction = false
- end
- if inSpecFaction then
- local unlock3DBlip = getElementData(clickedElement,"unlockCasette")
- if unlock3DBlip then
- local pInt = getElementInterior(player)
- local objectInt = getElementInterior(clickedElement)
- if tonumber(objectInt) == tonumber(pInt) then
- local pDim = getElementDimension(player)
- local objectDim = getElementDimension(clickedElement)
- if tonumber(objectDim) == tonumber(pDim) then
- triggerClientEvent("minigameHandler",root,player)
- end
- end
- end
- end
- end
- if getElementData(clickedElement,"casettePed") then
- if exports.exg_dashboard:isPlayerInFaction(player, 7) then
- exports.mta_item:giveItem(player, 168, 1, 1,1)
- outputChatBox("#08C927[Next-Gaming]: #FFFFFFElkértél egy pénzkazettát.",player,255,255,255,true)
- getCasetteHandler(player)
- else
- outputChatBox("#08C927[Next-Gaming]: #FFFFFFNem vagy rendőr!",player,255,255,255,true)
- end
- end
- end
- end
- end
- end
- addEventHandler("onPlayerClick", root, clickHandler)
- addEvent("blipServerFunction",true)
- function blipServerFunctionHandler(player,theATM)
- local inSpecFaction = false
- local check1 = exports.exg_dashboard:isPlayerInFaction(player, 7)
- local check2 = exports.exg_dashboard:isPlayerInFaction(player, 9)
- local check3 = exports.exg_dashboard:isPlayerInFaction(player, 10)
- local check4 = exports.exg_dashboard:isPlayerInFaction(player, 12)
- if check1 or check2 or check3 or check4 then
- triggerClientEvent("blipMaker2",root,player,theATM)
- end
- end
- addEventHandler("blipServerFunction",root,blipServerFunctionHandler)
- addEvent("panelResponse",true)
- function panelResponseHandler(player,state,buttonState)
- if state then
- elseif not state then
- if (buttonState == "left") and not (exports.exg_dashboard:isPlayerInFaction(player, 7)) then
- outputChatBox("#FF0000[ATM]: #FFFFFFEz az ATM jelenleg üzemképtelen!",player,255,255,255,true)
- end
- end
- end
- addEventHandler("panelResponse",root,panelResponseHandler)
- --[[function robberBlipHandler (player,pX, pY, pZ)
- local inSpecFaction = false
- local check1 = exports.exg_dashboard:isPlayerInFaction(player, 7)
- local check2 = exports.exg_dashboard:isPlayerInFaction(player, 9)
- local check3 = exports.exg_dashboard:isPlayerInFaction(player, 10)
- local check4 = exports.exg_dashboard:isPlayerInFaction(player, 12)
- if check1 or check2 or check3 or check4 then
- inSpecFaction = true
- else
- inSpecFaction = false
- end
- --triggerClientEvent("checkedFaction",root,player,inSpecFaction)
- if inSpecFaction then
- robberBlip = createBlip(pX, pY, pZ, 0, 1, 255,0,0,255,0,16383.0,player)
- end
- end
- addEventHandler("robberBlipp",root,robberBlipHandler)]]
- --------------------------------------------------- ATM RABLÁS ---------------------------------------------------
- -------------------------------------------------------------------------------------<[ ATM ]>-------------------------------------------------------------------------------------
- function atmInfoSetrverFunction(playerSource, ID)
- local checkID = dbPoll(dbQuery(connection, "SELECT * FROM atms WHERE ID=?",ID), -1)
- if checkID then
- for i,v in ipairs(checkID) do
- triggerClientEvent(playerSource, "ATMInfoClinet" ,playerSource, v['Money'])
- end
- end
- end
- addEvent("atmInfoSetrver", true)
- addEventHandler("atmInfoSetrver", root, atmInfoSetrverFunction)
- function onLoadLoadATMs()
- local Query = dbPoll (dbQuery(connection,"SELECT * FROM atms"),-1)
- if (Query) then
- for i, ertek in ipairs(Query) do
- atm_pos = fromJSON(tostring(ertek["Position"])) or "[[ 0,0,0,0,0,0 ]]"
- atm_id = tonumber(ertek["ID"]) or 0
- atm_Money = tonumber(ertek["Money"]) or 0
- AtmObject = createObject(2942,atm_pos[1],atm_pos[2],atm_pos[3]-0.4,atm_pos[4],atm_pos[5],atm_pos[6])
- AtmObject:setData("bank:object",true)
- AtmObject:setData("bank:atm:id",atm_id)
- AtmObject:setData("bank:atm:money",atm_Money)
- end
- end
- end
- addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),onLoadLoadATMs)
- function LerakAtm(jatekos,cmd)
- if (jatekos:getData("acc:admin") >= 6) then
- local x,y,z = getElementPosition(jatekos)
- local rx,ry,rz = getElementRotation(jatekos)
- local Query,rows,beszurid = dbQuery(connection,"INSERT INTO atms SET Position = ?",toJSON({x,y,z,rx,ry,rz})) -- SQL BEszúrás
- local beszurasQueryEredmeny, _, beszurid = dbPoll ( Query, -1 )
- if beszurasQueryEredmeny then
- outputChatBox("#08c927[NextGaming]#FFFFFF ATM sikeresen létrehozva.",jatekos, 255,255, 255, true)
- LoadATMbyID(beszurid)
- end
- end
- end
- addCommandHandler("createatm",LerakAtm)
- function ATMremove( jatekos )
- if (jatekos:getData("acc:admin") >= 5) then
- local x, y, _ = getElementPosition(jatekos)
- local shape = createColCircle ( x,y,3 )
- local atmszam = 0
- for _,v in ipairs(getElementsWithinColShape ( shape, "object" ) ) do
- if getElementData(v, "bank:object") then
- local atmid = v:getData("bank:atm:id")
- atmszam = atmszam + 1
- destroyElement(shape)
- destroyElement(v)
- dbPoll ( dbQuery( connection, "DELETE FROM atms WHERE ID = '?'", atmid), -1 )
- outputChatBox("#08c927[NextGaming]#FFFFFF ATM sikeresen törölve.#08c927 ID#FFFFFF:#08c927"..atmid, jatekos, 0, 0, 0, true)
- return
- end
- end
- if(atmszam == 0) then
- destroyElement(shape)
- outputChatBox("#D24D57[NextGaming]#FFFFFF Nincs ATM a közeledben.", jatekos, 0, 0, 0, true)
- end
- end
- end
- addCommandHandler ( "delatm", ATMremove )
- function LoadATMbyID(id)
- local Query = dbPoll (dbQuery(connection,"SELECT * FROM atms WHERE ID=?",id),-1)
- if (Query) then
- for i, ertek in ipairs(Query) do
- atm_pos = fromJSON(tostring(ertek["Position"])) or "[[ 0,0,0,0,0,0 ]]"
- atm_id = tonumber(ertek["ID"]) or 0
- atm_Money = tonumber(ertek["Money"]) or 0
- AtmObject = createObject(2942,atm_pos[1],atm_pos[2],atm_pos[3]-0.4,atm_pos[4],atm_pos[5],atm_pos[6])
- AtmObject:setData("bank:object",true)
- AtmObject:setData("bank:atm:id",atm_id)
- AtmObject:setData("bank:atm:money",atm_Money)
- end
- end
- end
- function startSpawnCheck()
- Timer = setTimer(TimeCheck, 100, 0)
- end
- local spawnedSzaralak = false
- function TimeCheck()
- local time = getRealTime()
- local hours = time.hour
- local minutes = time.minute
- if hours == 12 or hours == 0 then
- if not spawnedSzaralak then
- for _,v in ipairs(getElementsByType( "object" ) ) do
- if getElementData(v, "bank:object") then
- local atmid = v:getData("bank:atm:id")
- dbExec(connection, "UPDATE atms SET Money=? WHERE ID = ?", tonumber(10000000),atmid)
- spawnedSzaralak = true
- end
- end
- end
- else
- spawnedSzaralak = false
- end
- end
- startSpawnCheck()
- -------------------------------------------------------------------------------------<[ PAY ]>-------------------------------------------------------------------------------------
- addCommandHandler("pay", function(player, cmd, target, amount)
- if not amount then
- outputChatBox("#08c927[NextGaming] #ffffff/pay [Név/ID] [Összeg]", player, 0, 0, 0, true)
- return
- end
- if not tonumber(amount) then return end
- if tonumber(amount) <= 0 then
- outputChatBox("#08c927[NextGaming] #ffffffLegalább 1 dollárt kell átadnod", player, 0, 0, 0, true)
- return
- end
- target, targetName = exports["mta_main"]:findPlayer(player, target)
- if target == player then outputChatBox("#dc143c[Hiba]:#ffffff Magadnak nem tudsz pénzt átadni.", player, 255, 255, 255, true) return end
- if target then
- local playerMoney1 = getElementData(player, "char:money")
- local px, py, pz = getElementPosition(player)
- local tx, ty, tz = getElementPosition(target)
- local distance = getDistanceBetweenPoints3D(px, py, pz, tx, ty, tz)
- if distance > 5 then
- outputChatBox("#08c927[NextGaming] #ffffffTúl távol vagy tőle #08c927("..targetName:gsub("_", " ")..")", player, 0, 0, 0, true)
- return
- end
- amount = tonumber(amount)
- if amount <= playerMoney1 then
- outputChatBox("#08c927[NextGamming - Pay]: #ffffffA pénz átadás 5 másodpercen belül megtörténik.", player, 0, 0, 0, true)
- setTimer(function()
- local px, py, pz = getElementPosition(player)
- local tx, ty, tz = getElementPosition(target)
- local distance = getDistanceBetweenPoints3D(px, py, pz, tx, ty, tz)
- if distance > 5 then
- outputChatBox("#08c927[NextGaming]: #ffffffTúl távol mentél így a folyamat megszakadt.", player, 0, 0, 0, true)
- return
- end
- local playerMoney = getElementData(player, "char:money")
- local targetMoney = getElementData(target, "char:money")
- if playerMoney < amount then
- outputChatBox("#08c927[NextGaming]: #ffffffNincs elég pénz nálad.", player, 0, 0, 0, true)
- return
- end
- setElementData(player, "char:money", playerMoney-amount)
- setElementData(target, "char:money", targetMoney+amount)
- outputChatBox("#08c927[NextGaming] #ffffffÁtadtál #08c927"..amount.." #ffffffdollárt #08c927"..targetName:gsub("_", " ").."#ffffff-nak/nek", player, 0, 0, 0, true)
- outputChatBox("#08c927[NextGaming] #ffffffÁtadott #08c927"..amount.." #ffffffdollárt neked #08c927"..getElementData(player, "char:name"):gsub("_", " "), target, 0, 0, 0, true)
- exports.mta_chat:sendLocalMeAction(player, "átad egy kis pénzt " ..targetName:gsub("_", " ").. "-nak/nek")
- dbExec(connection, adminlog, getPlayerName(player), getElementData(player, "acc:id"), "PAY", getPlayerName(player) .. " átadott " .. amount .. " dollárt " .. getPlayerName(target) .. " játékosnak.", getPlayerName(target), getElementData(target, "acc:id"))
- end, 5000, 1)
- else
- outputChatBox("#08c927[NextGaming] #ffffffNincs ennyi pénzed.", player, 0, 0, 0, true)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement