Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2012
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.81 KB | None | 0 0
  1. function jail ( thePlayer, command, niedouczony, ilosc )
  2.     for i, players in ipairs(getElementsByType("player")) do
  3.         if string.find(getPlayerName(players):lower(), tostring(niedouczony):lower(), 1, true) then
  4.             jailPlayer3 = players
  5.         end
  6.     end
  7.     local jailPlayer2 = string.gsub(getPlayerName(jailPlayer3), "#000000", "")
  8.     local jailPlayer = getPlayerFromName(jailPlayer2)
  9.     local jailP = string.gsub(getPlayerName(jailPlayer3), "#%x%x%x%x%x%x", "")
  10.     local znaki = utfLen( niedouczony )
  11.     local czas = ilosc * 1000 * 60
  12.     local konto = getPlayerAccount( jailPlayer )
  13.     if ( isObjectInACLGroup ( "user." .. getAccountName (getPlayerAccount (thePlayer) ), aclGetGroup ( "Policja" ) ) ) then
  14.         if znaki >= 4 then
  15.             if ilosc then
  16.                 if jailPlayer then
  17.                     setElementInterior(jailPlayer, 6)
  18.                     setElementPosition(jailPlayer, 264.24, 77.55, 1001.82)
  19.                     toggleControl ( jailPlayer, "fire", false )
  20.                     outputChatBox("Gracz " .. jailP .. " został uwięziony za złe zachowanie!", getRootElement(), true)  
  21.                     setAccountData(konto, "jailed", true)
  22.                     function wiez()
  23.                         destroyElement(g_MissionTimer)
  24.                         setElementInterior ( jailPlayer, 0, 1486.6650390625, -1742.0140380859, 13.546875 )
  25.                         toggleControl ( jailPlayer, "fire", true )
  26.                         setAccountData( konto, "jailed", false)
  27.                     end
  28.                     local licznik = setTimer ( wiez, czas, 1 )
  29.                     if isTimer ( licznik ) then
  30.                         g_MissionTimer = exports.missiontimer:createMissionTimer (czas,true,"%m:%s",0.5,20,true,"default-bold",1,255,255,255)
  31.                     end
  32.                 else
  33.                     outputChatBox("Zły nick!", thePlayer, true)
  34.                 end
  35.             else
  36.                 outputChatBox("Nie podałeś/aś liczby minut!", thePlayer, true)
  37.             end
  38.         else
  39.             outputChatBox("Ten nick jest za krótki!", thePlayer, true)
  40.         end
  41.     else
  42.         outputChatBox("Nie jesteś pracownikiem Policji!", thePlayer, true)
  43.     end
  44. end
  45. addCommandHandler("jail", jail)
  46.  
  47. function playerExit (pExit)
  48.     local konto = getPlayerAccount( pExit )
  49.     local kGracz = getAccountData(konto, "jailed")
  50.     if kGracz == true then
  51.         outputDebugString("1")
  52.         local kLicznik = getMissionTimerTime(g_MissionTimer)
  53.         setAccountData(konto, "czasJ", kLicznik)
  54.         destroyElement(g_MissionTimer)
  55.     end
  56. end
  57. addEventHandler ( "onPlayerQuit", getRootElement(), playerExit )
  58.  
  59. function playerJoin (pJoin)
  60.     local konto = getPlayerAccount( pJoin )
  61.     local kGracz = getAccountData(konto, "jailed")
  62.     if kGracz == true then
  63.         local czasP = getAccountData(konto, "czasJ")
  64.         g_MissionTimer = exports.missiontimer:createMissionTimer (tonumber(czasP),true,"%m:%s",0.5,20,true,"default-bold",1,255,255,255)
  65.         outputChatBox("Szkoda! Przed wyjściem byłeś w więzieniu!", pJoin)
  66.     else
  67.         outputChatBox("Super! Wcześniej nie byłeś w więzieniu!", pJoin)
  68.     end
  69. end
  70. addEventHandler ( "onPlayerLogin", getRootElement(), playerJoin )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement