Jump to content

addVehicleUpgrade


h4x7o0r

Recommended Posts

Thanks for ur reply.

  
function checkveh (veh)  
for _, v in ipairs(getElementsByType("vehicle")) do 
  if getElementModel (vehicle) == 415  then 
   if not getVehicleUpgradeOnSlot(vehicle, 2) then 
     addVehicleUpgrade ( vehicle, 1003 ) 
   end 
  end 
end 
end 
addEventHandler("onResourceStart",getRootElement(),checkveh) 
  

Link to comment
  • Moderators
  
function checkveh (veh)  
for _, v in ipairs(getElementsByType("vehicle")) do 
  if getElementModel (vehicle) == 415  then 
   if not getVehicleUpgradeOnSlot(vehicle, 2) then 
     addVehicleUpgrade ( vehicle, 1003 ) 
   end 
  end 
end 
end 
addEventHandler("onResourceStart",getRootElement(),checkveh) 
  

Replace 'vehicle' with 'v'.

Link to comment
  
function checkveh (veh)  
for _, v in ipairs(getElementsByType("vehicle")) do 
  if getElementModel (v) == 415  then 
   if not getVehicleUpgradeOnSlot(v, 2) then 
     addVehicleUpgrade ( v, 1003 ) 
   end 
  end 
end 
end 
addEventHandler("onResourceStart",getRootElement(),checkveh) 
  

No errors but doesn't work. No change. Thanks for reply.

Link to comment

Try this

function checkveh () 
    for _, v in ipairs(getElementsByType("vehicle")) do 
        if getElementModel (v) == 415  then 
            if getVehicleUpgradeOnSlot(v, 2) ~= 1003 then 
                addVehicleUpgrade ( v, 1003 ) 
            end 
        end 
    end 
end 
addEventHandler("onResourceStart",resourceRoot,checkveh) 

Link to comment
function checkveh ( ) 
    for _, v in ipairs ( getElementsByType ( "vehicle" ) ) do 
        if ( getElementModel ( v ) == 415 ) then 
            if ( getVehicleUpgradeOnSlot ( v, 2 ) ~= 1003 ) then 
                addVehicleUpgrade ( v, 1003 ) 
                outputChatBox ( "ADDING UPGRADE" ) 
            else 
                outputChatBox ( "UPGRADE ALREADY ON SLOT" ) 
            end 
        end 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, checkveh ) 

Use that and see what it outputs to the chat box.

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