K4stic Posted March 24, 2013 Share Posted March 24, 2013 -- Disabled the seasparrow weapons for player not in staff or military forces team addEventHandler("onClientVehicleStartEnter", root, function(thePlayer, seat) if ( thePlayer == localPlayer ) then if ( getElementModel ( source ) == 447 ) or ( getElementModel ( source ) == 425 ) or ( getElementModel ( source ) == 520 ) then if (getTeamName(getPlayerTeam(thePlayer)) == "Staff") or (getTeamName(getPlayerTeam(thePlayer)) == "Armed Forces") then toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) else toggleControl ( "vehicle_fire", false ) toggleControl ( "vehicle_secondary_fire", false ) end end end end ) -- Enable the weapons again when the player leaves the vehicle addEventHandler("OnClientVehicleStartExit", root, function(thePlayer, seat) if thePlayer == localPlayer then if ( getElementModel ( source ) == 447 ) or ( getElementModel ( source ) == 425 ) or ( getElementModel ( source ) == 520 ) then if not (getTeamName(getPlayerTeam(thePlayer)) == "Staff") or not (getTeamName(getPlayerTeam(thePlayer)) == "Armed Forces") then toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) end end end end ) it no disable the weapon for other teams i wonna to player can shoot with that vehicles only if he Staff or Armed Forces but it no disable it Link to comment
Castillo Posted March 24, 2013 Share Posted March 24, 2013 local vehicles = { [ 447 ] = true, [ 425 ] = true, [ 520 ] = true } local teams = { [ "Staff" ] = true, [ "Armed Forces" ] = true } -- Disabled the seasparrow weapons for player not in staff or military forces team addEventHandler ( "onClientVehicleStartEnter", root, function ( thePlayer, seat ) if ( thePlayer == localPlayer ) then if ( vehicles [ getElementModel ( source ) ] ) then local team = getPlayerTeam ( thePlayer ) if ( team and teams [ getTeamName ( team ) ] ) then toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) else toggleControl ( "vehicle_fire", false ) toggleControl ( "vehicle_secondary_fire", false ) end end end end ) -- Enable the weapons again when the player leaves the vehicle addEventHandler ( "onClientVehicleStartExit", root, function ( thePlayer, seat ) if ( thePlayer == localPlayer ) then if ( vehicles [ getElementModel ( source ) ] ) then local team = getPlayerTeam ( thePlayer ) if ( not team or not teams [ getTeamName ( team ) ] ) then toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) end end end end ) Try that. Link to comment
K4stic Posted March 24, 2013 Author Share Posted March 24, 2013 no work and no errors Link to comment
Castillo Posted March 24, 2013 Share Posted March 24, 2013 Try making the script server side. 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