Jump to content

Help with vheicle locks.


xXMADEXx

Recommended Posts

I got a weird bug with this script. When someone ( with wrong skin ) enters the car, it will work fine and block them from entering the car. But if someone with correct skin enters the car, it give them net trouble. Thanks in advance

miliVeh = { [520]=true, [432]=true, [433]=true, [470]=true } 
miliSkin = { [287]=true, [217]=true } 
  
policeVeh = { [497]=true, [596]=true, [597]=true, [599]=true, [523]=true, [598]=true } 
policeSkin = { [217]=true, [287]=true, [265]=true, [266]=true, [267]=true, [280]=true, [281]=true, [282]=true, [283]=true, [284]=true, [285]=true, [286]=true, [288]=true } 
  
fbiVeh = { [490]=true, [528]=true } 
fbiSkin = { [286]=true, [217]=true } 
  
swatVeh = { [601]=true, [427]=true } 
swatSkin = { [285]=true, [217]=true } 
  
  
function mili ( thePlayer, seat, jacked ) 
    if ( miliVeh[getElementModel ( source )] ) and ( not miliSkin[getElementModel ( thePlayer )] ) then  
        if ( seat == 0 ) then 
            removePedFromVehicle ( thePlayer ) 
            outputChatBox ( "Error: You are not in the Military!", thePlayer, 255, 0, 0, true )  
        end 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), mili )  
  
function police ( thePlayer, seat, jacked ) 
    if ( policeVeh[getElementModel ( source )] ) and ( not policeSkin[getElementModel ( thePlayer )] ) then  
        if ( seat == 0 ) then 
            removePedFromVehicle ( thePlayer ) 
            outputChatBox ( "Error: You are not a cop!", thePlayer, 255, 0, 0, true )  
        end 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), police )  
  
function fbi ( thePlayer, seat, jacked ) 
    if ( fbiVeh[getElementModel ( source )] ) and ( not fbiSkin[getElementModel ( thePlayer )] ) then  
        removePedFromVehicle ( thePlayer ) 
        outputChatBox ( "Error: You are not in the F.B.I!", thePlayer, 255, 0, 0, true )  
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), fbi )  
  
function swat ( thePlayer, seat, jacked ) 
    if ( swatVeh[getElementModel ( source )] ) and ( not swatSkin[getElementModel ( thePlayer )] ) then  
        if ( seat == 0 ) then 
            removePedFromVehicle ( thePlayer ) 
            outputChatBox ( "Error: You are not in the swat!", thePlayer, 255, 0, 0, true )  
        end 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), swat ) 

Link to comment

Try This BRO/mate

--Server side

miliVeh = { 
    [520]=true, 
    [432]=true, 
    [433]=true, 
    [470]=true 
} 
miliSkin = { 
    [287]=true, 
    [217]=true 
} 
  
policeVeh = { 
    [497]=true, 
    [596]=true, 
    [597]=true, 
    [599]=true, 
    [523]=true, 
    [598]=true 
} 
  
policeSkin = { 
    [217]=true, 
    [287]=true, 
    [265]=true, 
    [266]=true, 
    [267]=true, 
    [280]=true, 
    [281]=true, 
    [282]=true, 
    [283]=true, 
    [284]=true, 
    [285]=true, 
    [286]=true, 
    [288]=true 
} 
  
fbiVeh = { 
    [490]=true, 
    [528]=true 
} 
  
fbiSkin = { 
    [286]=true, 
    [217]=true 
} 
  
swatVeh = { 
    [601]=true, 
    [427]=true 
} 
  
swatSkin = { 
    [285]=true, 
    [217]=true 
} 
  
addEventHandler("onVehicleStartEnter", root, 
    function(player, seat, jacked, door) 
        if (miliVeh[getElementModel(source)]) and (not miliSkin[getElementModel(player)]) and (seat == 0) then 
            outputChatBox ( "Error: You are not in the Military!", player, 255, 0, 0, true ) 
            cancelEvent() 
        end 
    end 
) 
  
addEventHandler("onVehicleStartEnter", root, 
    function(player, seat, jacked, door) 
        if (policeVeh[getElementModel(source)]) and (not policeSkin[getElementModel(player)]) and (seat == 0) then 
            outputChatBox ( "Error: You are not a cop!", player, 255, 0, 0, true ) 
            cancelEvent() 
        end 
    end 
) 
  
addEventHandler("onVehicleStartEnter", root, 
    function(player, seat, jacked, door) 
        if (fbiVeh[getElementModel(source)]) and (not fbiSkin[getElementModel(player)]) and (seat == 0) then 
            outputChatBox ( "Error: You are not in the F.B.I!", player, 255, 0, 0, true ) 
            cancelEvent() 
        end 
    end 
) 
  
addEventHandler("onVehicleStartEnter", root, 
    function(player, seat, jacked, door) 
        if (swatVeh[getElementModel(source)]) and (not swatSkin[getElementModel(player)]) and (seat == 0) then 
            outputChatBox ( "Error: You are not in the swat!", player, 255, 0, 0, true ) 
            cancelEvent() 
        end 
    end 
) 
  

Edited by Guest
Link to comment
Try This BRO/mate

--Server side

miliVeh = { 
    [520]=true, 
    [432]=true, 
    [433]=true, 
    [470]=true 
} 
miliSkin = { 
    [287]=true, 
    [217]=true 
} 
  
policeVeh = { 
    [497]=true, 
    [596]=true, 
    [597]=true, 
    [599]=true, 
    [523]=true, 
    [598]=true 
} 
  
policeSkin = { 
    [217]=true, 
    [287]=true, 
    [265]=true, 
    [266]=true, 
    [267]=true, 
    [280]=true, 
    [281]=true, 
    [282]=true, 
    [283]=true, 
    [284]=true, 
    [285]=true, 
    [286]=true, 
    [288]=true 
} 
  
fbiVeh = { 
    [490]=true, 
    [528]=true 
} 
  
fbiSkin = { 
    [286]=true, 
    [217]=true 
} 
  
swatVeh = { 
    [601]=true, 
    [427]=true 
} 
  
swatSkin = { 
    [285]=true, 
    [217]=true 
} 
  
addEventHandler("onVehicleStartEnter", root, 
    function(player, seat, jacked, door) 
        if (miliVeh[getElementModel(source)]) and (not miliSkin[getElementModel(player)]) and (seat == 0) then 
            outputChatBox ( "Error: You are not in the Military!", thePlayer, 255, 0, 0, true ) 
            cancelEvent() 
        end 
    end 
) 
  
addEventHandler("onVehicleStartEnter", root, 
    function(player, seat, jacked, door) 
        if (policeVeh[getElementModel(source)]) and (not policeSkin[getElementModel(player)]) and (seat == 0) then 
            outputChatBox ( "Error: You are not a cop!", thePlayer, 255, 0, 0, true ) 
            cancelEvent() 
        end 
    end 
) 
  
addEventHandler("onVehicleStartEnter", root, 
    function(player, seat, jacked, door) 
        if (fbiVeh[getElementModel(source)]) and (not fbiSkin[getElementModel(player)]) and (seat == 0) then 
            outputChatBox ( "Error: You are not in the F.B.I!", thePlayer, 255, 0, 0, true ) 
            cancelEvent() 
        end 
    end 
) 
  
addEventHandler("onVehicleStartEnter", root, 
    function(player, seat, jacked, door) 
        if (swatVeh[getElementModel(source)]) and (not swatSkin[getElementModel(player)]) and (seat == 0) then 
            outputChatBox ( "Error: You are not in the swat!", thePlayer, 255, 0, 0, true ) 
            cancelEvent() 
        end 
    end 
) 
  

Your parameter is called player but you have it thePlayer at outputChatBox.

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...