Jump to content

automatic detect vehicle and add clothes


hDavidm

Recommended Posts

i have wanted to make a resource like this:when i enter in a vehicle on the list the "moto" clothing shold be added

local VEH = { 
    581, 
    509, 
    481, 
    462, 
    521, 
    463, 
    510, 
    522, 
    461, 
    448, 
    468, 
    586 
} 
function onEnterVehicle ( theVehicle, seat, jacked, VEH ) 
    if getElementModel ( theVehicle ) == ("VEH") then 
        addPedClothes ( source, "moto", "moto", 16 ) 
    end 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle ) 
  
function onExitVehicle ( theVehicle, seat, jacked,VEH ) 
    if getElementModel ( theVehicle ) == ("VEH") then 
        removePedClothes ( source, 16 )               
    end 
end 
addEventHandler ( "onPlayerVehicleExit", getRootElement(), onExitVehicle ) 
  

can someone help me to fix it?

(i used wiki examples)

Link to comment
local VEH = 
{ 
    [ 581 ] = true, 
    [ 509 ] = true, 
    [ 481 ] = true, 
    [ 462 ] = true, 
    [ 521 ] = true, 
    [ 463 ] = true, 
    [ 510 ] = true, 
    [ 522 ] = true, 
    [ 461 ] = true, 
    [ 448 ] = true, 
    [ 468 ] = true, 
    [ 586 ] = true 
} 
function onEnterVehicle ( theVehicle, seat, jacked ) 
    if VEH [ getElementModel ( theVehicle ) ] then 
        addPedClothes ( source, "moto", "moto", 16 ) 
    end 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle ) 
  
function onExitVehicle ( theVehicle, seat, jacked ) 
    if VEH [ getElementModel ( theVehicle ) ] then 
        removePedClothes ( source, 16 ) 
    end 
end 
addEventHandler ( "onPlayerVehicleExit", getRootElement(), onExitVehicle ) 

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