Stranger Posted March 22, 2014 Share Posted March 22, 2014 hello, i was wondering, how can i save the upgrades of the vehicle that i have it ? Link to comment
iPrestege Posted March 22, 2014 Share Posted March 22, 2014 hello, i was wondering, how can i save the upgrades of the vehicle that i have it ? getVehicleUpgrades And save them with any save ways. Link to comment
Stranger Posted March 22, 2014 Author Share Posted March 22, 2014 will i trid like this : function spawn (Name,carName) if getElementData(Name, "haveCar") == "no" then -- code local owner = getAccountName(getPlayerAccount(Name)) Vehicle = createVehicle(carModel, x, y, z) getAccountData (owner "upgrades") end addEvent("spawn_car", true) addEventHandler("spawn_car", getRootElement(), spawn) function destroy (Name) Acc = getAccountName(getPlayerAccount(Name)) -- code setAccountData (Acc, "upgrades", getVehicleUpgrades (Vehicle)) end addEvent("destroy_car", true) addEventHandler("destroy_car", getRootElement(), destroy) but not working Link to comment
iPrestege Posted March 22, 2014 Share Posted March 22, 2014 will i trid like this : function spawn (Name,carName) if getElementData(Name, "haveCar") == "no" then -- code local owner = getAccountName(getPlayerAccount(Name)) Vehicle = createVehicle(carModel, x, y, z) getAccountData (owner "upgrades") end addEvent("spawn_car", true) addEventHandler("spawn_car", getRootElement(), spawn) function destroy (Name) Acc = getAccountName(getPlayerAccount(Name)) -- code setAccountData (Acc, "upgrades", getVehicleUpgrades (Vehicle)) end addEvent("destroy_car", true) addEventHandler("destroy_car", getRootElement(), destroy) but not working This function returns a table of all the upgrades on a specifed vehicle. Link to comment
Stranger Posted March 22, 2014 Author Share Posted March 22, 2014 can you just tell me what i have to use, to make it save ? i know i have to use 'getVehicleUpgrades' but, can you tell me , what the right thing i have to use it ! Link to comment
iPrestege Posted March 22, 2014 Share Posted March 22, 2014 can you just tell me what i have to use, to make it save ? i know i have to use'getVehicleUpgrades' but, can you tell me , what the right thing i have to use it ! You must get the values from the table which is the function i gave you above so you can simply : if vehicle then for _,iUpgrades in ipairs ( getVehicleUpgrades ( vehicle ) ) do -- Your Stuff end end This is just an example and vehicle doesn't return for something here you must check if the vehicle exists in your script. Link to comment
Stranger Posted March 22, 2014 Author Share Posted March 22, 2014 will, i did what you said but same thing ! Link to comment
Stranger Posted March 22, 2014 Author Share Posted March 22, 2014 (edited) will this is the code: function spawn (Name,carName) if getElementData(Name, "haveCar") == "no" then local owner = getAccountName(getPlayerAccount(Name)) local carModel = getVehicleModelFromName(carName) local x,y,z = getElementPosition(Name) Vehicle = createVehicle(carModel, x, y, z) -- code getAccountData (owner, "upgrades") end addEvent("spawn_car", true) addEventHandler("spawn_car", getRootElement(), spawn) this the destroy vehicle side: function destroy (Name) Acc = getAccountName(getPlayerAccount(Name)) if getElementData(Name, "haveCar") == "yes" and getElementData(Vehicle, "owner") == Acc then -- code if Vehicle then for _,Upgrades in ipairs ( getVehicleUpgrades ( Vehicle ) ) do setAccountData (Acc, "upgrades", Upgrades) end addEvent("destroy_car", true) addEventHandler("destroy_car", getRootElement(), destroy) Edited March 22, 2014 by Guest Link to comment
Stranger Posted March 22, 2014 Author Share Posted March 22, 2014 little help please @_@ Link to comment
Karuzo Posted March 22, 2014 Share Posted March 22, 2014 You're using serverside functions in clientside scripts, that won't work. Link to comment
Stranger Posted March 22, 2014 Author Share Posted March 22, 2014 sorry, for writing the name 'client side', the right name is 'destroy vehicle side' ^_^" Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now