Jump to content

Private skin cars don't work


igthomas

Recommended Posts

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 ) 

Link to comment

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 ) 

Link to comment
  • Scripting Moderators
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 ) 

Link to comment

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 ) 
  
  

Link to comment
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 by Guest
Link to comment

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 ) 

Link to comment

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 ) 

Link to comment
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 ) 

Link to comment
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 by Guest
Link to comment
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

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...