Brolis Posted August 13, 2012 Posted August 13, 2012 Hi again, today I would like to ask you to give me a link to script/resource or create it to me, say how to create and ect. for not allowed vehicles. Simple: I get in infernus and I have been kicked from this car with a chatboxmsg: * You are not allowed to drive this! Or, When I am trying to get in I am not get'n there just no action with a same message. Or something I just said. Please, help me someone. Thanks a lot!
Agon Posted August 13, 2012 Posted August 13, 2012 OnVehicleStartEnter cancelEvent outputChatBox I think these can help you
Xeno Posted August 13, 2012 Posted August 13, 2012 function enter ( theVehicle ) local id = getElementModel ( theVehicle ) -- get the model ID of the vehicle if id == 519 or id == 577 then cancelEvent () outputChatBox("You're not allowed to drive this vehicle!") end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), enter ) This may work, I have not tested it, I just simply edited some wiki thing. You'll have to replace the ID's though so they are the infernus's ID. PS. Sorry if it doesn't work, as I said - I've not tested it.
Xeno Posted August 13, 2012 Posted August 13, 2012 function enter ( theVehicle, player ) local id = getElementModel ( theVehicle ) -- get the model ID of the vehicle if id == 487 or id == 577 then removePedFromVehicle ( source ) outputChatBox("You're not allowed to drive this vehicle!") end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), enter ) Fixed and tested.
denny199 Posted August 15, 2012 Posted August 15, 2012 I had this too, that 'theVehicle' isn't working anymore with that handler use getPedOccupiedVehicle() that should work.
Guest Guest4401 Posted August 15, 2012 Posted August 15, 2012 addEventHandler("onVehicleStartEnter",root, function() cancelEvent() end ) Using ^that event is much more smoother in my opinion.
denny199 Posted August 15, 2012 Posted August 15, 2012 that's true. But he doesn't say that it needs to be canceled for all vehicles.
Guest Guest4401 Posted August 15, 2012 Posted August 15, 2012 But he doesn't say that it needs to be canceled for all vehicles. Simple: I get in infernus and I have been kicked from this car with a chatboxmsg: * You are not allowed to drive this! addEventHandler("onVehicleStartEnter",root, function(p) if getVehicleName(source) == "Infernus" then outputChatBox("* You are not allowed to drive this!",p) cancelEvent() end end )
Buffalo Posted August 15, 2012 Posted August 15, 2012 root = getRootElement() local blockedVehicleIDS = {[402]=true,[411]=true} addEventHandler("onVehicleStartEnter",root, function(p) if blockedVehicleIDS[getElementModel(source) ] then outputChatBox("* You are not allowed to drive this!",p) cancelEvent() end end ) Just optimized.. if list get too big
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