Bean666 Posted April 30, 2015 Author Share Posted April 30, 2015 tried this but all can enter: function cars () c1 = createVehicle ( 520, 227.69921875, 1882.142578125, 17.640625, 0, 0, 90 ) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if source == c1 and ( getElementData(source, "gang") == "Alpha Team" ) then outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) cancelEvent() end end addEventHandler("onVehicleStartEnter", root, onEnter) Link to comment
Walid Posted April 30, 2015 Share Posted April 30, 2015 (edited) that's wrong you must replace source with thePlayer try this function cars () c1 = createVehicle ( 520, 227.69921875, 1882.142578125, 17.640625, 0, 0, 90 ) addEventHandler("onVehicleStartEnter", root, onEnter) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if ( getElementData(thePlayer, "gang") == "Alpha Team" ) then outputChatBox("Sorry you can't enter this vehicle", thePlayer, 0, 255, 0) cancelEvent() end end Edited April 30, 2015 by Guest Link to comment
Dimos7 Posted April 30, 2015 Share Posted April 30, 2015 function cars () c1 = createVehicle ( 520, 227.69921875, 1882.142578125, 17.640625, 0, 0, 90 ) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if source == c1 and ( getElementData(thePlayer, "gang") == "Alpha Team" ) then outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) cancelEvent() end end addEventHandler("onVehicleStartEnter", root, onEnter) Link to comment
Bean666 Posted April 30, 2015 Author Share Posted April 30, 2015 BOTH DON'T WORK OMFG. Link to comment
Walid Posted April 30, 2015 Share Posted April 30, 2015 BOTH DON'T WORK OMFG. are you serious man , it's working fine are you sure that your gang is Alpha Team. Link to comment
Bean666 Posted April 30, 2015 Author Share Posted April 30, 2015 (edited) I'm in the Alpha Team gang and still doesnt work , only people in Alpha Team gang can't enter the vehicle but people not in the Alpha Team gang can enter it , e.e Edited May 1, 2015 by Guest Link to comment
Walid Posted May 1, 2015 Share Posted May 1, 2015 I'm in the Alpha Team gang and still doesnt work , only people in Alpha Team gang can't enter the vehiclebut people not in the Alpha Team gang can enter it , e.e it's very easy but i don't know why you still asking for help as i told in the last code you prevent players in Alpha Team from entering this vehicle , so to change it you must change your code like this : == : Equal ~= : Different function cars () c1 = createVehicle ( 520, 227.69921875, 1882.142578125, 17.640625, 0, 0, 90 ) addEventHandler("onVehicleStartEnter", root, onEnter) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if ( getElementData(thePlayer, "gang") ~= "Alpha Team" ) then outputChatBox("Sorry you can't enter this vehicle", thePlayer, 0, 255, 0) cancelEvent() end end Now Only Players in Alpha Team group can enter the c1 vehicle. Link to comment
Irish Posted May 1, 2015 Share Posted May 1, 2015 My code and other people's code are working fine, he's just kidding all of us and nothing else. 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