Facebook
From Cream Marmoset, 5 Years ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 207
  1. -- definicja przenosnej strefy bez dm
  2. -- jest osobno od reszty gdyz musi byc synchronizowana z reszta graczy
  3.  
  4. local strefa_przenosna1=createColSphere(1083.15,-1775.30,5001.74,2)
  5. setElementData(strefa_przenosna1,"strefa",1)
  6. setElementData(strefa_przenosna1,"nospawn",1)
  7.  
  8.  
  9. local function strefaPomoc(plr)
  10.  
  11.                 outputChatBox("Użyj: /strefa <10-150> - aby zdefiniowac strefe w miejscu w ktorym stoisz", plr)
  12.                 outputChatBox("Lub: /strefa usun - aby ją usunąć", plr)
  13.                 outputChatBox("Lub: /strefa przyklej - aby ją przykleić do siebie - będzie się poruszała wraz z Tobą.", plr)
  14. end
  15.  
  16.  
  17. local function msgToGMS(msg)
  18. --      if not (exports["bp-core"]:isRCON(thePlayer)) then
  19. --              outputChatBox(msg, thePlayer, 255,100,255, true)
  20.                 triggerClientEvent ( "onAnnouncement2", getRootElement(), msg, 30 )
  21. --      end
  22. end
  23.  
  24. addCommandHandler("strefa", function(plr,cmd,argument)
  25.         if not exports["bp-core"]:isGM(plr) then return end
  26.  
  27.         if not argument then
  28.                 strefaPomoc(plr)
  29.                 return
  30.         end
  31.         if tonumber(argument) and tonumber(argument)<=150 and tonumber(argument)>=10 then
  32.                 if getElementDimension(plr)>0 or getElementInterior(plr)>0 then
  33.                         outputChatBox("W tym miejscu nie mozna utworzyc przenosnej strefy bez dm.", plr)
  34.                         return
  35.                 end
  36.                 if strefa_przenosna1 and isElement(strefa_przenosna1) then
  37.                         destroyElement(strefa_przenosna1)
  38.                 end
  39.  
  40.                 local x,y,z=getElementPosition(plr)
  41.                 strefa_przenosna1=createColSphere(x,y,z,argument)
  42.                 setElementData(strefa_przenosna1,"strefa",1)
  43.  
  44.                 msgToGMS(getPlayerName(plr) .. " zmienił/a położenie przenośnej strefy bez dm")
  45.                 return
  46.         end
  47.         if argument=="usun" then
  48.                 if strefa_przenosna1 and isElement(strefa_przenosna1) then
  49.                         destroyElement(strefa_przenosna1)
  50.                         msgToGMS(getPlayerName(plr) .. " usunął/eła przenośną strefę bez dm")
  51.                 else
  52.                         outputChatBox("Obecnie nie ma żadnej przenosnej strefy bez DM", plr)
  53.                 end
  54.                 return
  55.         end
  56.         if argument=="przyklej" then
  57.                 if getElementDimension(plr)>0 or getElementInterior(plr)>0 then
  58.                         outputChatBox("W tym miejscu nie mozna utworzyc przenosnej strefy bez dm.", plr)
  59.                         return
  60.                 end
  61.                 if strefa_przenosna1 and isElement(strefa_przenosna1) then
  62.                         attachElements(strefa_przenosna1, plr)
  63.                         msgToGMS(getPlayerName(plr) .. " przykleił/-a przenośną strefę bez DM do siebie.")
  64.  
  65.                 else
  66.                         outputChatBox("Obecnie nie ma żadnej przenosnej strefy bez DM", plr)
  67.                 end
  68.                 return
  69.         end
  70.  
  71.         strefaPomoc(plr)
  72.  
  73.  
  74. end,false,false)
  75.  
  76.  
  77. addEventHandler ( "onVehicleStartEnter", root, function(plr,seat,jacked,door)
  78.         if not jacked then return end
  79.         if (getElementData(jacked,"area") or 0) == 1 then
  80.                 outputChatBox("* W wolnej strefie nie mozna krasc pojazdow.", plr, 255,0,0)
  81.                 cancelEvent()
  82.         end
  83. end)