Jump to content

Diving


Multi

Recommended Posts

Hello.

I try to make script that if you dont have a drving licence then you can t enter the vehicle of this ids.

policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true } 
  
function enterVehicle ( player, seat, jacked, thePlayer ) 
kon = getPlayerAccount(thePlayer) 
if policeVehicles(getElementModel(source) ) then 
if not getAccountData(kon,"prawko2") == "zajety" ) then 
cancelEvent() 
outputChatBox ( "Only if you have a licence car", player ) 
end 
end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) 

and something is not working can u help me ??

Link to comment

Try this:

policeVehicles = { [ 598 ] = true, [ 596 ] = true, [ 597 ] = true, [ 599 ] = true } 
  
function enterVehicle ( player, seat, jacked ) 
    local kon = getPlayerAccount ( player ) 
    if ( policeVehicles [ getElementModel ( source ) ] ) then 
        if ( not getAccountData ( kon, "prawko2" ) == "zajety" ) then 
            cancelEvent ( ) 
            outputChatBox ( "Only if you have a licence car", player ) 
        end 
    end 
end 
addEventHandler ( "onVehicleStartEnter", root, enterVehicle ) 

Link to comment
policeVehicles = { [ 598 ] = true, [ 596 ] = true, [ 597 ] = true, [ 599 ] = true } 
  
function enterVehicle ( player, seat, jacked ) 
    local kon = getPlayerAccount ( player ) 
    if ( policeVehicles [ getElementModel ( source ) ] ) then 
        if (getAccountData ( kon, "prawko2" ) ~= "zajety" ) then 
            cancelEvent ( ) 
            outputChatBox ( "Only if you have a licence car", player ) 
        end 
    end 
end 
addEventHandler ( "onVehicleStartEnter", root, enterVehicle ) 

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