joedajoester Posted November 11, 2011 Share Posted November 11, 2011 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
Castillo Posted November 11, 2011 Share Posted November 11, 2011 I suggest setting a element data to the player and then check it when they type /kill and try to open F1. Link to comment
joedajoester Posted November 11, 2011 Author Share Posted November 11, 2011 I have no idea what that means. Sorry, can you explain this or another way. Well, i know what it means, but i never had experience with it. Link to comment
Castillo Posted November 11, 2011 Share Posted November 11, 2011 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
joedajoester Posted November 12, 2011 Author Share Posted November 12, 2011 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 Link to comment
Castillo Posted November 12, 2011 Share Posted November 12, 2011 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
joedajoester Posted November 12, 2011 Author Share Posted November 12, 2011 And also, partial name i tried but it doesnt work. Do you know anything bout that? Link to comment
Castillo Posted November 12, 2011 Share Posted November 12, 2011 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
TAPL Posted November 12, 2011 Share Posted November 12, 2011 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
joedajoester Posted November 12, 2011 Author Share Posted November 12, 2011 Oh my god, thank you ALL SOOOOO MUCH! Thank you omg thanks! You guys helped me so much, that im afraid to ask for more help, thinking it might annoy you guys, will it lol thanks! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now