Xwad Posted July 22, 2016 Share Posted July 22, 2016 why is my code not working?? tank = {[496]=true} skins = { [100]=true,[101]=true,[102]=true,[103]=true } function disableEnemyTankUsage ( player, seat, jacked ) if ( tank[getElementModel(source)] ) and ( not skins[getElementModel(player)] ) then cancelEvent() outputChatBox ( "Enemy vehicle!", player ) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), disableEnemyTankUsage ) Link to comment
Walid Posted July 22, 2016 Share Posted July 22, 2016 Working fine: Make sure you are not wearing one of these skins : 100,101,102,103. Make sure you are trying to enter Blista Compact vehicle Id : 496. local tank = {[496]=true} local skins = { [100]=true,[101]=true,[102]=true,[103]=true } function disableEnemyTankUsage ( player, seat, jacked ) if ( tank[getElementModel(source)] ) and ( not skins[getElementModel(player)] ) then cancelEvent() outputChatBox ( "Enemy vehicle!", player ) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), disableEnemyTankUsage ) Link to comment
Xwad Posted July 24, 2016 Author Share Posted July 24, 2016 Hey i have one more question: I want to disable that players can demage other player who are in a vehicle. I made the script but its not working: function stopMinigunDamage ( attacker, weapon, bodypart ) outputChatBox("test", 255, 255, 255) if isPedInVehicle (localPlayer) then cancelEvent() end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage ) Link to comment
Xwad Posted July 24, 2016 Author Share Posted July 24, 2016 ohh fixed, i just used getRootElement () 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