Brolis Posted August 13, 2012 Share 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! Link to comment
Agon Posted August 13, 2012 Share Posted August 13, 2012 OnVehicleStartEnter cancelEvent outputChatBox I think these can help you Link to comment
Xeno Posted August 13, 2012 Share 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. Link to comment
Brolis Posted August 13, 2012 Author Share Posted August 13, 2012 Not working, help me. Link to comment
Xeno Posted August 13, 2012 Share 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. Link to comment
Brolis Posted August 15, 2012 Author Share Posted August 15, 2012 Not working man... Just not working... Link to comment
denny199 Posted August 15, 2012 Share Posted August 15, 2012 I had this too, that 'theVehicle' isn't working anymore with that handler use getPedOccupiedVehicle() that should work. Link to comment
Guest Guest4401 Posted August 15, 2012 Share Posted August 15, 2012 addEventHandler("onVehicleStartEnter",root, function() cancelEvent() end ) Using ^that event is much more smoother in my opinion. Link to comment
denny199 Posted August 15, 2012 Share Posted August 15, 2012 that's true. But he doesn't say that it needs to be canceled for all vehicles. Link to comment
Guest Guest4401 Posted August 15, 2012 Share 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 ) Link to comment
Buffalo Posted August 15, 2012 Share 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 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