Advertisement
Kezoto

Untitled

Jul 26th, 2020
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.86 KB | None | 0 0
  1. domy.lua:
  2.  
  3. [code]domy={}
  4. local function usunDom(id)
  5. if isElement(domy[id].wyjscie) then destroyElement(domy[id].wyjscie) end
  6. if isElement(domy[id].wejscie) then destroyElement(domy[id].wejscie) end
  7. if isElement(domy[id].cs) then destroyElement(domy[id].cs) end
  8. if isElement(domy[id].text) then destroyElement(domy[id].text) end
  9. domy[id]=nil
  10. end
  11.  
  12. function dodajDom(v,fast)
  13.  
  14. if not interiory[v.interiorid] then return false end
  15. if domy[v.id] then
  16. usunDom(v.id)
  17. end
  18. local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_users WHERE id=?", v.ownerid)
  19. if result and #result > 0 then
  20. local r=result[1]
  21. if r.login2 == false then
  22. v.owner_nick = r.login
  23. else
  24. v.owner_nick = r.login2
  25. end
  26. else
  27. if v.ownerid ~= false then
  28. outputDebugString("BĹ‚ad domu ID domu#"..v.id)
  29. end
  30. v.owner_nick = "do wynajęcia"
  31. end
  32. v.drzwi=split(v.drzwi,",")
  33. for ii,vv in ipairs(v.drzwi) do v.drzwi[ii]=tonumber(vv) end
  34. v.punkt_wyjscia=split(v.punkt_wyjscia,",")
  35. for ii,vv in ipairs(v.punkt_wyjscia) do v.punkt_wyjscia[ii]=tonumber(vv) end
  36. local pickupid=1272
  37. if (not v.ownerid) then
  38. pickupid=1273
  39. end
  40. v.wejscie=createPickup ( v.drzwi[1], v.drzwi[2], v.drzwi[3], 3, pickupid, 0)
  41. v.cs=createColSphere(v.drzwi[1],v.drzwi[2],v.drzwi[3], 1)
  42.  
  43. if (not fast and v.ownerid) then
  44. v.text=createElement("text")
  45. setElementPosition(v.text, v.drzwi[1],v.drzwi[2],v.drzwi[3]+0.5)
  46. setElementData(v.text,"text", (v.descr or "Dom").."\n"..v.owner_nick)
  47. end
  48. local interior_dimension=v.vwi or 1000+v.id
  49. if v.lokator1 ~= "false" then
  50. local lokator1db=exports["pystories-db"]:dbSet("select login,login2,id from pystories_users where id=?", v.lokator1)
  51. if #lokator1db > 0 then
  52. lokator1db=lokator1db[1]
  53. if lokator1db.login2 then
  54. lokator1=lokator1db.login2
  55. else
  56. lokator1=lokator1db.login
  57. end
  58. lokator1uid=lokator1db.id
  59. else
  60. lokator1=false
  61. lokator1uid=false
  62. end
  63. end
  64. if v.lokator2 ~= "false" then
  65. local lokator2db=exports["pystories-db"]:dbSet("select login,login2,id from pystories_users where id=?", v.lokator2)
  66. if #lokator2db > 0 then
  67. lokator2db=lokator2db[1]
  68. if lokator2db.login2 then
  69. lokator2=lokator2db.login2
  70. else
  71. lokator2=lokator2db.login
  72. end
  73. lokator2uid=lokator2db.id
  74. else
  75. lokator2=false
  76. lokator2uid=false
  77. end
  78. end
  79. if v.lokator3 ~= "false" then
  80. local lokator3db=exports["pystories-db"]:dbSet("select login,login2,id from pystories_users where id=?", v.lokator3)
  81. if #lokator3db > 0 then
  82. lokator3db=lokator3db[1]
  83. if lokator3db.login2 then
  84. lokator3=lokator3db.login2
  85. else
  86. lokator3=lokator3db.login
  87. end
  88. lokator3uid=lokator3db.id
  89. else
  90. lokator3=false
  91. lokator3uid=false
  92. end
  93. end
  94. setElementData(v.cs, "dom", {
  95. ["zamkniety"]=v.zamkniety>0 and true or false,
  96. ["id"]=v.id,
  97. ["koszt"]=v.koszt,
  98. ["ownerid"]=v.ownerid,
  99. ["owner_nick"]=v.owner_nick,
  100. ["descr"]=v.descr or "dom",
  101. ["dimension"]=interior_dimension,
  102. ["interior"]=interiory[v.interiorid].interior,
  103. ["interior_loc"]=interiory[v.interiorid].entrance,
  104. ["exit_loc"]=v.punkt_wyjscia,
  105. ["paidTo"]=v.paidTo,
  106. ["paidTo_dni"]=v.paidTo_dni,
  107. ["lokator1"]=lokator1,
  108. ["lokator1uid"]=lokator1uid,
  109. ["lokator2"]=lokator2,
  110. ["lokator2uid"]=lokator2uid,
  111. ["lokator3"]=lokator3,
  112. ["lokator3uid"]=lokator3uid,
  113. })
  114.  
  115. v.wyjscie=createMarker(interiory[v.interiorid].exit[1], interiory[v.interiorid].exit[2], interiory[v.interiorid].exit[3], "arrow",1)
  116. setElementDimension(v.wyjscie, interior_dimension)
  117. setElementInterior(v.wyjscie, interiory[v.interiorid].interior)
  118. setElementData(v.wyjscie,"tpto", v.punkt_wyjscia)
  119.  
  120. local dbid=v.id
  121. v.id=nil
  122. domy[dbid]=v
  123.  
  124. return true
  125. end
  126.  
  127. function domyGetInfo(id)
  128. return domy[id]
  129. end
  130.  
  131. local function zaladujCzescDomow(procent,fast)
  132. local tt=getTickCount()
  133. i=0
  134. exports["pystories-db"]:dbSet("UPDATE lss_domy SET paidTo=NULL,ownerid=NULL,lokator1=NULL,lokator2=NULL,lokator3=NULL where paidTo<NOW() or paidTo IS NULL")
  135. local dbdomy
  136. if fast then
  137. dbdomy=exports["pystories-db"]:dbGet("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid AND d.ownerid IS NOT NULL;")
  138. else
  139. dbdomy=exports["pystories-db"]:dbGet("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid WHERE d.active=1;")
  140. end
  141. for __,v in ipairs(dbdomy) do
  142. if math.random(0,100)<=procent then
  143. if dodajDom(v,fast) then i=i+1 end
  144. end
  145. end
  146. outputDebugString("Zaladowano domow: " .. i .. " w " .. (getTickCount()-tt) .. "ms")
  147. end
  148. addEventHandler("onResourceStart", resourceRoot, function()
  149. zaladujCzescDomow(100,false)
  150. end)
  151.  
  152. function zaladujZmienioneDomy()
  153. local i=0
  154. local dbdomy=exports["pystories-db"]:dbGet("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid WHERE d.active=1 AND timediff(now(),d.updated)<'00:09:00' AND datediff(now(),d.updated)<1")
  155. for __,v in ipairs(dbdomy) do
  156.  
  157. if dodajDom(v) then i=i+1 end
  158. end
  159. end
  160.  
  161. setTimer(zaladujZmienioneDomy, 10*1000, 0)
  162.  
  163. function domReload(id)
  164. local dbdom=exports["pystories-db"]:dbGet("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid WHERE d.active=1 AND timediff(now(),d.updated)<'00:09:00' AND datediff(now(),d.updated)<1 and d.id=?", id)
  165. if dbdom then
  166. for i,v in ipairs(dbdom) do
  167. return dodajDom(v)
  168. end
  169. end
  170. return false
  171. end
  172.  
  173. addEvent ( "SprawdzDom", true )
  174. function SprawdzDom ( gracz )
  175. local dbdomy=exports["pystories-db"]:dbGet("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid AND d.ownerid IS NOT NULL;")
  176. for __,v in ipairs(dbdomy) do
  177. local uid=tonumber(getElementData(gracz,"player:sid"))
  178. local r=v.ownerid
  179. v.drzwi=split(v.drzwi,",")
  180. for ii,vv in ipairs(v.drzwi) do v.drzwi[ii]=tonumber(vv) end
  181. if r then if r == uid then
  182. setElementData(gracz,"player:house",true)
  183. tak=({v.drzwi[1],v.drzwi[2],v.drzwi[3]})
  184. setElementData(gracz,"player:spawn",tak)
  185. end end
  186. end
  187. for __,v in ipairs(dbdomy) do
  188. local uid=tonumber(getElementData(gracz,"player:sid"))
  189. v.drzwi=split(v.drzwi,",")
  190. for ii,vv in ipairs(v.drzwi) do v.drzwi[ii]=tonumber(vv) end
  191. setElementData(gracz,"player:house",true)
  192. tak=({v.drzwi[1],v.drzwi[2],v.drzwi[3]})
  193. setElementData(gracz,"player:spawn",tak)
  194. end
  195. end
  196. addEventHandler ( "SprawdzDom", root, SprawdzDom )
  197.  
  198. function kupdom(czas,domid)
  199. local kasa=client:getMoney()
  200. q=exports["pystories-db"]:dbSet("select ownerid,koszt,id from lss_domy where id=?", domid)
  201. if #q < 1 then
  202. client:outputChat("WystÄ&#8230;piĹ&#8218; bĹ&#8218;Ä&#8230;d, nie znaleziono takiego domu!", 255, 0, 0)
  203. return
  204. end
  205. q=q[1]
  206. if q.ownerid then
  207. client:outputChat("Ten dom ma juĹĽ wĹ&#8218;aĹ&#8250;ciciela!", 255, 0, 0)
  208. return
  209. end
  210. koszt=q.koszt*czas
  211. if kasa < koszt then
  212. client:outputChat("Nie staÄ&#8225; CiÄ&#8482; na kupno tego domu! ("..koszt.." PLN)", 255, 0, 0)
  213. return
  214. end
  215. takePlayerMoney(client, koszt)
  216. exports["pystories-db"]:dbSet("update lss_domy set ownerid=?, paidTo=NOW()+INTERVAL ? DAY, lokator1=NULL, lokator2=NULL, lokator3=NULL where id=?", client:getData("player:sid"), czas, domid)
  217. domReload(domid)
  218. client:outputChat("PomyĹ&#8250;lnie zakupiĹ&#8218;eĹ&#8250; dom, pobrano z konta "..koszt.." PLN!", 0, 255, 0)
  219. end
  220. addEvent("DOMY:kup", true)
  221. addEventHandler("DOMY:kup", root, kupdom)
  222.  
  223. function oplacdom(czas,domid)
  224. local kasa=client:getMoney()
  225. q=exports["pystories-db"]:dbSet("select ownerid,koszt,id from lss_domy where id=?", domid)
  226. if #q < 1 then
  227. client:outputChat("WystÄ&#8230;piĹ&#8218; bĹ&#8218;Ä&#8230;d, nie znaleziono takiego domu!", 255, 0, 0)
  228. return
  229. end
  230. q=q[1]
  231. if q.ownerid ~= client:getData("player:sid") then
  232. client:outputChat("To nie jest twĂłj dom!", 255, 0, 0)
  233. return
  234. end
  235. koszt=q.koszt*czas
  236. if kasa < koszt then
  237. client:outputChat("Nie staÄ&#8225; CiÄ&#8482; na opĹ&#8218;acenie tego domu! ("..koszt.." PLN)", 255, 0, 0)
  238. return
  239. end
  240. takePlayerMoney(client, koszt)
  241. exports["pystories-db"]:dbSet("update lss_domy set paidTo=paidTo+INTERVAL ? DAY where id=?", czas, domid)
  242. domReload(domid)
  243. client:outputChat("PomyĹ&#8250;lnie opĹ&#8218;aciĹ&#8218;eĹ&#8250; dom na "..czas.." dni, pobrano z konta "..koszt.." PLN!", 0, 255, 0)
  244. end
  245. addEvent("DOMY:oplac", true)
  246. addEventHandler("DOMY:oplac", root, oplacdom)
  247.  
  248. function dodajlokator(uid,domid)
  249. local q2=exports["pystories-db"]:dbSet("select id from pystories_users where id=?", uid)
  250. if #q2> 0 then
  251. q=exports["pystories-db"]:dbSet("select lokator1,lokator2,lokator3 from lss_domy where id=?", domid)
  252. if #q < 1 then client:outputChat("WystÄ&#8230;piĹ&#8218; bĹ&#8218;Ä&#8230;d, nie znaleziono takiego domu!", 255, 0, 0) return end
  253. q=q[1]
  254. if (tonumber(q.lokator1) and tonumber(q.lokator1) ~= 0) and (tonumber(q.lokator2) and tonumber(q.lokator2) ~= 0) and (tonumber(q.lokator3) and tonumber(q.lokator3) ~= 0) then client:outputChat("OsiÄ&#8230;gniÄ&#8482;to limit 3 lokatorĂłw na dom!", 255, 0, 0) return end
  255. if (tonumber(q.lokator1) and tonumber(q.lokator1) == 0) then
  256. exports["pystories-db"]:dbSet("update lss_domy set lokator1=? where id=?", uid, domid)
  257. domReload(domid)
  258. client:outputChat("Dodano nowego lokatora do domu.", 0, 255, 0)
  259. return
  260. end
  261. if (tonumber(q.lokator2) and tonumber(q.lokator2) == 0) then
  262. exports["pystories-db"]:dbSet("update lss_domy set lokator2=? where id=?", uid, domid)
  263. domReload(domid)
  264. client:outputChat("Dodano nowego lokatora do domu.", 0, 255, 0)
  265. return
  266. end
  267. if (tonumber(q.lokator3) and tonumber(q.lokator3) == 0) then
  268. exports["pystories-db"]:dbSet("update lss_domy set lokator3=? where id=?", uid, domid)
  269. domReload(domid)
  270. client:outputChat("Dodano nowego lokatora do domu.", 0, 255, 0)
  271. return
  272. end
  273. else
  274. client:outputChat("Nie ma konta z takim UID!", 255, 0, 0)
  275. end
  276. end
  277. addEvent("DOM:lokator+", true)
  278. addEventHandler("DOM:lokator+", root, dodajlokator)
  279.  
  280. function usunlokator(id,domid)
  281. if id == 1 then
  282. exports["pystories-db"]:dbSet("update lss_domy set lokator1=NULL where id=?", domid)
  283. client:outputChat("PomyĹ&#8250;lnie usuniÄ&#8482;to lokatora.", 0, 255, 0)
  284. local dbdom=exports["pystories-db"]:dbGet("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid WHERE d.active=1 AND timediff(now(),d.updated)<'00:09:00' AND datediff(now(),d.updated)<1 and d.id=?", domid)
  285. for i,v in ipairs(dbdom) do
  286. dodajDom(v)
  287. end
  288. elseif id == 2 then
  289. exports["pystories-db"]:dbSet("update lss_domy set lokator2=NULL where id=?", domid)
  290. client:outputChat("PomyĹ&#8250;lnie usuniÄ&#8482;to lokatora.", 0, 255, 0)
  291. local dbdom=exports["pystories-db"]:dbGet("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid WHERE d.active=1 AND timediff(now(),d.updated)<'00:09:00' AND datediff(now(),d.updated)<1 and d.id=?", domid)
  292. for i,v in ipairs(dbdom) do
  293. dodajDom(v)
  294. end
  295. elseif id == 3 then
  296. exports["pystories-db"]:dbSet("update lss_domy set lokator3=NULL where id=?", domid)
  297. client:outputChat("PomyĹ&#8250;lnie usuniÄ&#8482;to lokatora.", 0, 255, 0)
  298. local dbdom=exports["pystories-db"]:dbGet("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid WHERE d.active=1 AND timediff(now(),d.updated)<'00:09:00' AND datediff(now(),d.updated)<1 and d.id=?", domid)
  299. for i,v in ipairs(dbdom) do
  300. dodajDom(v)
  301. end
  302. end
  303. end
  304. addEvent("DOM:lokator-", true)
  305. addEventHandler("DOM:lokator-", root, usunlokator)
  306.  
  307. function zwolnijdom(domid)
  308. exports["pystories-db"]:dbSet("update lss_domy set paidTo='2000-01-01 00:00:00' where id=?", domid)
  309. exports["pystories-db"]:dbSet("UPDATE lss_domy SET paidTo=NULL,ownerid=NULL,lokator1=NULL,lokator2=NULL,lokator3=NULL where paidTo<NOW() or paidTo IS NULL")
  310. domReload(domid)
  311. client:outputChat("PomyĹ&#8250;lnie zwolniono dom.", 0, 255, 0)
  312. end
  313. addEvent("DOM:zwolnij", true)
  314. addEventHandler("DOM:zwolnij", root, zwolnijdom)
  315.  
  316. addCommandHandler("mieszkanie",function(plr,cmd)
  317. if exports['pystories-admins']:getAdmin(plr,4) or getAdmin(plr, 7) or getAdmin(plr, 5) then
  318. local x,y,z = getElementPosition(plr)
  319. local stringe = ("INSERT INTO lss_domy (descr,i,vwe,drzwi,punkt_wyjscia,interiorid,koszt,active) VALUES ('%s',%s,%s,'%s','%s',%s,%s,%s)"):format("Mieszkanie", 0,0,("%.2f,%.2f,%.2f"):format(x,y,z),("%.2f,%.2f,%.2f"):format(x,y,z),8,500000,1)
  320. local q,_,id=exports["pystories-db"]:dbSet(stringe)
  321. domReload(id)
  322. end
  323. end)
  324.  
  325. addCommandHandler("dom",function(plr,cmd)
  326. if exports['pystories-admins']:getAdmin(plr,7) or getAdmin(plr, 7) or getAdmin(plr, 5) then
  327. local x,y,z = getElementPosition(plr)
  328. local stringe = ("INSERT INTO lss_domy (descr,i,vwe,drzwi,punkt_wyjscia,interiorid,koszt,active) VALUES ('%s',%s,%s,'%s','%s',%s,%s,%s)"):format("Dom", 0,0,("%.2f,%.2f,%.2f"):format(x,y,z),("%.2f,%.2f,%.2f"):format(x,y,z),221,500000,1)
  329. local q,_,id=exports["pystories-db"]:dbSet(stringe)
  330. domReload(id)
  331. end
  332. end)
  333.  
  334. addCommandHandler("willa",function(plr,cmd)
  335. if exports['pystories-admins']:getAdmin(plr,4) or getAdmin(plr, 7) or getAdmin(plr, 5) then
  336. local x,y,z = getElementPosition(plr)
  337. local stringe = ("INSERT INTO lss_domy (descr,i,vwe,drzwi,punkt_wyjscia,interiorid,koszt,active) VALUES ('%s',%s,%s,'%s','%s',%s,%s,%s)"):format("Willa", 0,0,("%.2f,%.2f,%.2f"):format(x,y,z),("%.2f,%.2f,%.2f"):format(x,y,z),27,1000000,1)
  338. local q,_,id=exports["pystories-db"]:dbSet(stringe)
  339. domReload(id)
  340. end
  341. end)[/code]
  342.  
  343. domy_c.lua:
  344.  
  345. [code]mojeW,mojeH = 1366, 768
  346. sW,sH = guiGetScreenSize()
  347. w, h = (sW/mojeW), (sH/mojeH)
  348. sx,sy=guiGetScreenSize()
  349. local dxfont0_1 = dxCreateFont(":dG-Fonty/1.ttf", 10)
  350.  
  351. function isMouseIn(psx,psy,pssx,pssy,abx,aby)
  352. if not isCursorShowing() then return end
  353. cx,cy=getCursorPosition()
  354. cx,cy=cx*sx,cy*sy
  355. if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
  356. return true,cx,cy
  357. else
  358. return false
  359. end
  360. end
  361.  
  362. local dom=nil
  363.  
  364. function dbid(plr)
  365. local c=getElementData(plr,"player:sid")
  366. if not c then return nil end
  367. return tonumber(c)
  368. end
  369.  
  370. function render()
  371. if kupywanie then
  372. dxDrawImage(189*w, 165*h, 583*w, 377*h, ":pystories-domy/kupno.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  373. if dom.ownerid then
  374. dxDrawText("OpĹ&#8218;acanie domu", 207*w, 281*h, 400*w, 299*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  375. dxDrawText("OPŁAÄ&#8224;", 240*w, 461*h, 367*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  376. else
  377. dxDrawText("Kupywanie domu", 207*w, 281*h, 400*w, 299*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  378. dxDrawText("KUP", 240*w, 461*h, 367*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  379. end
  380. dxDrawText("Koszt:", 252*w, 394*h, 357*w, 414*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  381. dxDrawText("Czas wynajecia: ", 208*w, 321*h, 400*w, 340*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "top", false, false, false, false, false)
  382. if isElement(editcost) then
  383. cost=guiGetText(edittime)
  384. if not tonumber(cost) then
  385. cost=0
  386. end
  387. if string.len(tostring(cost)) < 1 then
  388. cost=0
  389. end
  390. if tonumber(cost) < 1 then
  391. cost=0
  392. end
  393. sscost=cost*dom.koszt
  394. guiSetText(editcost, sscost.." PLN")
  395. end
  396. end
  397. if not editing then
  398.  
  399. dxDrawImage(404*w, 208*h, 565*w, 347*h, ":pystories-domy/dom.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  400. dxDrawText("ZarzÄ&#8230;dzanie domem (ID: "..dom.id..")", 408*w, 281*h, 958*w, 298*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  401. dxDrawRectangle(796*w, 435*h, 152*w, 42*h, tocolor(0, 0, 0, 200), false)
  402. dxDrawText("Zamknij", 797*w, 435*h, 948*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  403. dxDrawRectangle(606*w, 435*h, 152*w, 42*h, tocolor(0, 0, 0, 200), false)
  404. dxDrawRectangle(419*w, 435*h, 152*w, 42*h, tocolor(0, 0, 0, 200), false)
  405. if dom.ownerid then
  406. dxDrawRectangle(434*w, 408*h, 127*w, 16*h, tocolor(0, 0, 0, 200), false)
  407. dxDrawRectangle(618*w, 408*h, 127*w, 16*h, tocolor(0, 0, 0, 200), false)
  408. dxDrawRectangle(808*w, 408*h, 127*w, 16*h, tocolor(0, 0, 0, 200), false)
  409. dxDrawText("Zwolnij dom", 997*w, 407*h, 745*w, 424*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  410. dxDrawText("Lokatorzy", 617*w, 407*h, 745*w, 424*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  411. dxDrawText("WejdĹş", 420*w, 435*h, 571*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  412. dxDrawText("OpĹ&#8218;aÄ&#8225; dom", 607*w, 435*h, 758*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  413. if not dom.zamkniety then
  414. dxDrawText("Zamknij dom", 433*w, 408*h, 559*w, 425*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  415. else
  416. dxDrawText("OtwĂłrz dom", 433*w, 408*h, 559*w, 425*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  417. end
  418. else
  419. dxDrawText("Kup dom", 607*w, 435*h, 758*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  420. dxDrawText("Zobacz dom", 420*w, 435*h, 571*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  421. end
  422. if dom.paidTo then
  423. oplacony="Dom jest opĹ&#8218;acony do "..dom.paidTo.." ("..dom.paidTo_dni.." dni)"
  424. else
  425. oplacony="Dom jest opĹ&#8218;acony do - - (0 dni)."
  426. end
  427. dxDrawText("Koszt jednej doby wynosi: "..dom.koszt.." PLN\nWĹ&#8218;aĹ&#8250;ciciel: "..(dom.owner_nick or "do wynajÄ&#8482;cia").."\n"..oplacony.."", 434*w, 329*h, 933*w, 380*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  428. if isMouseIn(419*w, 435*h, 152*w, 42*h) then
  429. dxDrawRectangle(420*w, 477*h, 151*w, 2*h, tocolor(0,128,0), false)
  430. else
  431. dxDrawRectangle(420*w, 477*h, 151*w, 2*h, tocolor(255, 255, 255, 200), false)
  432. end
  433. if isMouseIn(606*w, 435*h, 152*w, 42*h) then
  434. dxDrawRectangle(607*w, 477*h, 151*w, 2*h, tocolor(0,128,0), false)
  435. else
  436. dxDrawRectangle(607*w, 477*h, 151*w, 2*h, tocolor(255, 255, 255, 200), false)
  437. end
  438. if isMouseIn(796*w, 435*h, 152*w, 42*h) then
  439. dxDrawRectangle(797*w, 477*h, 151*w, 2*h, tocolor(0,128,0), false)
  440. else
  441. dxDrawRectangle(797*w, 477*h, 151*w, 2*h, tocolor(255, 255, 255, 200), false)
  442. end
  443. else
  444. dxDrawRectangle(572*w, 260*h, 223*w, 215*h, tocolor(0,128,0), false)
  445. dxDrawText("Lokatorzy", 572*w, 260*h, 795*w, 278*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  446. dxDrawText("1: "..(dom.lokator1 or "brak").."\n2: "..(dom.lokator2 or "brak").."\n3: "..(dom.lokator3 or "brak").."\nAby usunÄ&#8230;Ä&#8225; lokatora podaj numer\nwymieniony wyĹĽej, natomiast jeĹ&#8250;li\nchcesz dodaÄ&#8225; lokatora podaj jego sid", 573, 279, 795, 370, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
  447. if isElement(edit) then
  448. local text=guiGetText(edit)
  449. guiSetText(edit, string.gsub(text, '[^0-9]', '' ))
  450. end
  451. end
  452. end
  453.  
  454. addEventHandler("onClientColShapeHit", resourceRoot, function(el,md)
  455. if el~=localPlayer or not md then return end
  456. if getElementType(el) == "player" and not getPedOccupiedVehicle(el) then
  457. local dom2=getElementData(source,"dom")
  458. if not dom2 then return end
  459. if dom then return end
  460. dom=dom2
  461. addEventHandler("onClientRender", root, render)
  462. addEventHandler("onClientClick", root, click)
  463. showCursor(true)
  464. kupywanie=false
  465. editing=false
  466. end
  467. end)
  468.  
  469. function czyGraczJestLokatorem()
  470. if dom then
  471. if dom.lokator1sid==localPlayer:getData("player:sid") or dom.lokator2sid==localPlayer:getData("player:sid") or dom.lokator3sid==localPlayer:getData("player:sid") then
  472. return true
  473. else
  474. return false
  475. end
  476. end
  477. end
  478.  
  479. function click(btn,state)
  480. if btn=="left" and state=="down" then
  481. if isMouseIn(419*w, 435*h, 152*w, 42*h) then
  482. domWejscie()
  483. elseif isMouseIn(796*w, 435*h, 152*w, 42*h) and not editing then
  484. removeEventHandler("onClientRender", root, render)
  485. removeEventHandler("onClientClick", root, click)
  486. dom=nil
  487. showCursor(false)
  488. if isElement(editcost) then
  489. editcost:destroy()
  490. end
  491. if isElement(edittime) then
  492. edittime:destroy()
  493. end
  494. if isElement(btn1) then
  495. btn1:destroy()
  496. end
  497. if isElement(btn2) then
  498. btn2:destroy()
  499. end
  500. if isElement(btn3) then
  501. btn3:destroy()
  502. end
  503. if isElement(edit) then
  504. edit:destroy()
  505. end
  506. elseif isMouseIn(606*w, 435*h, 152*w, 42*h) and not editing then
  507. if isElement(editcost) then
  508. editcost:destroy()
  509. edittime:destroy()
  510. kupywanie=false
  511. else
  512. editcost = GuiEdit(250*w, 419*h, 107*w, 20*h, "0 PLN", false)
  513. guiEditSetReadOnly(editcost, true)
  514. edittime = GuiEdit(250*w, 350*h, 107*w, 20*h, "", false)
  515. guiEditSetMaxLength(edittime, 2)
  516. kupywanie=true
  517. end
  518. elseif isMouseIn(240*w, 461*h, 127*w, 16*h) and kupywanie and dom and not dom.ownerid and not editing then
  519. triggerEvent('onClientAddNotification', localPlayer, 'Dom musi byÄ&#8225; opĹ&#8218;acony za minimum 1 PLN', 'info')
  520. triggerServerEvent("DOMY:kup", localPlayer, guiGetText(edittime), dom.id)
  521. removeEventHandler("onClientRender", root, render)
  522. removeEventHandler("onClientClick", root, click)
  523. dom=nil
  524. showCursor(false)
  525. editcost:destroy()
  526. edittime:destroy()
  527. kupywanie=false
  528. elseif isMouseIn(240*w, 461*h, 127*w, 16*h) and kupywanie and dom and dom.ownerid and not editing then
  529. if dom.ownerid ~= localPlayer:getData("player:sid") then
  530. triggerEvent('onClientAddNotification', localPlayer, 'Brak uprawnien!', 'info')
  531. return
  532. end
  533. --triggerEvent('onClientAddNotification', localPlayer, 'Koszt domu nie moĹĽe byÄ&#8225; mniejszy niĹĽ 1 PLN', 'info')
  534. triggerServerEvent("DOMY:oplac", localPlayer, guiGetText(edittime), dom.id)
  535. removeEventHandler("onClientRender", root, render)
  536. removeEventHandler("onClientClick", root, click)
  537. dom=nil
  538. showCursor(false)
  539. editcost:destroy()
  540. edittime:destroy()
  541. kupywanie=false
  542. elseif isMouseIn(434*w, 408*h, 127*w, 16*h) and dom.ownerid and not editing then
  543. if dom.ownerid ~= localPlayer:getData("player:sid") and not czyGraczJestLokatorem() then
  544. triggerEvent('onClientAddNotification', localPlayer, 'Brak uprawnien!', 'info')
  545. return
  546. end
  547. triggerServerEvent("onHouseChangeOptions", resourceRoot, dom.id, "zamkniety", not dom.zamkniety)
  548. removeEventHandler("onClientRender", root, render)
  549. removeEventHandler("onClientClick", root, click)
  550. dom=nil
  551. showCursor(false)
  552. if isElement(editcost) then
  553. editcost:destroy()
  554. end
  555. if isElement(edittime) then
  556. edittime:destroy()
  557. end
  558. if isElement(btn1) then
  559. btn1:destroy()
  560. end
  561. if isElement(btn2) then
  562. btn2:destroy()
  563. end
  564. if isElement(btn3) then
  565. btn3:destroy()
  566. end
  567. if isElement(edit) then
  568. edit:destroy()
  569. end
  570. elseif isMouseIn(808*w, 408*h, 127*w, 16*h) and dom.ownerid and not editing then
  571. if dom.ownerid ~= localPlayer:getData("player:sid") then
  572. triggerEvent('onClientAddNotification', localPlayer, 'Brak uprawnien!', 'info')
  573. return
  574. end
  575. triggerServerEvent("DOM:zwolnij", localPlayer, dom.id)
  576. removeEventHandler("onClientRender", root, render)
  577. removeEventHandler("onClientClick", root, click)
  578. dom=nil
  579. showCursor(false)
  580. if isElement(editcost) then
  581. editcost:destroy()
  582. end
  583. if isElement(edittime) then
  584. edittime:destroy()
  585. end
  586. if isElement(btn1) then
  587. btn1:destroy()
  588. end
  589. if isElement(btn2) then
  590. btn2:destroy()
  591. end
  592. if isElement(btn3) then
  593. btn3:destroy()
  594. end
  595. if isElement(edit) then
  596. edit:destroy()
  597. end
  598. elseif isMouseIn(618*w, 408*h, 127*w, 16*h) and not editing and dom.ownerid then
  599. if dom.ownerid ~= localPlayer:getData("player:sid") then
  600. triggerEvent('onClientAddNotification', localPlayer, 'Brak uprawnien!', 'info')
  601. return
  602. end
  603. editing=true
  604. kupywanie=false
  605. if isElement(editcost) then
  606. editcost:destroy()
  607. end
  608. if isElement(edittime) then
  609. edittime:destroy()
  610. end
  611. if isElement(btn1) then
  612. btn1:destroy()
  613. end
  614. if isElement(btn2) then
  615. btn2:destroy()
  616. end
  617. if isElement(btn3) then
  618. btn3:destroy()
  619. end
  620. if isElement(edit) then
  621. edit:destroy()
  622. end
  623. btn1 = GuiButton(589*w, 391*h, 41*w, 30*h, "Dodaj", false)
  624. btn2 = GuiButton(739*w, 391*h, 41*w, 30*h, "UsuĹ&#8222;", false)
  625. btn3 = GuiButton(642*w, 443*h, 87*w, 25*h, "PowrĂłt", false)
  626. edit = GuiEdit(640*w, 395*h, 89*w, 20*h, "", false)
  627. addEventHandler("onClientGUIClick", btn3, function(btn)
  628. if btn=="left" then
  629. editing=false
  630. btn1:destroy()
  631. btn2:destroy()
  632. btn3:destroy()
  633. edit:destroy()
  634. end
  635. end)
  636. addEventHandler("onClientGUIClick", btn1, function(btn)
  637. if btn=="left" then
  638. local text=guiGetText(edit)
  639. if not tonumber(text) then return end
  640. if dom.lokator1sid == text or dom.lokator2sid == text or dom.lokator3sid == text then
  641. triggerEvent('onClientAddNotification', localPlayer, 'Jest juz zapisany ten lokator!', 'info')
  642. return
  643. end
  644. if tonumber(text) == tonumber(localPlayer:getData("player:sid")) then
  645. triggerEvent('onClientAddNotification', localPlayer, 'Nie mozesz dodac siebie!', 'info')
  646. return
  647. end
  648. triggerServerEvent("DOM:lokator+", localPlayer, text, dom.id)
  649. removeEventHandler("onClientRender", root, render)
  650. removeEventHandler("onClientClick", root, click)
  651. dom=nil
  652. showCursor(false)
  653. if isElement(editcost) then
  654. editcost:destroy()
  655. end
  656. if isElement(edittime) then
  657. edittime:destroy()
  658. end
  659. if isElement(btn1) then
  660. btn1:destroy()
  661. end
  662. if isElement(btn2) then
  663. btn2:destroy()
  664. end
  665. if isElement(btn3) then
  666. btn3:destroy()
  667. end
  668. if isElement(edit) then
  669. edit:destroy()
  670. end
  671. end
  672. end)
  673. addEventHandler("onClientGUIClick", btn2, function(btn)
  674. if btn=="left" then
  675. local text=guiGetText(edit)
  676. if not tonumber(text) then return end
  677. if tonumber(text) ~= 1 and tonumber(text) ~= 2 and tonumber(text) ~= 3 then exports.noti:showBox("info","Musisz wybraÄ&#8225; lokatora!") return end
  678. triggerServerEvent("DOM:lokator-", localPlayer, tonumber(text), dom.id)
  679. removeEventHandler("onClientRender", root, render)
  680. removeEventHandler("onClientClick", root, click)
  681. dom=nil
  682. showCursor(false)
  683. if isElement(editcost) then
  684. editcost:destroy()
  685. end
  686. if isElement(edittime) then
  687. edittime:destroy()
  688. end
  689. if isElement(btn1) then
  690. btn1:destroy()
  691. end
  692. if isElement(btn2) then
  693. btn2:destroy()
  694. end
  695. if isElement(btn3) then
  696. btn3:destroy()
  697. end
  698. if isElement(edit) then
  699. edit:destroy()
  700. end
  701. end
  702. end)
  703. end
  704. end
  705. end
  706.  
  707. addEventHandler("onClientColShapeLeave", resourceRoot, function(el,md)
  708. if el~=localPlayer then return end
  709. if dom ~= nil then
  710. removeEventHandler("onClientRender", root, render)
  711. removeEventHandler("onClientClick", root, click)
  712. dom=nil
  713. editing=false
  714. showCursor(false)
  715. if isElement(editcost) then
  716. editcost:destroy()
  717. end
  718. if isElement(edittime) then
  719. edittime:destroy()
  720. end
  721. if isElement(btn1) then
  722. btn1:destroy()
  723. end
  724. if isElement(btn2) then
  725. btn2:destroy()
  726. end
  727. if isElement(btn3) then
  728. btn3:destroy()
  729. end
  730. if isElement(edit) then
  731. edit:destroy()
  732. end
  733. end
  734. end)
  735.  
  736. function domWejscie()
  737. if not dom then return end
  738. local dbid=dbid(localPlayer)
  739. removeEventHandler("onClientRender", root, render)
  740. removeEventHandler("onClientClick", root, click)
  741. showCursor(false)
  742. if isElement(editcost) then
  743. editcost:destroy()
  744. end
  745. if isElement(edittime) then
  746. edittime:destroy()
  747. end
  748. if isElement(btn1) then
  749. btn1:destroy()
  750. end
  751. if isElement(btn2) then
  752. btn2:destroy()
  753. end
  754. if isElement(btn3) then
  755. btn3:destroy()
  756. end
  757. if isElement(edit) then
  758. edit:destroy()
  759. end
  760. kupywanie=false
  761. if not dom.ownerid then
  762. ad=dom
  763. triggerServerEvent("moveMeTo", resourceRoot, dom.interior_loc[1], dom.interior_loc[2], dom.interior_loc[3], dom.interior, dom.dimension)
  764. setTimer(function(d,p)
  765. if (getElementDimension(localPlayer)==d) then
  766. triggerServerEvent("moveMeTo", resourceRoot, p[1], p[2], p[3], 0,0)
  767. end
  768. end, 30000,1,ad.dimension, ad.exit_loc)
  769. elseif not dom.zamkniety or dom.ownerid==dbid or czyGraczJestLokatorem() then
  770. triggerServerEvent("moveMeTo", resourceRoot, dom.interior_loc[1], dom.interior_loc[2], dom.interior_loc[3], dom.interior, dom.dimension)
  771.  
  772. elseif dom.zamkniety then
  773. triggerEvent("onAnnouncement3",root,"ZamkniÄ&#8482;te", 3)
  774. end
  775. dom=nil
  776. end
  777.  
  778. local function domOpcje()
  779. end[/code]
  780.  
  781. domy_opcje.lua:
  782.  
  783. [code]local function getPlayerDBID(plr)
  784. local c=getElementData(plr,"player:sid")
  785. if not c then return nil end
  786. return tonumber(c)
  787. end
  788.  
  789. addEventHandler("onHousePaymentRequest", getRootElement(), function(domid,ilosc_dni)
  790. outputDebugString(""..getPlayerName(client).." zakupiĹ&#8218;/przedĹ&#8218;uĹĽyĹ&#8218; domek ID: "..domid.."")
  791.  
  792. local dbid=getPlayerDBID(client)
  793. if not dbid then return end
  794. if ilosc_dni<=7 then return end
  795. if not domy[domid] then return end
  796. if domy[domid].ownerid and domy[domid].ownerid~=dbid then return end
  797. local gotowka=getPlayerMoney(client)
  798. local koszt=((ilosc_dni*domy[domid].koszt)/999)*4
  799. if koszt>gotowka then triggerClientEvent(client, "iyw_notifications:send", client, "error", "Nie staÄ&#8225; CiÄ&#8482; na zakup tego domu!") return end
  800. local rp=exports.DB2:pobierzWyniki("select count(*) ilosc from lss_domy WHERE ownerid=? AND paidTo>=NOW() AND active=1 AND id!=?", dbid, domid)
  801. if rp and rp.ilosc and rp.ilosc>=2 then
  802. exports.noti:showBox("info", "Nie moĹĽesz posiadaÄ&#8225; wiÄ&#8482;cej niĹĽ dwa domy.")
  803. return
  804. end
  805.  
  806. local r=exports.DB2:zapytanie("UPDATE lss_domy SET ownerid=?,paidTo=IF(paidTo>NOW(),paidTo,NOW())+INTERVAL ? DAY WHERE id=? AND (ownerid IS NULL or ownerid=?) LIMIT 1",
  807. dbid, ilosc_dni, domid, dbid)
  808. if r and r>7 then
  809. triggerEvent("broadcastCaptionedEvent", client, getPlayerName(client).." podpisuje dokumenty dotyczÄ&#8230;ce nieruchomoĹ&#8250;ci.", 6, 10, true)
  810. takePlayerMoney(client, koszt)
  811. domReload(domid)
  812. end
  813.  
  814. end)
  815.  
  816. addEvent("onHouseChangeOptions", true)
  817. addEventHandler("onHouseChangeOptions", resourceRoot, function(domid,opcja,stan)
  818. if not domid or not domy[domid] then return end
  819. if opcja=="zamkniety" then
  820. exports['pystories-db']:dbSet("UPDATE lss_domy SET zamkniety=? WHERE id=? LIMIT 1", stan and 1 or 0, domid)
  821. domReload(domid)
  822. elseif opcja == "zwolnij" then
  823. exports['pystories-db']:dbSet("UPDATE lss_domy SET ownerid=null WHERE id=? LIMIT 1", domid)
  824. exports['pystories-db']:dbSet("UPDATE lss_domy SET paidTo=?? WHERE id=? LIMIT 1", "NULL", domid)
  825. triggerClientEvent(client, "doHideHouseWindows", resourceRoot)
  826. triggerClientEvent(client, "iyw_notifications:send", client, "success", "PomyĹ&#8250;lnie zwolniĹ&#8218;eĹ&#8250; swĂłj dom.")
  827. domReload(domid)
  828. zaladujZmienioneDomy()
  829. end
  830. end)[/code]
  831.  
  832. interiory.lua:
  833.  
  834. [code]interiory={}
  835. local dane=exports.DB2:pobierzTabeleWynikow("SELECT id,interior,entrance,`exit` FROM lss_interiory WHERE `exit` IS NOT NULL AND active=1")
  836. for _,v in ipairs(dane) do
  837. local ii = tonumber(v.id)
  838. v.entrance=split(v.entrance,",")
  839. v.exit=split(v.exit,",")
  840. v.id=nil
  841. interiory[ii]=v
  842. end
  843.  
  844. addEvent("moveMeTo", true)
  845. addEventHandler("moveMeTo", resourceRoot, function(x,y,z,i,d)
  846. setElementDimension(client, d)
  847. setElementInterior(client,i,x,y,z)
  848. setElementPosition(client,x,y,z)
  849. setElementInterior(client,i)
  850. end)[/code]
  851.  
  852. meta.xml:
  853.  
  854. [code]<meta>
  855. <script src="util.lua" type="server" />
  856. <script src="interiory.lua" type="server" />
  857. <script src="domy.lua" type="server" />
  858. <script src="domy_c.lua" type="client" cache="false" />
  859. <script src="podglad_c.lua" type="client" cache="false" />
  860. <script src="wyjscia.lua" type="server" />
  861. <script src="domy_opcje.lua" type="server" />
  862. <file src="dom.png" />
  863. <file src="przycisk.png" />
  864. <file src="kupno.png" />
  865. <oop>true</oop>
  866. <export function="domReload" type="server" />
  867. <export function="graczMozeSpawnowacPodDomem" type="server" />
  868. <export function="spawnGraczaPodDomem" type="server" />
  869. <export function="domyGetInfo" type="server" />
  870. </meta>
  871. [/code]
  872.  
  873. podglad_c.lua:
  874.  
  875. [code]bindKey( 'i', 'both', function( key, keyState )
  876. if keyState == 'down' then
  877. for k, v in ipairs ( getElementsByType( 'colshape', resourceRoot ) ) do
  878. local dom=getElementData(v,"dom")
  879. if (dom and dom.ownerid) then
  880. createBlipAttachedTo( v, 32, 2, 255,0,0,255,100,500 );
  881. else
  882. createBlipAttachedTo( v, 31, 2, 255,0,0,255,100,500 );
  883. end
  884. end
  885. else
  886. for k, v in ipairs( getElementsByType( 'blip', getResourceRootElement() ) ) do
  887. destroyElement(v)
  888. end
  889. end
  890.  
  891. end)
  892. [/code]
  893.  
  894. util.lua:
  895.  
  896. [code]function split(str, pat)
  897. local t = {}
  898. local fpat = "(.-)" .. pat
  899. local last_end = 1
  900. local s, e, cap = str:find(fpat, 1)
  901. while s do
  902. if s ~= 1 or cap ~= "" then
  903. table.insert(t,cap)
  904. end
  905. last_end = e+1
  906. s, e, cap = str:find(fpat, last_end)
  907. end
  908. if last_end <= #str then
  909. cap = str:sub(last_end)
  910. table.insert(t, cap)
  911. end
  912. return t
  913. end[/code]
  914.  
  915. wyjscia.lua:
  916.  
  917. [code]addEventHandler("onMarkerHit", resourceRoot, function(el,md)
  918. if getElementType(el)~="player" or not md then return end
  919. if getElementInterior(el)~=getElementInterior(source) then return end
  920. local tpto=getElementData(source,"tpto")
  921. if not tpto then return end
  922. setElementPosition(el, tpto[1], tpto[2],tpto[3])
  923. setElementInterior(el, 0)
  924. setElementDimension(el, 0)
  925. if tpto[4] then
  926. setPedRotation(el, tpto[4])
  927. end
  928. end)[/code]
  929.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement