igthomas Posted February 16, 2012 Posted February 16, 2012 Here's a script that I've made but the problem is that everyone can enter the vehicles not only FBI fbi1 = createVehicle ( 596, -2429.7998046875, 515.2998046875, 29.700000762939, 0, 0, 215.99670410156 ) fbi2 = createVehicle ( 596, -2425.69921875, 518.5, 29.700000762939, 0, 0, 221.99523925781 ) fbi3 = createVehicle ( 596, -2422.3994140625, 521.599609375, 29.700000762939, 0, 0, 225 ) function lockfbi(player, seat, jacked) if (source == fbi1 and source == fbi2 and source == fbi3) then local skin = getElementModel (thePlayer) if ( skin == 100 or skin == 255) then return end cancelEvent() outputChatBox ( "Only FBI can enter this vehicle", player, 0, 0, 150, true ) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockfbi )
SDK Posted February 16, 2012 Posted February 16, 2012 Some small mistakes fbi1 = createVehicle ( 596, -2429.7998046875, 515.2998046875, 29.700000762939, 0, 0, 215.99670410156 ) fbi2 = createVehicle ( 596, -2425.69921875, 518.5, 29.700000762939, 0, 0, 221.99523925781 ) fbi3 = createVehicle ( 596, -2422.3994140625, 521.599609375, 29.700000762939, 0, 0, 225 ) function lockfbi(player, seat, jacked) if (source == fbi1 or source == fbi2 or source == fbi3) then local skin = getElementModel (player) if ( skin == 100 or skin == 255) then cancelEvent() outputChatBox ( "Only FBI can enter this vehicle", player, 0, 0, 150, true ) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockfbi ) Learn Lua - Learn to script - GUI scripting Scripter tools - Find/fix errors yourself(!) Don't pm me for scripting help, keep it for the Scripting subforum!
igthomas Posted February 16, 2012 Author Posted February 16, 2012 Tried and same problem everyone can enter
Moderators Sarrum Posted February 16, 2012 Moderators Posted February 16, 2012 fbi1 = createVehicle ( 596, -2429.7998046875, 515.2998046875, 29.700000762939, 0, 0, 215.99670410156 ) fbi2 = createVehicle ( 596, -2425.69921875, 518.5, 29.700000762939, 0, 0, 221.99523925781 ) fbi3 = createVehicle ( 596, -2422.3994140625, 521.599609375, 29.700000762939, 0, 0, 225 ) function lockfbi(player, seat, jacked) if (source == fbi1 or source == fbi2 or source == fbi3) then local skin = getElementModel (player) if not (skin == 100 or skin == 255) then --FBI skins cancelEvent() outputChatBox ( "Only FBI can enter this vehicle", player, 0, 0, 150, true ) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockfbi )
denny199 Posted February 16, 2012 Posted February 16, 2012 It's onVehicleEnter.... fbi1 = createVehicle ( 596, -2429.7998046875, 515.2998046875, 29.700000762939, 0, 0, 215.99670410156 ) fbi2 = createVehicle ( 596, -2425.69921875, 518.5, 29.700000762939, 0, 0, 221.99523925781 ) fbi3 = createVehicle ( 596, -2422.3994140625, 521.599609375, 29.700000762939, 0, 0, 225 ) function lockfbi(player, seat, jacked) if (source == fbi1 or source == fbi2 or source == fbi3) then local skin = getElementModel (player) if not (skin == 100 or skin == 255) then --FBI skins removePedFromVehicle ( player ) outputChatBox ( "Only FBI can enter this vehicle", player, 0, 0, 150, true ) end end end addEventHandler ( "onVehicleEnter", getRootElement(), lockfbi ) Sometimes I dream about cheese
Castillo Posted February 16, 2012 Posted February 16, 2012 Why denny? you can cancel the event "onVehicleStartEnter", instead of removing the player from the vehicle. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
denny199 Posted February 16, 2012 Posted February 16, 2012 Searched wrong sorry, my mistake, i was tought it was a old event... Sometimes I dream about cheese
igthomas Posted February 16, 2012 Author Posted February 16, 2012 Thanks ZverCR it worked and this mistake won't happen again ;P and last question is it possible to change the car color with createVehicle? or should I make a new function where I mention the car colors?
Kenix Posted February 16, 2012 Posted February 16, 2012 setVehicleColor http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
igthomas Posted February 18, 2012 Author Posted February 18, 2012 Guys I have another problem now: only FBi can enter car and only they can seat as passanger so if I spawn as another skin I couldn't even press g
Kenix Posted February 18, 2012 Posted February 18, 2012 (edited) fbi1 = createVehicle ( 596, -2429.7998046875, 515.2998046875, 29.700000762939, 0, 0, 215.99670410156 ) fbi2 = createVehicle ( 596, -2425.69921875, 518.5, 29.700000762939, 0, 0, 221.99523925781 ) fbi3 = createVehicle ( 596, -2422.3994140625, 521.599609375, 29.700000762939, 0, 0, 225 ) function lockfbi( player, seat, jacked ) if source == fbi1 or source == fbi2 or source == fbi3 then if seat == 0 then local skin = getElementModel ( player ) if not skin == 100 or not skin == 255 then --FBI skins cancelEvent( ) outputChatBox ( "Only FBI can enter this vehicle", player, 0, 0, 150, true ) end end end end addEventHandler ( "onVehicleStartEnter", root, lockfbi ) Edited February 18, 2012 by Guest http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Castillo Posted February 18, 2012 Posted February 18, 2012 You mean passengers can't enter because they are not using the X skin? If so, you must check if the seat is 0. fbi1 = createVehicle ( 596, -2429.7998046875, 515.2998046875, 29.700000762939, 0, 0, 215.99670410156 ) fbi2 = createVehicle ( 596, -2425.69921875, 518.5, 29.700000762939, 0, 0, 221.99523925781 ) fbi3 = createVehicle ( 596, -2422.3994140625, 521.599609375, 29.700000762939, 0, 0, 225 ) function lockfbi(player, seat, jacked) if (source == fbi1 or source == fbi2 or source == fbi3) then if (seat == 0) then local skin = getElementModel (player) if not (skin == 100 or skin == 255) then --FBI skins cancelEvent() outputChatBox ( "Only FBI can enter this vehicle", player, 0, 0, 150, true ) end end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockfbi ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
igthomas Posted February 19, 2012 Author Posted February 19, 2012 Thanks Castillo that's what I wanted and it worked
Castillo Posted February 19, 2012 Posted February 19, 2012 You're welcome . San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
igthomas Posted February 23, 2012 Author Posted February 23, 2012 Sorry to bump but why doesn't it want to work with ACL Groups? fbi1 = createVehicle ( 596, -2429.7998046875, 515.2998046875, 29.700000762939, 0, 0, 215.99670410156 ) fbi2 = createVehicle ( 596, -2425.69921875, 518.5, 29.700000762939, 0, 0, 221.99523925781 ) fbi3 = createVehicle ( 596, -2422.3994140625, 521.599609375, 29.700000762939, 0, 0, 225 ) function lockfbi(player, seat, jacked) if (source == fbi1 or source == fbi2 or source == fbi3) then if (seat == 0) then if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("FBI" or "Admin")) then cancelEvent() outputChatBox ( "Only FBI can enter this vehicle", player, 0, 0, 150, true ) end end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockfbi )
TAPL Posted February 23, 2012 Posted February 23, 2012 fbi1 = createVehicle ( 596, -2429.7998046875, 515.2998046875, 29.700000762939, 0, 0, 215.99670410156 ) fbi2 = createVehicle ( 596, -2425.69921875, 518.5, 29.700000762939, 0, 0, 221.99523925781 ) fbi3 = createVehicle ( 596, -2422.3994140625, 521.599609375, 29.700000762939, 0, 0, 225 ) function lockfbi(player, seat, jacked) if (source == fbi1 or source == fbi2 or source == fbi3) then if (seat == 0) then if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("FBI" or "Admin")) then cancelEvent() outputChatBox ( "Only FBI can enter this vehicle", player, 0, 0, 150, true ) end end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockfbi )
igthomas Posted February 23, 2012 Author Posted February 23, 2012 Only FBI members can enter the vehicles not admins
Kenix Posted February 23, 2012 Posted February 23, 2012 (edited) fbi1 = createVehicle ( 596, -2429.7998046875, 515.2998046875, 29.700000762939, 0, 0, 215.99670410156 ) fbi2 = createVehicle ( 596, -2425.69921875, 518.5, 29.700000762939, 0, 0, 221.99523925781 ) fbi3 = createVehicle ( 596, -2422.3994140625, 521.599609375, 29.700000762939, 0, 0, 225 ) function lockfbi( player, seat, jacked ) if source == fbi1 or source == fbi2 or source == fbi3 then if (seat == 0) then if not isObjectInACLGroup("user."..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "FBI" ) ) and not isObjectInACLGroup("user."..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "Admin" ) ) then cancelEvent() outputChatBox ( "Only FBI can enter this vehicle", player, 0, 0, 150, true ) end end end end addEventHandler ( "onVehicleStartEnter", root, lockfbi ) TAPL:aclGetGroup( "FBI" or "Admin" ) incorrect , because if value nil or false then used operator 'or'. Example g = false print( g or 0 ) -- 0 Edited February 23, 2012 by Guest http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
igthomas Posted February 23, 2012 Author Posted February 23, 2012 It writed the Outputchatbox but nobody can enter it
Kenix Posted February 23, 2012 Posted February 23, 2012 It should work only for Admins and FBI groups. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
igthomas Posted February 23, 2012 Author Posted February 23, 2012 Yes you are right but when I log in as Admin or FBI and try to enter vehicle it writes me "Only FBI can enter this vehicle"
Kenix Posted February 23, 2012 Posted February 23, 2012 fbi1 = createVehicle ( 596, -2429.7998046875, 515.2998046875, 29.700000762939, 0, 0, 215.99670410156 ) fbi2 = createVehicle ( 596, -2425.69921875, 518.5, 29.700000762939, 0, 0, 221.99523925781 ) fbi3 = createVehicle ( 596, -2422.3994140625, 521.599609375, 29.700000762939, 0, 0, 225 ) function lockfbi( player, seat, jacked ) if source == fbi1 or source == fbi2 or source == fbi3 then if (seat == 0) then if not isObjectInACLGroup("user."..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "FBI" ) ) and not isObjectInACLGroup("user."..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "Admin" ) ) then cancelEvent() outputChatBox ( "Only FBI can enter this vehicle", player, 0, 0, 150, true ) end end end end addEventHandler ( "onVehicleStartEnter", root, lockfbi ) My bad:/ Tested http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Kenix Posted February 23, 2012 Posted February 23, 2012 No problem. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
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