Jump to content

Need help with saving colors


GuyFromPast

Recommended Posts

function changeCarLightsColor ( thePlayer, command, red, green, blue, zoo ) 
    local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
    if ( not theVehicle ) then 
        return outputChatBox( "You don't have vehicle!" ) 
    end 
    red = tonumber ( red ) 
    green = tonumber ( green ) 
    blue = tonumber ( blue ) 
    -- check if the colour values for red, green and blue are valid 
    if red and green and blue then 
        local color = setVehicleHeadLightColor ( theVehicle, red, green, blue ) 
        if(not color) then 
            outputChatBox( "Failed to change vehicle lights color" ) 
        else 
            outputChatBox ( "Vehicle lights color changed sucessfully" ) 
        end     
    else 
        outputChatBox( "error shit" ) 
    end 
end 
  
addCommandHandler ( "cl", changeCarLightsColor ) 
  
  
function onSpawn (zoo,thePlayer) 
      local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
      local accountData = getAccountData (zoo, "horse") 
      if (accountData) then 
      local G = getAccountData (zoo, "rabbit") 
      local R = getAccountData (zoo, "horse") 
      local B = getAccountData (zoo, "bear") 
      outputChatBox("getting data blablashit") 
      egg1 = G 
      egg2 = R 
      egg3 = B 
      setVehicleHeadLightColor ( theVehicle, egg1, egg2, egg3 ) 
end 
end 
addEventHandler ("onPlayerSpawn", getRootElement(), onSpawn) 
  
function onDead () 
    account = getPlayerAccount (source) 
    if (account) then 
      setAccountData (account, "horse", G) 
      setAccountData (account, "rabbit", R) 
      setAccountData (account, "bear", B) 
      outputChatBox("setting data blabla") 
end 
end 
addEventHandler ("onPlayerWasted", getRootElement(), onDead) 
  
  

Hello, its me again.. as u know im not very talented scripter and i need your help again >.<

theres command (cl) that changes your carheadlightcolor

i want to make it save like when u set ur carheadlightcolor red then it saves it when u die and when u spawn it restores it

atm im getting waring

Bad arugment @ 'getAccountData' 

any fixes ?

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