botshara Posted November 13, 2013 Share Posted November 13, 2013 Where is the problem ? I dont get message this police car.... and i can eneter in car addEventHandler( "onVehicleStartEnter", root, function( player, seat ) local id = getElementModel ( theVehicle ) if seat == 0 and id == 596 then outputChatBox( "(( This is police car, you cant drive with it!. ))", player, 255, 0, 0 ) cancelEvent( ) end end ) Link to comment
tosfera Posted November 13, 2013 Share Posted November 13, 2013 Where did you define 'theVehicle'. Nowhere, the source of the event is the vehicle. Change 'theVehicle' to 'source' and it will work. Link to comment
botshara Posted November 13, 2013 Author Share Posted November 13, 2013 (edited) thanks, another problem how to not equal on line 5 ? addEventHandler( "onVehicleStartEnter", root, function( player, seat ) local id = getElementModel ( source ) if seat == 0 and id == 596 and exports.factions:isPlayerInFaction( player, ~=1 ) then outputChatBox( "(( This is police car, you cant drive with it!. . ))", player, 255, 0, 0 ) cancelEvent( ) end end ) and exports.factions:isPlayerInFaction( player, ~=1 ) Edited November 13, 2013 by Guest Link to comment
tosfera Posted November 13, 2013 Share Posted November 13, 2013 isPlayerInFaction returns a value, if you would play 'not' infront of the exports.factions: it would automaticly see that as a flipped value ( true to false, false to true. ) if ( ( seat == 0 ) and ( id == 596 ) and not ( exports.factions:isPlayerInFaction ( player, 1 ) ) then 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