Guest User

Untitled

a guest
Mar 12th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.14 KB | None | 0 0
  1. Proźba o przerobienie Skryptu na Bankomat z Paczki Skryptów LSS
  2. [lua]
  3. local bankomaty={
  4. --x,y,z, rx, ry, rz, INT, DIM, factionid, biernik
  5. {1495.26,-1022.28,22.83,0,0,0,0}, -- bank
  6. {1501.37,-1020.80,22.83,0,0,0,0}, -- bank
  7. {1468.19,-1764.12,17.80,0,0,90,0}, -- um
  8. {1690.90,-2237.49,12.54,0,0,0,0}, -- lotnisko
  9. {2039.45,-1447.58,12.54,0,0,270,0}, -- szpital
  10. {1895.33,-1737.05,12.33,0,0,0,0}, -- kasyno
  11. {932.98,-1195.05,17.48,0,0,90,0}, -- straz pozarna
  12. {486.52,-1123.55,84.22,0,0,270,0}, -- cnn news
  13. {2798.42,-1097.33,29.72,0,0,180,0}, -- departament turystyki
  14. {2421.29,-2681.73,12.66,0,0,270,0}, -- import
  15.  
  16. {1251.68,325.03,18.76,0,0,157,0}, -- montgomery
  17. {198.34,-62.45,0.58,0,0,0,0}, -- blueberry
  18. {2274.06,-76.55,25.58,0,0,0,0}, -- palamino creek
  19.  
  20.  
  21. --frakcyjne
  22.  
  23. {1548.07,-1675.52,1463.47-1,0,0,0,1,5,2,biernik="policji"}, --komisariat LSPD
  24. {2027.21,-1393.47,1275.07-1,0,0,360,1,8,6,biernik="szpitala"}, --szpital LSMC
  25. {1489.04,-1794.41,1132.96-1,0,0,180,1,1,1,biernik="urzędu miasta"}, --urząd miasta
  26. {449.02,-1124.23,1196.34-1,0,0,360,1,7,5,biernik="redakcji CNN"}, --CNN
  27. {801.03,-513.32,1206.88-1,0,0,180,1,10,4,biernik="służb miejskich"}, --sluzby miejskie
  28. {924.74,-1281.04,1440.93-1,0,0,90,1,26,11,biernik="straĹĽy poĹĽarnej"}, --straz pozarna LSFD
  29. {1313.32,-1098.53,1441.53-1,0,0,0,1,21,17,biernik="sÄ…du"}, --sÄ…d
  30. {1215.38,-1436.30,2177.18-1,0,0,90,1,40,22,biernik="służb specjalnych"}, --sluzby specjalne (swat,crash)
  31. {2815.22,-1095.55,1593.71-1,0,0,180,1,51,35,biernik="departamentu turystyki"}, --departament turystki
  32. {2431.93,-2667.13,2035.17-1,0,0,180,2,3,10,biernik="import"}, --import pojazdow
  33.  
  34.  
  35. --[[
  36. {2192.6635742188, 2713.3317871094, 9.8203125, 0.0, 0.0, 270.0, 0}, -- spinybed LV
  37. {1480.4816894531, 2171.3081054688, 10.0234375, 0.0, 0.0, 90.0, 0}, -- redsands west
  38. {2557.185546875, 1772.2393798828, 10.031209945679, 0.0, 0.0, 90.0, 0}, -- starfish casino lv
  39. {2564.8251953125, 1051.5998535156, 9.8203125, 0.0, 0.0, 270.0, 0}, -- come-a-lot
  40. {1971.5268554688, 712.67303466797, 9.8197803497314, 0.0, 0.0, 0.0, 0},
  41. {1353.1154785156, 1158.0219726563, 9.8203125, 0.0, 0.0, 90.0, 0},
  42. {2256.5534667969, 1795.3287353516, 9.8203125, 0.0, 0.0, 270.0, 0},
  43. {2173.728515625, 1410.8937988281, 10.0625, 0.0, 0.0, 270.0, 0},
  44. {1931.3721923828, 1368.1392822266, 8.2578125, 0.0, 0.0, 90.0, 0},
  45. {2311.00, -17.32, 25.74, 0.0, 0.0, 180.0, 0}, -- bankomat w banku
  46. {2313.55, -17.32, 25.74, 0.0, 0.0,180.0,0}, -- drugi bankomat w banku
  47. {1250.9910888672, 242.38471984863, 18.5546875, 0.0, 0.0, 156.0, 0},
  48. {666.99114990234, -552.08044433594, 15.3359375, 0.0, 0.0, 180.0, 0},
  49. {170.33477783203, -186.32015991211, 0.58472061157227, 0.0, 0.0, 180.0, 0},
  50. {2204.7214355469, -1151.3322753906, 24.747364044189, 0.0, 0.0, 0.0, 0},
  51. {1738.6976318359, -1327.0853271484, 12.545146942139, 0.0, 0.0, 270.0, 0},
  52. {1015.1317749023, -1303.2105712891, 12.546875, 0.0, 0.0, 270.0, 0},
  53. {514.27410888672, -1611.4864501953, 15.386782646179, 0.0, 0.0, 90.0, 0},
  54. {1135.0554199219, -1630.5491943359, 12.819604873657, 0.0, 0.0, 176.0, 0},
  55. {1807.16015625, -1568.8347167969, 12.470972061157, 0.0, 0.0, 40.0, 0},
  56. {2479.6682128906, -1757.8579101563, 12.546875, 0.0, 0.0, 180.0, 0},
  57. {1680.4873046875, -2335.353515625, 12.546875, 0.0, 0.0, 180.0, 0},
  58. {-2156.0866699219, -2444.9357910156, 29.625, 0.0, 0.0, 145.0, 0},
  59. {-2626.2238769531, 48.929767608643, 3.3359375, 0.0, 0.0, 0.0, 0},
  60. {-2626.1892089844, 631.04772949219, 13.453125, 0.0, 0.0, 0.0, 0},
  61. {-1695.0743408203, 1336.3724365234, 6.1796875, 0.0, 0.0, 227.0, 0},
  62. {-1990.6309814453, 744.99035644531, 44.437515258789, 0.0, 0.0, 315.0, 0},
  63. {-1980.7810058594, 134.08068847656, 26.6875, 0.0, 0.0, 270.0, 0},
  64. {-1379.8724365234, -355.13671875, 13.1484375, 0.0, 0.0, 190.0, 0},
  65. {-2529.85546875, -624.77935791016, 131.75575256348, 0.0, 0.0, 180.0, 0},
  66. {-2442.4858398438, 2320.5112304688, 3.984375, 0.0, 0.0, 180.0, 0},
  67. {-1479.5334472656, 2642.5952148438, 57.787948608398, 0.0, 0.0, 0.0, 0},
  68. {414.52542114258, 2533.9692382813, 15.560947418213, 0.0, 0.0, 0.0, 0},
  69. {-80.593231201172, 1178.0502929688, 18.7421875, 0.0, 0.0, 90.0, 0},
  70. {-833.80749511719, 1506.6776123047, 18.938480377197, 0.0, 0.0, 270.0}
  71. ]]--
  72. }
  73.  
  74. for i,v in ipairs(bankomaty) do
  75. --[[
  76. CreateDynamicObject(2618, DATA_ATM[i][X], DATA_ATM[i][Y], DATA_ATM[i][Z], DATA_ATM[i][rX], DATA_ATM[i][rY], DATA_ATM[i][rZ]);
  77. ATMS[i][eatm_mapicon]=CreateDynamicMapIcon(DATA_ATM[i][X], DATA_ATM[i][Y], DATA_ATM[i][Z], 52, 6, 0, DATA_ATM[i][atmInterior], -1, 300.0);
  78. Streamer_SetIntData(STREAMER_TYPE_MAP_ICON, ATMS[i][eatm_mapicon], E_STREAMER_STYLE, 2);
  79. // Streamer_SetIntData(STREAMER_TYPE_MAP_ICON, ATMS[i][eatm_mapicon], E_STREAMER_SIZE, random(10)); // testy!
  80. ATMS[i][eatm_cp]=CreateDynamicCP(DATA_ATM[i][X], DATA_ATM[i][Y], DATA_ATM[i][Z], 1.3, 0,DATA_ATM[i][atmInterior],-1,15.0);
  81. ]]--
  82. v.obiekt=createObject(2618,v[1],v[2],v[3],v[4],v[5],v[6])
  83. setElementInterior(v.obiekt,v[7] or 0)
  84. setElementDimension(v.obiekt,v[8] or 0)
  85.  
  86. -- v.mapicon=createBlip(v[1],v[2],v[3], 52, 2, 255,255,255,255, -1000, 300)
  87. v.mapicon=createBlip(v[1],v[2],v[3], 0, 1, 5,255,5,255, -1000, 300)
  88. setElementInterior(v.mapicon,v[7] or 0)
  89. setElementDimension(v.mapicon,v[8] or 0)
  90.  
  91. v.cs=createColSphere(v[1],v[2],v[3]+1, 1)
  92. setElementInterior(v.cs,v[7] or 0)
  93. setElementDimension(v.cs,v[8] or 0)
  94.  
  95. if v[9] then setElementData(v.cs, "bankomat:frakcyjny", v[9]) end
  96. if v.biernik then setElementData(v.cs, "bankomat:frakcyjny-biernik", v.biernik) end
  97. end
  98.  
  99.  
  100. local bw={}
  101. bw.win = guiCreateWindow(0.7236,0.3398,0.2314,0.5,"Bankomat",true)
  102. guiWindowSetMovable(bw.win,false)
  103. guiWindowSetSizable(bw.win,false)
  104. bw.lbl1 = guiCreateLabel(0.0633,0.0997,0.903,0.1571,"Stan konta:\n0$",true,bw.win)
  105. guiLabelSetVerticalAlign(bw.lbl1,"center")
  106. guiLabelSetHorizontalAlign(bw.lbl1,"center",false)
  107. bw.lbl2 = guiCreateLabel(0.0759,0.2734,0.8861,0.0695,"Wpłata ───────────────────────",true,bw.win)
  108. bw.edt1 = guiCreateEdit(0.0675,0.3385,0.8608,0.0859,"0",true,bw.win)
  109. bw.btn_wplac = guiCreateButton(0.0717,0.4427,0.8608,0.0911,"Wpłać",true,bw.win)
  110.  
  111. bw.lbl3 = guiCreateLabel(0.0759,0.5626,0.8861,0.0695,"Wypłata ".."───────────────────────",true,bw.win)
  112. bw.edt2 = guiCreateEdit(0.0675,0.6276,0.8608,0.0859,"0",true,bw.win)
  113. bw.btn_wyplac = guiCreateButton(0.0717,0.7344,0.8608,0.0911,"Wypłać",true,bw.win)
  114.  
  115. bw.btn_zamknij = guiCreateButton(0.0717,0.888,0.8608,0.0859,"Zamknij",true,bw.win)
  116.  
  117.  
  118.  
  119.  
  120.  
  121. guiSetVisible(bw.win, false)
  122.  
  123.  
  124.  
  125. addEventHandler("onClientColShapeHit", resourceRoot, function(el,md)
  126. if not md or el~=localPlayer then return end
  127. -- outputChatBox("Bankomat pokazuje napis: AWARIA.")
  128. -- if getPlayerName(localPlayer)=="Carolynn_Trench" or getPlayerName(localPlayer)=="Bob_Euler" then
  129.  
  130.  
  131. guiSetVisible(bw.win, true)
  132. guiSetEnabled(bw.btn_wyplac, false)
  133. guiSetEnabled(bw.btn_wplac, false)
  134. guiSetText(bw.lbl1,"Trwa otwieranie konta bankowego...")
  135. triggerServerEvent("onPlayerRequestATMInfo", resourceRoot)
  136. --showCursor(true,true)
  137. guiSetInputMode("no_binds_when_editing")
  138. if getElementData(source, "bankomat:frakcyjny") then
  139. guiSetText(bw.win, "Wpłatomat frakcyjny")
  140. guiSetText(bw.lbl2, "Wpłata na konto "..getElementData(source, "bankomat:frakcyjny-biernik"))
  141. guiSetVisible(bw.btn_wyplac, false)
  142. setElementData(bw.win, "bankomat:frakcyjny", getElementData(source, "bankomat:frakcyjny"))
  143. guiSetText(bw.lbl3, "Tytułem:")
  144. guiSetPosition(bw.btn_wplac, 0.0717,0.75, true)
  145. setTimer(guiSetText,100,1,bw.edt2, "")
  146. else
  147. guiSetText(bw.win, "Bankomat")
  148. guiSetText(bw.lbl2, "Wpłata ───────────────────────")
  149. guiSetText(bw.lbl3, "Wypłata ───────────────────────")
  150. guiSetVisible(bw.btn_wyplac, true)
  151. guiSetPosition(bw.btn_wplac, 0.0717,0.4427, true)
  152. end
  153. -- end
  154. end)
  155.  
  156. local function closeATMWin()
  157. if guiGetVisible(bw.win) then
  158. guiSetVisible(bw.win, false)
  159. --showCursor(false)
  160. end
  161. end
  162.  
  163. addEventHandler("onClientGUIClick", bw.btn_zamknij, closeATMWin, false)
  164. addEventHandler("onClientColShapeLeave", resourceRoot, function(el,md)
  165. if el~=localPlayer then return end
  166. closeATMWin()
  167. end)
  168.  
  169. -- triggerClientEvent(client,"doFillATMInfo", resourceRoot, true, sr.bank_money)
  170. addEvent("doFillATMInfo", true)
  171. addEventHandler("doFillATMInfo", resourceRoot, function(success, balance)
  172. if not success then
  173. guiSetText(bw.lbl1,"Musisz być zarejestrowanym graczem aby skorzystać z bankomatu.")
  174. return
  175. end
  176. guiSetText(bw.lbl1,"Stan Twojego konta:".."\n".. balance.."$")
  177. setElementData(bw.win, "balance", tonumber(balance))
  178. guiSetText(bw.edt2,100 > balance and balance or 100)
  179. if balance>0 then
  180. guiSetEnabled(bw.btn_wyplac, true)
  181. end
  182.  
  183. guiSetText(bw.edt1,balance)
  184. guiSetEnabled(bw.btn_wplac, true)
  185. end)
  186.  
  187. addEventHandler("onClientPlayerSpawn", localPlayer, closeATMWin)
  188.  
  189.  
  190. addEventHandler("onClientGUIClick", bw.btn_wplac, function()
  191. local kwota=tonumber(guiGetText(bw.edt1))
  192.  
  193. if not kwota or kwota<=0 then
  194. -- triggerEvent("onAnnouncement3", root, "Nieprawidłowa kwota wpłaty.", 4)
  195. outputChatBox("Nieprawidłowa kwota wpłaty!", 255,0,0)
  196. return
  197. end
  198.  
  199. if guiGetVisible(bw.btn_wyplac) then --normalna wplata
  200.  
  201. if kwota>getPlayerMoney() then
  202. outputChatBox("Nie masz tyle gotĂłwki!", 255,0,0)
  203. return
  204. end
  205.  
  206. closeATMWin()
  207. triggerServerEvent("doATMOperation", resourceRoot, kwota)
  208. else
  209. local balance = getElementData(bw.win, "balance")
  210. if kwota>balance then
  211. outputChatBox("Nie masz tyle gotĂłwki na koncie bankowym!", 255,0,0)
  212. return
  213. end
  214.  
  215. local frakcja = getElementData(bw.win, "bankomat:frakcyjny")
  216. local tytul = guiGetText(bw.edt2)
  217. if (string.len(tytul) < 5) or (string.len(tytul) > 30) then outputChatBox("Zbyt długi/krótki powód!", 255,0,0) return end
  218. closeATMWin()
  219. triggerServerEvent("doATMOperationFraction", resourceRoot, kwota, frakcja, tytul)
  220. end
  221.  
  222. end, false)
  223.  
  224. addEventHandler("onClientGUIClick", bw.btn_wyplac, function()
  225. if not tonumber(guiGetText(bw.edt2)) then return end
  226. local kwota=tonumber(guiGetText(bw.edt2))
  227. if not kwota or kwota<=0 then
  228. -- triggerEvent("onAnnouncement3", root, "Nieprawidłowa kwota wypłaty.", 4)
  229. outputChatBox("Nieprawidłowa kwota wpłaty!", 255,0,0)
  230. return
  231. end
  232. if getPlayerMoney()+kwota>99999999 then
  233. -- triggerEvent("onAnnouncement3", root, "Nie możesz mieć tyle gotówki przy sobie.", 4)
  234. outputChatBox("Maksymalna ilość gotówki którą możesz mieć przy sobie to 999999.99$", 255,0,0)
  235. return
  236. end
  237. closeATMWin()
  238. triggerServerEvent("doATMOperation", resourceRoot, -kwota)
  239.  
  240. end, false)[/lua]
Advertisement
Add Comment
Please, Sign In to add comment