adward Posted November 20, 2011 Share Posted November 20, 2011 hi 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) this script for castillo i need make some change when player in the vehicle i cant jail him why? i need removePedFromVehicle how? Link to comment
unknooooown Posted November 20, 2011 Share Posted November 20, 2011 You can do something like: function Jail (player, command, name) local thePlayer = getPlayerFromName(name) local theVehicle = getPedOccupiedVehicle(thePlayer) if thePlayer then ---------------------------------------------------- if theVehicle then removePedFromVehicle(thePlayer) end --------------------------------------------------- setElementPosition ( thePlayer, 3, 4, 20 ) setElementData ( thePlayer, "isJailed", true ) outputChatBox (name.." has been jailed", getRootElement(), 255, 255, 255, true ) end end addCommandHandler("jail",Jail) The reason you can't move the player when he is in a vehicle, is that both elements would have to be moved. But since a player wouldn't bring his vehicle to jail, we don't need to move anything other than thePlayer. 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