Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function jail ( thePlayer, command, niedouczony, ilosc )
- for i, players in ipairs(getElementsByType("player")) do
- if string.find(getPlayerName(players):lower(), tostring(niedouczony):lower(), 1, true) then
- jailPlayer3 = players
- end
- end
- local jailPlayer2 = string.gsub(getPlayerName(jailPlayer3), "#000000", "")
- local jailPlayer = getPlayerFromName(jailPlayer2)
- local jailP = string.gsub(getPlayerName(jailPlayer3), "#%x%x%x%x%x%x", "")
- local znaki = utfLen( niedouczony )
- local czas = ilosc * 1000 * 60
- local konto = getPlayerAccount( jailPlayer )
- if ( isObjectInACLGroup ( "user." .. getAccountName (getPlayerAccount (thePlayer) ), aclGetGroup ( "Policja" ) ) ) then
- if znaki >= 4 then
- if ilosc then
- if jailPlayer then
- setElementInterior(jailPlayer, 6)
- setElementPosition(jailPlayer, 264.24, 77.55, 1001.82)
- toggleControl ( jailPlayer, "fire", false )
- outputChatBox("Gracz " .. jailP .. " został uwięziony za złe zachowanie!", getRootElement(), true)
- setAccountData(konto, "jailed", true)
- function wiez()
- destroyElement(g_MissionTimer)
- setElementInterior ( jailPlayer, 0, 1486.6650390625, -1742.0140380859, 13.546875 )
- toggleControl ( jailPlayer, "fire", true )
- setAccountData( konto, "jailed", false)
- end
- local licznik = setTimer ( wiez, czas, 1 )
- if isTimer ( licznik ) then
- g_MissionTimer = exports.missiontimer:createMissionTimer (czas,true,"%m:%s",0.5,20,true,"default-bold",1,255,255,255)
- end
- else
- outputChatBox("Zły nick!", thePlayer, true)
- end
- else
- outputChatBox("Nie podałeś/aś liczby minut!", thePlayer, true)
- end
- else
- outputChatBox("Ten nick jest za krótki!", thePlayer, true)
- end
- else
- outputChatBox("Nie jesteś pracownikiem Policji!", thePlayer, true)
- end
- end
- addCommandHandler("jail", jail)
- function playerExit (pExit)
- local konto = getPlayerAccount( pExit )
- local kGracz = getAccountData(konto, "jailed")
- if kGracz == true then
- outputDebugString("1")
- local kLicznik = getMissionTimerTime(g_MissionTimer)
- setAccountData(konto, "czasJ", kLicznik)
- destroyElement(g_MissionTimer)
- end
- end
- addEventHandler ( "onPlayerQuit", getRootElement(), playerExit )
- function playerJoin (pJoin)
- local konto = getPlayerAccount( pJoin )
- local kGracz = getAccountData(konto, "jailed")
- if kGracz == true then
- local czasP = getAccountData(konto, "czasJ")
- g_MissionTimer = exports.missiontimer:createMissionTimer (tonumber(czasP),true,"%m:%s",0.5,20,true,"default-bold",1,255,255,255)
- outputChatBox("Szkoda! Przed wyjściem byłeś w więzieniu!", pJoin)
- else
- outputChatBox("Super! Wcześniej nie byłeś w więzieniu!", pJoin)
- end
- end
- addEventHandler ( "onPlayerLogin", getRootElement(), playerJoin )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement