illestiraqi Posted March 7, 2013 Share Posted March 7, 2013 I want script that restricts certain vehicles to certain skin or team. Link to comment
PaiN^ Posted March 8, 2013 Share Posted March 8, 2013 Event : "onVehicleStartEnter" functions : getElementModel getPlayerSkin or getPlayerTeam and getTeamName cancelEvent ( ) Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 Event : "onVehicleStartEnter" functions : getElementModel getPlayerSkin or getPlayerTeam and getTeamName cancelEvent ( ) Can the script be made please? Link to comment
PaiN^ Posted March 8, 2013 Share Posted March 8, 2013 I don't usually do any scripts for people that don't try, Cause they'll never learn . But i'll do it for you this time . This Well restrict a player that dose not have a certain skin from entering a certain vehicle . Server : addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer ) if ( getElementModel ( source ) == carID ) and ( getPlayerSkin ( enteringPlayer ) ~= skinID ) then cancelEvent( ) end end ) Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 I don't usually do any scripts for people that don't try, Cause they'll never learn .But i'll do it for you this time . This Well restrict a player that dose not have a certain skin from entering a certain vehicle . Server : addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer ) if ( getElementModel ( source ) == carID ) and ( getPlayerSkin ( enteringPlayer ) ~= skinID ) then cancelEvent( ) end end ) Is there ONLY server or client to? Link to comment
PaiN^ Posted March 8, 2013 Share Posted March 8, 2013 You mean can you do it client side .? If so, Yes you can, Just change the event into onClientVehicleStartEnter, Change the parameters and it should work . Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 You mean can you do it client side .? If so, Yes you can, Just change the event into onClientVehicleStartEnter, Change the parameters and it should work . Here is the script: addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer ) if ( getElementModel ( source ) == 427 ) and ( getPlayerSkin ( enteringPlayer ) ~= 285 ) then cancelEvent( ) end end ) This makes the Enforcer Restricted to the Swat skin, and I also want it to allow the 217 (Staff Skin) to be able to go in it to. How will I make that? Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 You Mean No One Can Use Vehicle Just Staff Skin (217) and Swat Skin (427) Can Use Vehicles? Link to comment
Vision Posted March 8, 2013 Share Posted March 8, 2013 Like this? addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer ) local skin = getElementModel ( enteringPlayer ) if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then cancelEvent( ) end end ) Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 Like this? addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer ) local skin = getElementModel ( enteringPlayer ) if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then cancelEvent( ) end end ) Yes, Perfect, 1 more thing to add to it. If user is not skin it say "You Are Not Part Of The SWAT Team To Enter This Vehicle" please add that Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer ) local skin = getElementModel ( enteringPlayer ) if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then cancelEvent( ) outputChatBox("You Are Not Part Of The SWAT Team To Enter This Vehicle",enteringPlayer,255,0,0,true) end end ) Link to comment
PaiN^ Posted March 8, 2013 Share Posted March 8, 2013 addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer ) local skin = getElementModel ( enteringPlayer ) if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then cancelEvent( ) outputChatBox( "You Are Not Part Of The SWAT Team To Enter This Vehicle", enteringPlayer, 255, 0, 0, true ) end end ) EDIT : LooL, Same time me and Mr.Pres[T]ege Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer ) local skin = getElementModel ( enteringPlayer ) if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then cancelEvent( ) outputChatBox( "You Are Not Part Of The SWAT Team To Enter This Vehicle", enteringPlayer, 255, 0, 0, true ) end end ) EDIT : LooL, Same time me and Mr.Pres[T]ege addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer ) local skin = getElementModel ( enteringPlayer ) if ( getElementModel ( source ) == 427 ) and not ( skin == 285 or skin == 217 ) then cancelEvent( ) outputChatBox("You Are Not Part Of The SWAT Team To Enter This Vehicle",enteringPlayer,255,0,0,true) end end ) Sorry If I'm wasting your time but this spams my server and it should show it like every 5 seconds or 3 EDIT: also the skins that have no rights to enter the vehicle should be alowed to enter as passenger please fix. Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 The msg it will show only if you're trying to enter the vehicle and you aren't on swat skin or staff skin and what you mean with that you say you just want staff and swat skin can enter the vehicle right? 427 Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 The msg it will show only if you're trying to enter the vehicle and you aren't on swat skin or staff skin and what you mean with that you say you just want staff and swat skin can enter the vehicle right? 427 Right, only swat and staff skin can enter enforcer 427 id but other skins should be alowed to enter as passenger. Link to comment
Vision Posted March 8, 2013 Share Posted March 8, 2013 addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer, seat ) local skin = getElementModel ( enteringPlayer ) if ( getElementModel ( source ) == 427 and seat == 0 ) and not ( skin == 285 or skin == 217 ) then outputChatBox ( "You Are Not Part Of The SWAT Team To Enter This Vehicle", enteringPlayer, 255, 0, 0, true ) cancelEvent( ) end end ) Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer, seat ) local skin = getElementModel ( enteringPlayer ) if ( getElementModel ( source ) == 427 and seat == 0 ) and not ( skin == 285 or skin == 217 ) then outputChatBox ( "You Are Not Part Of The SWAT Team To Enter This Vehicle", enteringPlayer, 255, 0, 0, true ) cancelEvent( ) end end ) Works thanks. but it spams my server if they press enter more than 5 times in less than 1 seconds its spam, it should be like 1 time every 3 seconds can you do that plz? Link to comment
Castillo Posted March 8, 2013 Share Posted March 8, 2013 Use tables and getTickCount to determine the last time he tried to enter. Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 Use tables and getTickCount to determine the last time he tried to enter. Can you add that to the latest script done for me? 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