Rotti Posted July 25, 2013 Posted July 25, 2013 Hello, I'm scripting my police fraction at the moment. I wanted to make a /tie command so that the police can shakle the player on the back seat, so that he can't get out of the car. I've tried it with this code: function fesseln(player) outputChatBox("Gefangener im Auto gefesselt",player, 255, 255, 0) local playerTeam = getPlayerTeam ( player ) if (playerTeam == Polizei or playerTeam == FBI or PlayerTeam == Army) then if isPedInVehicle(player) == true then vehicle = getPedOccupiedVehicle(player) if ( policeVehicles[getElementModel ( vehicle )] ) then gefangener = getVehicleOccupant(vehicle, 2) setElementFrozen(gefangener, true) end end end end addCommandHandler("tie", fesseln) Thats where the police Vehicles are defined: policeVehicles = { [598]=true, [596]=true, [597]=true, [599]=true } But the player can exit the car! Can someone help me to fix it?
Rotti Posted July 25, 2013 Author Posted July 25, 2013 so that his key to exit the car is unbound? But maybe he has changed the key in the settings that he exits the car with O and not with enter or e
Alen141 Posted July 25, 2013 Posted July 25, 2013 so that his key to exit the car is unbound? But maybe he has changed the key in the settings that he exits the car with O and not with enter or e good point
Rotti Posted July 25, 2013 Author Posted July 25, 2013 thats the problem. There must be some other ways
Castillo Posted July 25, 2013 Posted July 25, 2013 function fesseln ( player ) outputChatBox ( "Gefangener im Auto gefesselt",player, 255, 255, 0 ) local playerTeam = getPlayerTeam ( player ) if ( playerTeam == Polizei or playerTeam == FBI or PlayerTeam == Army ) then if isPedInVehicle ( player ) then local vehicle = getPedOccupiedVehicle ( player ) if ( policeVehicles [ getElementModel ( vehicle ) ] ) then local gefangener = getVehicleOccupant ( vehicle, 2 ) toggleControl ( gefangener, "enter_exit", false ) end end end end addCommandHandler ( "tie", fesseln ) This will stop the player from leaving the vehicle. P.S: You've got defined the team variables, right?
Rotti Posted July 25, 2013 Author Posted July 25, 2013 Thanks it worked! yes i'Ve defined the team variables
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