Jump to content

Hey Guys I wanna help for my script


DogukanK

Recommended Posts

function onVehicleEnter_handler( thePlayer, seat, jacked )

local account = getPlayerAccount(thePlayer)

if not isGuestAccount(account) then

local id = getAccountData(account,"wheel")

addVehicleUpgrade(source,id)

end

end

addEvent("onPlayerPickUpRacePickup", true)

addEventHandler("onVehicleEnter",root,onVehicleEnter_handler)

I have this code but I wanna too race mode car change too able give wheel for account database

sorry bad english.

Link to comment

I am not good with cars and im on phone, but try this anyway:

  
function onVehicleEnter_handler( ) 
    for i,player in ipairs(getElementsByType("player")) do 
       local account = getPlayerAccount(player) 
       local veh = getPedOccupiedVehicle(player) 
            if not isGuestAccount(account) then 
              local id = getAccountData(acount,"wheel") 
                   if veh then 
                     for i,v in ipairs(getVehicleUpgrades(veh)) do 
                         if v ~= id then 
                            addVehicleUpgrade(veh,id) 
                         end 
                     end 
                   end 
            end      
    end 
end 
setTimer(onVehicleEnter_handler,100,0) 
  

Link to comment

I think i understand what you want, that code is fine, but there is a huge detail, i see this:

addEvent("onPlayerPickUpRacePickup", true) 

but i dont see this:

addEventHandler("onPlayerPickUpRacePickup",root,onVehicleEnter_handler) 

If its skipped the race gamemode wont read the function when you change the vehicle via race pickup (probably).

Also remember that if theres no data for "wheel" on your account the function will fail.

Link to comment
I am not good with cars and im on phone, but try this anyway:
  
function onVehicleEnter_handler( ) 
    for i,player in ipairs(getElementsByType("player")) do 
       local account = getPlayerAccount(player) 
       local veh = getPedOccupiedVehicle(player) 
            if not isGuestAccount(account) then 
              local id = getAccountData(acount,"wheel") 
                   if veh then 
                     for i,v in ipairs(getVehicleUpgrades(veh)) do 
                         if v ~= id then 
                            addVehicleUpgrade(veh,id) 
                         end 
                     end 
                   end 
            end      
    end 
end 
setTimer(onVehicleEnter_handler,100,0) 
  

kBDNQ9.jpg

gived error this code

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