Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 29.29 KB | None | 0 0
  1. local connection = exports['mta_connection']:getConnection()
  2. local adminlog = "INSERT INTO paylog SET playername=?, playerid=?, tevkod=?, log=?, targetname=?, targetid=?, date=CURDATE(), time=CURTIME()"
  3. -------------------------------------------------------------------------------------<[ BANK ]>-------------------------------------------------------------------------------------
  4. local robberBlip = {}
  5. local theFlex = {}
  6. local atmBlip = {}
  7. local pedX, pedY, pedZ = 1930.0418701172, -1789.4986572266, 13.3828125
  8. local rot1, rot2, rot3 = -0, 0, 266.65075683594
  9. local pedDim = 0
  10. local pedInt = 0
  11. local pedSkin = 60
  12. local pedName = "A RainbowSix egy szar"
  13. local pedNameTags = "Kazetta"
  14. local casettePed = createPed(pedSkin, pedX, pedY, pedZ)
  15. setElementRotation(casettePed,rot1, rot2, rot3)
  16. setElementDimension(casettePed,pedDim)
  17. setElementInterior(casettePed,pedInt)
  18. setElementData(casettePed,"casettePed",true)
  19. setElementFrozen(casettePed,true)
  20. setElementData(casettePed,"ped:name",pedName)
  21. setElementData(casettePed,"name:tags",pedNameTags)
  22.  
  23. function checkBankCardsFunction(playerSource)
  24.     local checkID = dbPoll(dbQuery(connection, "SELECT * FROM characters WHERE charname=?",getElementData(playerSource,"char:name")), -1)
  25.         if checkID then
  26.         for i,v in ipairs(checkID) do
  27.             triggerClientEvent(playerSource, "panelCreateClient" ,playerSource, v)
  28.             playerSource:setData("char:bankmoney", v["bankmoney"])
  29.         end
  30.     end
  31. end
  32. addEvent("checkBankCards", true)
  33. addEventHandler("checkBankCards", root, checkBankCardsFunction)
  34. addEvent("updateToAll",true)
  35. function updateToAllHandler()
  36.     triggerClientEvent("update",root)
  37. end
  38. addEventHandler("updateToAll",root,updateToAllHandler)
  39.  
  40.  
  41. function checkBankCardsFunction(playerSource, money, kivettMoney, type, ATMID, atmMoney)
  42.     if type == 1 then
  43.         if playerSource and tonumber(money) then
  44.             setTimer( function()
  45.                 playerSource:setData("char:bankmoney", playerSource:getData("char:bankmoney") - kivettMoney)
  46.                 dbExec(connection, "UPDATE characters SET bankmoney=? WHERE charname = ?", money,getElementData(playerSource,"char:name"))
  47.                 triggerClientEvent(playerSource, "UpdateClinet", playerSource, money, kivettMoney, 1)
  48.                 setElementData(playerSource, "char:money", getElementData(playerSource, "char:money") + kivettMoney)
  49.             end, 502, 1)
  50.         end
  51.     elseif type == 2 then
  52.         if ATMID and tonumber(money) then
  53.             setTimer( function()
  54.                 playerSource:setData("char:bankmoney", playerSource:getData("char:bankmoney") - kivettMoney)
  55.                 dbExec(connection, "UPDATE characters SET bankmoney=? WHERE charname = ?", money,getElementData(playerSource,"char:name"))
  56.                 dbExec(connection, "UPDATE atms SET Money=? WHERE ID = ?", atmMoney,ATMID)
  57.                 triggerClientEvent(playerSource, "UpdateClinet", playerSource, money, kivettMoney, 1)
  58.                 setElementData(playerSource, "char:money", getElementData(playerSource, "char:money") + kivettMoney)
  59.             end, 502, 1)
  60.         end
  61.     end
  62. end
  63. addEvent("penzkivetel", true)
  64. addEventHandler("penzkivetel", root, checkBankCardsFunction)
  65.  
  66. function penzberakasFunction(playerSource, money, kivettMoney)
  67.     if isElement(playerSource) and tonumber(money) then
  68.         setTimer( function()
  69.             setElementData(playerSource, "char:money", getElementData(playerSource, "char:money") - kivettMoney)
  70.             playerSource:setData("char:bankmoney", playerSource:getData("char:bankmoney") + kivettMoney)
  71.             dbExec(connection, "UPDATE characters SET bankmoney=? WHERE charname = ?", money,getElementData(playerSource,"char:name"))
  72.             triggerClientEvent(playerSource, "UpdateClinet", playerSource, money, kivettMoney, 2)
  73.         end, 501, 1)
  74.     end
  75. end
  76. addEvent("penzberakas", true)
  77. addEventHandler("penzberakas", root, penzberakasFunction)
  78.  
  79. function payDayServer(playerSource, money, updateMoney)
  80.     if playerSource and tonumber(money) then
  81.         playerSource:setData("char:bankmoney", playerSource:getData("char:bankmoney") + math.floor(money))
  82.         dbExec(connection, "UPDATE characters SET bankmoney=? WHERE charname = ?", tonumber(updateMoney), getElementData(playerSource,"char:name"))
  83.     end
  84. end
  85. addEvent("payDayServer", true)
  86. addEventHandler("payDayServer", root, payDayServer)
  87.  
  88. function giveGOV(playerSource, money)
  89.     if  tonumber(money) then
  90.         exports.exg_dashboard:giveGroupBalance(29, math.floor(tonumber(money)))
  91.     end
  92. end
  93. addEvent("giveGOV", true)
  94. addEventHandler("giveGOV", root, giveGOV)
  95.  
  96.  
  97.  
  98. addEvent("paydayExec",true)
  99. function paydayExecHandler(player)
  100.     dbExec(connection, "UPDATE characters SET paydayMinutes=? WHERE id=?",getElementData(player,"paydayMinutes"),getElementData(player,"acc:id"))
  101. end
  102. addEventHandler("paydayExec",root,paydayExecHandler)
  103.  
  104.  
  105.     --------------------------------------------------- ATM RABLÁS ---------------------------------------------------
  106. local width = 1
  107. local depth = 1
  108. local height = 0.75
  109. local festekesArcIdo = 4 -- festékes arc ideje órában
  110. local theClickObject = createObject(1429,2558.4213867188, -1294.8, 1045.35-1,0,0,0,false)
  111. setElementDimension(theClickObject,93)
  112. setElementInterior(theClickObject,2)
  113. setElementAlpha(theClickObject,0)
  114. setElementData(theClickObject,"unlockCasette",true)
  115.  
  116. addEvent("execTimes2",true)
  117. function execTimesHandler2(player,leftMinutes)
  118.     local playerID = getElementData(player,"acc:id")
  119.     setElementData(player,"festekesArcIdo",leftMinutes)
  120.     dbExec(connection,"UPDATE characters SET festekesarcPerc=? WHERE id=?",leftMinutes,playerID)
  121. end
  122. addEventHandler("execTimes2",root,execTimesHandler2)
  123.  
  124. function removefestek(thePlayer, commandName, targetPlayer)
  125.     if getElementData(thePlayer, "acc:admin") >= 7 then
  126.         if not (targetPlayer) then
  127.             outputChatBox("#08c927Használat:#ffffff /" .. commandName .. " [Név / ID]", thePlayer, 255, 255, 255, true)
  128.         else
  129.             local targetPlayer, targetPlayerName = exports.mta_main:findPlayer(thePlayer, targetPlayer)
  130.             if (targetPlayer) then
  131.                 setElementData(targetPlayer, "festekes:arc", false)
  132.                 setElementData(targetPlayer, "festekesArcIdo", 0)
  133.                 outputChatBox("#08c927[Next-Gaming]: #FFFFFFSikeresen leszedted a festéket #08c927" .. targetPlayerName:gsub("_"," ") .. "#FFFFFF arcáról.", thePlayer, 255, 255, 255, true)
  134.                 outputChatBox("#08c927[Next-Gaming]: #08c927" .. getPlayerName(thePlayer):gsub("_"," ") .. "#FFFFFF leszedte az arcodról a festéket.", targetPlayer, 255, 255, 255, true)
  135.                 execTimesHandler2(targetPlayer,0)
  136.             else
  137.                 outputChatBox("#08c927[Next-Gaming]: #FFFFFFNincs ilyen játékos.", thePlayer, 255, 255, 255, true)
  138.             end
  139.         end
  140.     end
  141. end
  142. addCommandHandler("removefestek", removefestek, false, false)
  143.  
  144.  
  145.  
  146. addEvent("cancelFlex",true)
  147. function cancelFlexHandler(flex,player)
  148.     if isElement(flex) then
  149.         destroyElement(flex)
  150.     end
  151.     setPedAnimation(player)
  152.     triggerClientEvent("cancelFlexhandler",root,player)
  153. end
  154. addEventHandler("cancelFlex",root,cancelFlexHandler)
  155.  
  156. addEvent("updateFace",true)
  157. function updateFaceHandler(player)
  158.     local time = festekesArcIdo*60
  159.     local playerID = getElementData(player,"acc:id")
  160.     setElementData(player,"festekesArcIdo",time)
  161.     dbExec(connection,"UPDATE characters SET festekesarcPerc=? WHERE id=?",time,playerID)
  162. end
  163. addEventHandler("updateFace",root,updateFaceHandler)
  164.  
  165.  
  166. function quitHandler()
  167.     local player = source
  168.     if (getElementData(player,"myFlex")) then
  169.         local theOwnFlex = getElementData(player,"myFlex")
  170.         triggerClientEvent("quitPlayerHandler",root,player)
  171.         if isElement(theOwnFlex) then
  172.             destroyElement(theOwnFlex)
  173.         end
  174.  
  175.     end
  176.     if getElementData(player,"festekesArcIdo") then
  177.         local theTimeForUS = getElementData(player,"festekesArcIdo")
  178.         execTimesHandler2(player,theTimeForUS)
  179.     end
  180.    
  181. end
  182. addEventHandler("onPlayerQuit",root,quitHandler)
  183.  
  184. addEvent("attachTheElements",true)
  185. function attachTheElementsHandler(theCriminal)
  186.     local myPed = theCriminal
  187.     triggerClientEvent("attacher",root,myPed)
  188. end
  189. addEventHandler("attachTheElements",root,attachTheElementsHandler)
  190.  
  191. addEvent("giveCasette",true)
  192. function giveCasetteHandler(player)
  193.     exports["mta_item"]:giveItem(player, 168, 1, 1, 0)
  194. end
  195. addEventHandler("giveCasette",root,giveCasetteHandler)
  196.  
  197.  
  198.  
  199. addEvent("createPedFlex",true)
  200. function createPedFlexHandler (player,theATM)
  201.     setPedAnimation( player, "SWORD", "sword_idle", -1, true, false, false)
  202.  
  203.     local pX, pY, pZ = getElementPosition(player)
  204.     theFlex[player] = createObject(1655, pX, pY, pZ,0,0,0,true)
  205.     local aX, aY, aZ = getElementPosition(theATM)
  206.     setElementData(player,"myFlex",theFlex[player])
  207.     triggerClientEvent("syncFlexSound",root,aX, aY, aZ,player)
  208.     exports.bone_attach:attachElementToBone(theFlex[player],player,12,0,0,0.06,180,90,-90)
  209. end
  210. --addCommandHandler("flex",createPedFlexHandler)
  211. addEventHandler("createPedFlex",root,createPedFlexHandler)
  212.  
  213.  
  214. addEvent("atmRobTexts",true)
  215. function atmRobTextsHandler(robber,theATM)
  216.    
  217. end
  218. addEventHandler("atmRobTexts",root,atmRobTextsHandler)
  219.  
  220. function theSpawnHandler()
  221.     local player = source
  222.     if getElementData(player,"myFirstLogin") then
  223.         if (getElementData(player,"myFirstLogin") == true) then
  224.             setElementData(player,"myFirstLogin",false)
  225.             for i, thePlayers in ipairs(getElementsByType("player")) do
  226.                 if getElementData(thePlayers,"underATMRob") then
  227.                     if (getElementData(thePlayers,"underATMRob") == true) then
  228.                         local robberATM = getElementData(thePlayers,"myATM")
  229.                         loginBlipMaker(player,robberATM)
  230.                     end
  231.                 end
  232.             end
  233.         end
  234.     end
  235. end
  236.  
  237. function atmLoginHandler ()
  238.     local player = source
  239.     setElementData(player,"myFirstLogin",true)
  240. end
  241.  
  242.  
  243. addEventHandler("onPlayerLogin",root,atmLoginHandler)
  244.  
  245. addEvent("syncServerside",true)
  246. function syncServersideHandler(player,theATM)
  247.     local aX, aY, aZ = getElementPosition(theATM)
  248.     atmBlip[theATM] = createBlip(aX, aY, aZ, 0, 1, 255, 0, 0, 255, 0, 16383.0)
  249.     setElementData(atmBlip[theATM], "tooltipText", "Üzemképtelen ATM")
  250.     for i2, theTarget2 in ipairs(getElementsByType("player")) do
  251.         --setElementVisibleTo(atmBlip[theATM],theTarget2,false)
  252.     end
  253.     for i, theTarget in ipairs(getElementsByType("player")) do
  254.         local inSpecFaction = false
  255.         local check1 = exports.exg_dashboard:isPlayerInFaction(theTarget, 7)
  256.         local check2 = exports.exg_dashboard:isPlayerInFaction(theTarget, 9)
  257.         local check3 = exports.exg_dashboard:isPlayerInFaction(theTarget, 10)
  258.         local check4 = exports.exg_dashboard:isPlayerInFaction(theTarget, 12)
  259.         if check1 or check2 or check3 or check4 then
  260.             inSpecFaction = true
  261.         else
  262.             inSpecFaction = false
  263.         end
  264.         if inSpecFaction then
  265.             --setElementVisibleTo(atmBlip[theATM],theTarget,true)
  266.         end
  267.     end
  268. end
  269. addEventHandler("syncServerside",root,syncServersideHandler)
  270.  
  271. addEvent("factionCheck",true)
  272. function factionCheckHandler(player,theATM,robber)
  273.     local atmX, atmY, atmZ = getElementPosition(theATM)
  274.     local theZone = getZoneName(atmX, atmY, atmZ)
  275.     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!"
  276.     exports["mta_factionscripts"]:sendGroupMessage(7, "#598ED7[ATM-RABLÁS]: " .. thetext .. "")
  277.     exports["mta_factionscripts"]:sendGroupMessage(9, "#598ED7[ATM-RABLÁS]: " .. thetext .. "")
  278.     exports["mta_factionscripts"]:sendGroupMessage(10, "#598ED7[ATM-RABLÁS]: " .. thetext .. "")
  279.     exports["mta_factionscripts"]:sendGroupMessage(12, "#598ED7[ATM-RABLÁS]: " .. thetext .. "")
  280.     triggerClientEvent("blipMaker",root,theATM)
  281. end
  282. addEventHandler("factionCheck",root,factionCheckHandler)
  283.  
  284. addEvent("getCasette",true)
  285. function getCasetteHandler(player)
  286.     setPedAnimation( player, "INT_HOUSE", "wash_up", -1, false, false, false,false)
  287. end
  288. addEventHandler("getCasette",root,getCasetteHandler)
  289.  
  290. addEvent("endRobHandler",true)
  291. function endRob(robber)
  292.     for i, theTarget in ipairs(getElementsByType("player")) do
  293.         local inSpecFaction = false
  294.         setPedAnimation( robber)
  295.         local check1 = exports.exg_dashboard:isPlayerInFaction(theTarget, 7)
  296.         local check2 = exports.exg_dashboard:isPlayerInFaction(theTarget, 9)
  297.         local check3 = exports.exg_dashboard:isPlayerInFaction(theTarget, 10)
  298.         local check4 = exports.exg_dashboard:isPlayerInFaction(theTarget, 12)
  299.         if (getElementData(robber,"myFlex")) then
  300.             local theOwnFlex = getElementData(robber,"myFlex")
  301.             if isElement(theOwnFlex) then
  302.                 destroyElement(theOwnFlex)
  303.             end
  304.         end
  305.         if check1 or check2 or check3 or check4 then
  306.             inSpecFaction = true
  307.         else
  308.             inSpecFaction = false
  309.         end
  310.         if inSpecFaction then
  311.             local pX, pY, pZ = getElementPosition(robber)
  312.             robberBlip[theTarget] = createBlip(pX, pY, pZ, 0, 1, 104, 205, 50, 255, 0, 16383.0, theTarget)
  313.             triggerClientEvent("stopFlexSound",root,robber)
  314.             setElementData(robberBlip[theTarget], "tooltipText", "Pénzkazetta")
  315.             attachElements(robberBlip[theTarget],robber)
  316.             setTimer(function()
  317.                         if isElement(robberBlip[theTarget]) then
  318.                             destroyElement(robberBlip[theTarget])
  319.                         else
  320.                         end
  321.                     end,3000,1)
  322.            
  323.         end
  324.     end
  325.  
  326. end
  327. addEventHandler("endRobHandler",root,endRob)
  328.  
  329. addEvent("endRobHandler2",true)
  330. function endRob2(player,theATM)
  331.     setElementData(theATM,"brokenATM",false)
  332.     local atm = getElementData(player,"myATM")
  333.     if isElement(atmBlip[atm]) then
  334.         destroyElement(atmBlip[atm])
  335.     end
  336.     local fixerName = getElementData(player,"char:name")
  337.     local thetext = "#08C927"..fixerName.."#FFFFFF megjavított egy sérült ATM-et."
  338.     exports["mta_factionscripts"]:sendGroupMessage(7, "#08C927[ATM-RABLÁS]: #FFFFFF" .. thetext .. "")
  339.     exports["mta_factionscripts"]:sendGroupMessage(9, "#08C927[ATM-RABLÁS]: #FFFFFF" .. thetext .. "")
  340.     exports["mta_factionscripts"]:sendGroupMessage(10, "#08C927[ATM-RABLÁS]: #FFFFFF" .. thetext .. "")
  341.     exports["mta_factionscripts"]:sendGroupMessage(12, "#08C927[ATM-RABLÁS]: #FFFFFF" .. thetext .. "")
  342.  
  343. end
  344. addEventHandler("endRobHandler2",root,endRob2)
  345.  
  346.  
  347. addEvent("robberBlipp",true)
  348.  
  349. --[[function goColShape(player)
  350.     setElementDimension(player,93)
  351.     setElementInterior(player,2)
  352.     setElementPosition(player,2559.4333496094, -1296.4914550781, 1044.125)
  353. end
  354. addCommandHandler("gocol",goColShape)]]
  355.  
  356. function clickHandler (button, state, clickedElement, wX, wY, wZ, sX, sY)
  357. local player = source --2942
  358.     if (button == "left") then
  359.         if (state == "up") then
  360.             if clickedElement then
  361.                 if (getElementModel(clickedElement) == 2942) then
  362.                     --outputChatBox(tostring(clickedElement))
  363.                     local inSpecFaction = false
  364.                     local check1 = exports.exg_dashboard:isPlayerInFaction(player, 15)
  365.                     local check2 = exports.exg_dashboard:isPlayerInFaction(player, 16)
  366.                     local check3 = exports.exg_dashboard:isPlayerInFaction(player, 18)
  367.                     local check4 = exports.exg_dashboard:isPlayerInFaction(player, 20)
  368.                     local check5 = exports.exg_dashboard:isPlayerInFaction(player, 22)
  369.                     local check6 = exports.exg_dashboard:isPlayerInFaction(player, 24)
  370.                     local check7 = exports.exg_dashboard:isPlayerInFaction(player, 26)
  371.                     local check8 = exports.exg_dashboard:isPlayerInFaction(player, 28)
  372.                     local check9 = exports.exg_dashboard:isPlayerInFaction(player, 31)
  373.                     if check1 or check2 or check3 or check4 or check5  or check6  or check7  or check8  or check9 then
  374.                         inSpecFaction = true
  375.                     else
  376.                         inSpecFaction = false
  377.                     end
  378.                     if inSpecFaction then
  379.  
  380.                         local needthisATM = clickedElement
  381.                         local pX, pY, pZ = getElementPosition(player)
  382.                         local eX, eY, eZ = getElementPosition(clickedElement)
  383.                         local dis = getDistanceBetweenPoints3D(pX, pY, pZ, eX, eY, eZ)
  384.                         if not (getPedOccupiedVehicle(player)) then
  385.                             if (tonumber(dis) <= 1.45) then
  386.                                 setElementData(player,"myATM",clickedElement)
  387.                                 if not getElementData(clickedElement,"brokenATM") then
  388.                                     outputChatBox(tostring(clickedElement))
  389.                                     local counter = 0
  390.                                     for i, target in ipairs(getElementsByType("player")) do
  391.                                         if (exports.exg_dashboard:isPlayerInFaction(target, 7)) or (exports.exg_dashboard:isPlayerInFaction(target, 9)) or (exports.exg_dashboard:isPlayerInFaction(target, 7)) then
  392.                                             if getElementData(target,"char:duty") then
  393.                                                 if (getElementData(target,"char:duty") == 1) then
  394.                                                     counter = counter + 1
  395.                                                 end
  396.                                             end
  397.                                         end
  398.                                     end
  399.                                     --if counter >= 1 then
  400.                                         triggerClientEvent("atmClickHandler",root,player,atmState, sX, sY, needthisATM)
  401.                                     --else
  402.                                     --  outputChatBox("#08C927[Next-Gaming]: #FFFFFFMinimum 5 szolgálatban lévő rendőr esetés rabolható!",player,255,255,255,true)
  403.                                     --end
  404.                                 else
  405.                                     if (getElementData(clickedElement,"brokenATM") == true) then
  406.                                         triggerClientEvent("checkThePanel",root,player,buttonState)
  407.                                     else
  408.                                         for i, target in ipairs(getElementsByType("player")) do
  409.                                             if (exports.exg_dashboard:isPlayerInFaction(target, 7)) or (exports.exg_dashboard:isPlayerInFaction(target, 9)) or (exports.exg_dashboard:isPlayerInFaction(target, 7)) then
  410.                                                 if getElementData(target,"char:duty") then
  411.                                                     if (getElementData(target,"char:duty") == 1) then
  412.                                                         counter = counter + 1
  413.                                                     end
  414.                                                 end
  415.                                             end
  416.                                         end
  417.                                         if counter >= 5 then
  418.                                             triggerClientEvent("atmClickHandler",root,player,atmState, sX, sY, needthisATM)
  419.                                         else
  420.                                             outputChatBox("#08C927[Next-Gaming]: #FFFFFFMinimum 5 szolgálatban lévő rendőr esetés rabolható!",player,255,255,255,true)
  421.                                         end
  422.                                     end
  423.                                 end
  424.                             else
  425.                                 outputChatBox("#08C927[Next-Gaming]: #FFFFFFTúl messze vagy az ATM-től!", player, 255,255,0,true)
  426.                             end
  427.                         else
  428.                             outputChatBox("#08C927[Next-Gaming]: Kocsiból nem!", player, 255,255,0,true)
  429.                         end
  430.                     end
  431.                 end
  432.                 if (getElementModel(clickedElement) == 2942) then -- új
  433.                     local inSpecFaction = false
  434.                     local check1 = exports.exg_dashboard:isPlayerInFaction(player, 7)
  435.                     if check1 then
  436.                         inSpecFaction = true
  437.                     else
  438.                         inSpecFaction = false
  439.                     end
  440.                     if inSpecFaction then
  441.  
  442.                         local needthisATM = clickedElement
  443.                         local pX, pY, pZ = getElementPosition(player)
  444.                         local eX, eY, eZ = getElementPosition(clickedElement)
  445.                         local dis = getDistanceBetweenPoints3D(pX, pY, pZ, eX, eY, eZ)
  446.                         if not (getPedOccupiedVehicle(player)) then
  447.                             if (tonumber(dis) <= 1.45) then
  448.                                 if getElementData(clickedElement,"brokenATM") then
  449.                                     if (getElementData(clickedElement,"brokenATM") == true) then
  450.                                         setElementData(player,"myATM",clickedElement)
  451.                                         outputChatBox(tostring(clickedElement))
  452.                                         triggerClientEvent("atmClickHandler2",root,player,clickedElement,atmState, sX, sY)
  453.                                     end
  454.                                 end
  455.                             else
  456.                                 outputChatBox("#08C927[Next-Gaming]: #FFFFFFTúl messze vagy az ATM-től!", player, 255,255,0,true)
  457.                             end
  458.                         else
  459.                             outputChatBox("#08C927[Next-Gaming]: Kocsiból nem!", player, 255,255,0,true)
  460.                         end
  461.                     end
  462.                 end
  463.                 if getElementData(clickedElement,"unlockCasette") then
  464.                     local inSpecFaction = false
  465.                     local check1 = exports.exg_dashboard:isPlayerInFaction(player, 15)
  466.                     local check2 = exports.exg_dashboard:isPlayerInFaction(player, 16)
  467.                     local check3 = exports.exg_dashboard:isPlayerInFaction(player, 18)
  468.                     local check4 = exports.exg_dashboard:isPlayerInFaction(player, 20)
  469.                     local check5 = exports.exg_dashboard:isPlayerInFaction(player, 22)
  470.                     local check6 = exports.exg_dashboard:isPlayerInFaction(player, 24)
  471.                     local check7 = exports.exg_dashboard:isPlayerInFaction(player, 26)
  472.                     local check8 = exports.exg_dashboard:isPlayerInFaction(player, 28)
  473.                     local check9 = exports.exg_dashboard:isPlayerInFaction(player, 31)
  474.                     if check1 or check2 or check3 or check4 or check5  or check6  or check7  or check8  or check9 then
  475.                         inSpecFaction = true
  476.                     else
  477.                         inSpecFaction = false
  478.                     end
  479.                     if inSpecFaction then
  480.                         local unlock3DBlip = getElementData(clickedElement,"unlockCasette")
  481.                         if unlock3DBlip then
  482.                             local pInt = getElementInterior(player)
  483.                             local objectInt = getElementInterior(clickedElement)
  484.                             if tonumber(objectInt) == tonumber(pInt) then
  485.                                 local pDim = getElementDimension(player)
  486.                                 local objectDim = getElementDimension(clickedElement)
  487.                                 if tonumber(objectDim) == tonumber(pDim) then
  488.                                     triggerClientEvent("minigameHandler",root,player)
  489.                                 end
  490.                             end
  491.                         end
  492.                     end
  493.                 end
  494.                 if getElementData(clickedElement,"casettePed") then
  495.                     if exports.exg_dashboard:isPlayerInFaction(player, 7) then
  496.                         exports.mta_item:giveItem(player, 168, 1, 1,1)
  497.                         outputChatBox("#08C927[Next-Gaming]: #FFFFFFElkértél egy pénzkazettát.",player,255,255,255,true)
  498.                         getCasetteHandler(player)
  499.                     else
  500.                         outputChatBox("#08C927[Next-Gaming]: #FFFFFFNem vagy rendőr!",player,255,255,255,true)
  501.                     end
  502.                 end
  503.             end
  504.         end
  505.     end
  506. end
  507. addEventHandler("onPlayerClick", root, clickHandler)
  508.  
  509. addEvent("blipServerFunction",true)
  510. function blipServerFunctionHandler(player,theATM)
  511.     local inSpecFaction = false
  512.     local check1 = exports.exg_dashboard:isPlayerInFaction(player, 7)
  513.     local check2 = exports.exg_dashboard:isPlayerInFaction(player, 9)
  514.     local check3 = exports.exg_dashboard:isPlayerInFaction(player, 10)
  515.     local check4 = exports.exg_dashboard:isPlayerInFaction(player, 12)
  516.     if check1 or check2 or check3 or check4 then
  517.         triggerClientEvent("blipMaker2",root,player,theATM)
  518.     end
  519. end
  520. addEventHandler("blipServerFunction",root,blipServerFunctionHandler)
  521.  
  522. addEvent("panelResponse",true)
  523. function panelResponseHandler(player,state,buttonState)
  524.     if state then
  525.  
  526.     elseif not state then
  527.         if  (buttonState == "left") and not (exports.exg_dashboard:isPlayerInFaction(player, 7)) then
  528.             outputChatBox("#FF0000[ATM]: #FFFFFFEz az ATM jelenleg üzemképtelen!",player,255,255,255,true)
  529.         end
  530.     end
  531. end
  532. addEventHandler("panelResponse",root,panelResponseHandler)
  533. --[[function robberBlipHandler (player,pX, pY, pZ)
  534.     local inSpecFaction = false
  535.     local check1 = exports.exg_dashboard:isPlayerInFaction(player, 7)
  536.     local check2 = exports.exg_dashboard:isPlayerInFaction(player, 9)
  537.     local check3 = exports.exg_dashboard:isPlayerInFaction(player, 10)
  538.     local check4 = exports.exg_dashboard:isPlayerInFaction(player, 12)
  539.    
  540.     if check1 or check2 or check3 or check4 then
  541.         inSpecFaction = true
  542.     else
  543.         inSpecFaction = false
  544.     end
  545.     --triggerClientEvent("checkedFaction",root,player,inSpecFaction)
  546.     if inSpecFaction then
  547.         robberBlip = createBlip(pX, pY, pZ, 0, 1, 255,0,0,255,0,16383.0,player)
  548.     end
  549.  
  550. end
  551. addEventHandler("robberBlipp",root,robberBlipHandler)]]
  552.     --------------------------------------------------- ATM RABLÁS ---------------------------------------------------
  553.  
  554. -------------------------------------------------------------------------------------<[ ATM ]>-------------------------------------------------------------------------------------
  555.  
  556. function atmInfoSetrverFunction(playerSource, ID)
  557.     local checkID = dbPoll(dbQuery(connection, "SELECT * FROM atms WHERE ID=?",ID), -1)
  558.         if checkID then
  559.         for i,v in ipairs(checkID) do
  560.             triggerClientEvent(playerSource, "ATMInfoClinet" ,playerSource, v['Money'])
  561.         end
  562.     end
  563. end
  564. addEvent("atmInfoSetrver", true)
  565. addEventHandler("atmInfoSetrver", root, atmInfoSetrverFunction)
  566.  
  567. function onLoadLoadATMs()
  568.     local Query = dbPoll (dbQuery(connection,"SELECT * FROM atms"),-1)
  569.     if (Query) then
  570.         for i, ertek in ipairs(Query) do
  571.             atm_pos = fromJSON(tostring(ertek["Position"])) or "[[ 0,0,0,0,0,0 ]]"
  572.             atm_id = tonumber(ertek["ID"]) or 0
  573.             atm_Money = tonumber(ertek["Money"]) or 0
  574.            
  575.             AtmObject = createObject(2942,atm_pos[1],atm_pos[2],atm_pos[3]-0.4,atm_pos[4],atm_pos[5],atm_pos[6])
  576.             AtmObject:setData("bank:object",true)
  577.             AtmObject:setData("bank:atm:id",atm_id)
  578.             AtmObject:setData("bank:atm:money",atm_Money)
  579.         end
  580.     end
  581. end
  582. addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),onLoadLoadATMs)
  583.  
  584. function LerakAtm(jatekos,cmd)
  585.     if (jatekos:getData("acc:admin") >= 6) then
  586.         local x,y,z = getElementPosition(jatekos)
  587.         local rx,ry,rz = getElementRotation(jatekos)
  588.        
  589.         local Query,rows,beszurid = dbQuery(connection,"INSERT INTO atms SET Position = ?",toJSON({x,y,z,rx,ry,rz})) -- SQL BEszúrás 
  590.         local beszurasQueryEredmeny, _, beszurid = dbPoll ( Query, -1 )
  591.         if beszurasQueryEredmeny then
  592.             outputChatBox("#08c927[NextGaming]#FFFFFF ATM sikeresen létrehozva.",jatekos, 255,255, 255, true)
  593.             LoadATMbyID(beszurid)
  594.         end
  595.     end
  596. end
  597. addCommandHandler("createatm",LerakAtm)
  598.  
  599. function ATMremove( jatekos )
  600.     if (jatekos:getData("acc:admin") >= 5) then
  601.         local x, y, _ = getElementPosition(jatekos)
  602.         local shape = createColCircle ( x,y,3 )
  603.         local atmszam = 0
  604.         for _,v in ipairs(getElementsWithinColShape ( shape, "object" ) ) do
  605.              if getElementData(v, "bank:object")  then
  606.                 local atmid = v:getData("bank:atm:id")
  607.                 atmszam = atmszam + 1
  608.                 destroyElement(shape)
  609.                 destroyElement(v)
  610.                 dbPoll ( dbQuery( connection, "DELETE FROM atms WHERE ID = '?'", atmid), -1 )
  611.                 outputChatBox("#08c927[NextGaming]#FFFFFF ATM sikeresen törölve.#08c927 ID#FFFFFF:#08c927"..atmid, jatekos, 0, 0, 0, true)
  612.                 return
  613.             end
  614.         end
  615.         if(atmszam == 0) then
  616.             destroyElement(shape)
  617.             outputChatBox("#D24D57[NextGaming]#FFFFFF Nincs ATM a közeledben.", jatekos, 0, 0, 0, true)
  618.         end
  619.     end
  620. end
  621. addCommandHandler ( "delatm", ATMremove )
  622.  
  623. function LoadATMbyID(id)
  624.     local Query = dbPoll (dbQuery(connection,"SELECT * FROM atms WHERE ID=?",id),-1)
  625.     if (Query) then
  626.         for i, ertek in ipairs(Query) do
  627.             atm_pos = fromJSON(tostring(ertek["Position"])) or "[[ 0,0,0,0,0,0 ]]"
  628.             atm_id = tonumber(ertek["ID"]) or 0
  629.             atm_Money = tonumber(ertek["Money"]) or 0
  630.            
  631.             AtmObject = createObject(2942,atm_pos[1],atm_pos[2],atm_pos[3]-0.4,atm_pos[4],atm_pos[5],atm_pos[6])
  632.             AtmObject:setData("bank:object",true)
  633.             AtmObject:setData("bank:atm:id",atm_id)
  634.             AtmObject:setData("bank:atm:money",atm_Money)
  635.         end
  636.     end
  637. end
  638.  
  639. function startSpawnCheck()
  640.     Timer = setTimer(TimeCheck, 100, 0)
  641. end
  642. local spawnedSzaralak = false
  643.  
  644. function TimeCheck()
  645.     local time = getRealTime()
  646.     local hours = time.hour
  647.     local minutes = time.minute
  648.     if hours == 12 or hours == 0 then
  649.         if not spawnedSzaralak then
  650.                 for _,v in ipairs(getElementsByType( "object" ) ) do
  651.                 if getElementData(v, "bank:object")  then
  652.                     local atmid = v:getData("bank:atm:id")
  653.                     dbExec(connection, "UPDATE atms SET Money=? WHERE ID = ?", tonumber(10000000),atmid)
  654.                     spawnedSzaralak = true
  655.                 end
  656.             end
  657.         end
  658.     else
  659.         spawnedSzaralak = false
  660.     end
  661. end
  662. startSpawnCheck()
  663.  
  664. -------------------------------------------------------------------------------------<[ PAY ]>-------------------------------------------------------------------------------------
  665. addCommandHandler("pay", function(player, cmd, target, amount)
  666.     if not amount then
  667.         outputChatBox("#08c927[NextGaming] #ffffff/pay [Név/ID] [Összeg]", player, 0, 0, 0, true)
  668.         return
  669.     end
  670.    
  671.     if not tonumber(amount) then return end
  672.    
  673.     if tonumber(amount) <= 0 then
  674.         outputChatBox("#08c927[NextGaming] #ffffffLegalább 1 dollárt kell átadnod", player, 0, 0, 0, true)
  675.         return
  676.     end
  677.    
  678.    
  679.     target, targetName = exports["mta_main"]:findPlayer(player, target)
  680.     if target == player then outputChatBox("#dc143c[Hiba]:#ffffff Magadnak nem tudsz pénzt átadni.", player, 255, 255, 255, true) return end
  681.    
  682.     if target then
  683.         local playerMoney1 = getElementData(player, "char:money")
  684.        
  685.         local px, py, pz = getElementPosition(player)
  686.         local tx, ty, tz = getElementPosition(target)
  687.        
  688.         local distance = getDistanceBetweenPoints3D(px, py, pz, tx, ty, tz)
  689.         if distance > 5 then
  690.             outputChatBox("#08c927[NextGaming] #ffffffTúl távol vagy tőle #08c927("..targetName:gsub("_", " ")..")", player, 0, 0, 0, true)
  691.             return
  692.         end
  693.        
  694.         amount = tonumber(amount)
  695.         if amount <= playerMoney1 then
  696.             outputChatBox("#08c927[NextGamming - Pay]: #ffffffA pénz átadás 5 másodpercen belül megtörténik.", player, 0, 0, 0, true)
  697.            
  698.             setTimer(function()
  699.                 local px, py, pz = getElementPosition(player)
  700.                 local tx, ty, tz = getElementPosition(target)
  701.                
  702.                 local distance = getDistanceBetweenPoints3D(px, py, pz, tx, ty, tz)
  703.                 if distance > 5 then
  704.                     outputChatBox("#08c927[NextGaming]: #ffffffTúl távol mentél így a folyamat megszakadt.", player, 0, 0, 0, true)
  705.                     return
  706.                 end
  707.                
  708.                 local playerMoney = getElementData(player, "char:money")
  709.                 local targetMoney = getElementData(target, "char:money")
  710.                 if playerMoney < amount then
  711.                     outputChatBox("#08c927[NextGaming]: #ffffffNincs elég pénz nálad.", player, 0, 0, 0, true)
  712.                     return
  713.                 end
  714.                
  715.                 setElementData(player, "char:money", playerMoney-amount)
  716.                 setElementData(target, "char:money", targetMoney+amount)
  717.            
  718.                 outputChatBox("#08c927[NextGaming] #ffffffÁtadtál #08c927"..amount.." #ffffffdollárt #08c927"..targetName:gsub("_", " ").."#ffffff-nak/nek", player, 0, 0, 0, true)
  719.                 outputChatBox("#08c927[NextGaming] #ffffffÁtadott #08c927"..amount.." #ffffffdollárt neked #08c927"..getElementData(player, "char:name"):gsub("_", " "), target, 0, 0, 0, true)
  720.                 exports.mta_chat:sendLocalMeAction(player, "átad egy kis pénzt " ..targetName:gsub("_", " ").. "-nak/nek")
  721.                 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"))
  722.             end, 5000, 1)
  723.         else
  724.             outputChatBox("#08c927[NextGaming] #ffffffNincs ennyi pénzed.", player, 0, 0, 0, true)
  725.         end
  726.     end
  727. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement