Jump to content

Jail


joedajoester

Recommended Posts

I have a jail script TAPL helped with and i edited, now i need to disable peoples f1 menu and /wt and /kill. How would i do that and enable that all when theyre unjailed?

Also how to make everyone get jailed in random coordinates?

function Jail (player, command, name) 
local thePlayer = getPlayerFromName(name) 
     if thePlayer then 
     setElementPosition ( thePlayer, 3, 4, 20 ) 
outputChatBox (name.." has been jailed", getRootElement(), 255, 255, 255, true ) 
     end 
end 
addCommandHandler("jail",Jail) 
  
 function Unjail (player, command, name) 
local thePlayer = getPlayerFromName(name) 
     if thePlayer then 
     setElementPosition ( thePlayer, 3, 4, 20 ) 
outputChatBox (name.." has been unjailed", getRootElement(), 255, 255, 255, true ) 
     end 
 end 
addCommandHandler("unjail",Unjail) 

Link to comment
function Jail (player, command, name) 
local thePlayer = getPlayerFromName(name) 
     if thePlayer then 
     setElementPosition ( thePlayer, 3, 4, 20 ) 
     setElementData ( thePlayer, "isJailed", true ) 
     outputChatBox (name.." has been jailed", getRootElement(), 255, 255, 255, true ) 
     end 
end 
addCommandHandler("jail",Jail) 
  
 function Unjail (player, command, name) 
local thePlayer = getPlayerFromName(name) 
     if thePlayer then 
     setElementPosition ( thePlayer, 3, 4, 20 ) 
     setElementData ( thePlayer, "isJailed", false ) 
     outputChatBox (name.." has been unjailed", getRootElement(), 255, 255, 255, true ) 
     end 
 end 
addCommandHandler("unjail",Unjail) 

Then in your script you check the "isJailed" element data.

Link to comment

I have this script, i need it so if someone is already jailed, they cannot be jailed again, also for unjailing.

function Jail (player, command, name) 
local thePlayer = getPlayerFromName(name) 
     if thePlayer then 
     setElementPosition ( thePlayer, 52, 2483, 21 ) 
     setElementData ( thePlayer, "isJailed", true ) 
     outputChatBox (name.." has been jailed", getRootElement(), 255, 0, 0, true ) 
     toggleAllControls ( thePlayer, false )   
     end 
end 
addCommandHandler("jail",Jail) 
  
 function Unjail (player, command, name) 
local thePlayer = getPlayerFromName(name) 
     if thePlayer then 
     setElementPosition ( thePlayer, 72, 2484, 17 ) 
     setElementData ( thePlayer, "isJailed", false ) 
     outputChatBox (name.." has been unjailed. Be good now, "..name, getRootElement(), 0, 255, 0, true ) 
     toggleAllControls ( thePlayer, true )   
     end 
 end 
addCommandHandler("unjail",Unjail) 

thanks :D

Link to comment
function Jail (player, command, name) 
local thePlayer = getPlayerFromName(name) 
     if thePlayer then 
     if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",player,255,0,0) return end 
     setElementPosition ( thePlayer, 52, 2483, 21 ) 
     setElementData ( thePlayer, "isJailed", true ) 
     outputChatBox (name.." has been jailed", getRootElement(), 255, 0, 0, true ) 
     toggleAllControls ( thePlayer, false )   
     end 
end 
addCommandHandler("jail",Jail) 
  
 function Unjail (player, command, name) 
local thePlayer = getPlayerFromName(name) 
     if thePlayer then 
     if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",player,255,0,0) return end 
     setElementPosition ( thePlayer, 72, 2484, 17 ) 
     setElementData ( thePlayer, "isJailed", false ) 
     outputChatBox (name.." has been unjailed. Be good now, "..name, getRootElement(), 0, 255, 0, true ) 
     toggleAllControls ( thePlayer, true )   
     end 
 end 
addCommandHandler("unjail",Unjail) 

Should work.

Link to comment
function getPlayerFromPartOfName(playerPart) 
  local pl = getPlayerFromName(playerPart) 
  if isElement(pl) then 
    return pl 
  else 
    for i,v in ipairs (getElementsByType ("player")) do 
      if (string.find(getPlayerName(v),playerPart)) then 
        return v 
      end 
    end 
  end 
end 
  
function Jail (player, command, name) 
local thePlayer = getPlayerFromPartOfName(name) 
     if thePlayer then 
     if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",player,255,0,0) return end 
     setElementPosition ( thePlayer, 52, 2483, 21 ) 
     setElementData ( thePlayer, "isJailed", true ) 
     outputChatBox (name.." has been jailed", getRootElement(), 255, 0, 0, true ) 
     toggleAllControls ( thePlayer, false )   
     end 
end 
addCommandHandler("jail",Jail) 
  
 function Unjail (player, command, name) 
local thePlayer = getPlayerFromPartOfName(name) 
     if thePlayer then 
     if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",player,255,0,0) return end 
     setElementPosition ( thePlayer, 72, 2484, 17 ) 
     setElementData ( thePlayer, "isJailed", false ) 
     outputChatBox (name.." has been unjailed. Be good now, "..name, getRootElement(), 0, 255, 0, true ) 
     toggleAllControls ( thePlayer, true )   
     end 
 end 
addCommandHandler("unjail",Unjail) 

Link to comment

as Solidsnake said

in file "fr_client.lua" in freeroam

you just need for this

if (getElementData(localPlayer, "isJailed") == true) then return end 

so for disable /wt

function warpToCommand(cmd, player) 
if (getElementData(localPlayer, "isJailed") == true) then return end 
    if player then 
        player = getPlayerFromNick(player) 
        if player then 
            server.warpMe(player) 
        end 
    else 
        createWindow(wndWarp) 
        showCursor(true) 
    end 
end 

and F1 menu

  
function toggleFRWindow() 
if (getElementData(localPlayer, "isJailed") == true) then return end 
    if isWindowOpen(wndMain) then 
        showCursor(false) 
        hideAllWindows() 
        colorPicker.closeSelect() 
    else 
        showCursor(true) 
        showAllWindows() 
    end 
end 

and /kill

function killLocalPlayer() 
if (getElementData(localPlayer, "isJailed") == true) then return end 
    server.killPed(g_Me) 
end 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...