#Paper Posted February 11, 2011 Share Posted February 11, 2011 OMG i try make skin saver and don't work again ! What is wrong function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then clothes = getPedClothes" class="kw2">getPedClothes(source,"PlayerClothes") setAccountData ( playeraccount, "play.clothes", playerclothes ) end end function onPlayerJoin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerclothes = getAccountData ( playeraccount, "play.clothes" ) if ( playerclothes ) then setPedClothes ( source, "PlayerClothes", clothes ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerJoin", getRootElement ( ), onPlayerJoin ) i don't see any error, try /debugscript 3 Link to comment
Castillo Posted February 11, 2011 Share Posted February 11, 2011 Are you blind AcitanoX? clothes = getPedClothes(source,"PlayerClothes") "PlayerClothes"? WTF? https://wiki.multitheftauto.com/wiki/GetPedClothes this requires a type of clothes, types: * 0: SHIRT * 1: HEAD * 2: TROUSERS * 3: SHOES * 4: TATTOOS_LEFT_UPPER_ARM * 5: TATTOOS_LEFT_LOWER_ARM * 6: TATTOOS_RIGHT_UPPER_ARM * 7: TATTOOS_RIGHT_LOWER_ARM * 8: TATTOOS_BACK * 9: TATTOOS_LEFT_CHEST * 10: TATTOOS_RIGHT_CHEST * 11: TATTOOS_STOMACH * 12: TATTOOS_LOWER_BACK * 13: NECKLACE * 14: WATCH * 15: GLASSES * 16: HAT * 17: EXTRA so should be: function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then clothes = getPedClothes" class="kw2">getPedClothes(source,1) setAccountData ( playeraccount, "play.clothes.head", playerclothes ) end end addEventHandler("onPlayerQuit",getRootElement(),onPlayerQuit) and to load it when login do: addPedClothes: https://wiki.multitheftauto.com/wiki/AddPedClothes Link to comment
proracer Posted February 11, 2011 Share Posted February 11, 2011 Are you blind AcitanoX?clothes = getPedClothes(source,"PlayerClothes") "PlayerClothes"? WTF? https://wiki.multitheftauto.com/wiki/GetPedClothes this requires a type of clothes, types: * 0: SHIRT * 1: HEAD * 2: TROUSERS * 3: SHOES * 4: TATTOOS_LEFT_UPPER_ARM * 5: TATTOOS_LEFT_LOWER_ARM * 6: TATTOOS_RIGHT_UPPER_ARM * 7: TATTOOS_RIGHT_LOWER_ARM * 8: TATTOOS_BACK * 9: TATTOOS_LEFT_CHEST * 10: TATTOOS_RIGHT_CHEST * 11: TATTOOS_STOMACH * 12: TATTOOS_LOWER_BACK * 13: NECKLACE * 14: WATCH * 15: GLASSES * 16: HAT * 17: EXTRA so should be: function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then clothes = getPedClothes" class="kw2">getPedClothes(source,1) setAccountData ( playeraccount, "play.clothes.head", playerclothes ) end end addEventHandler("onPlayerQuit",getRootElement(),onPlayerQuit) and to load it when login do: addPedClothes: https://wiki.multitheftauto.com/wiki/AddPedClothes I already explained, check my post on top. Link to comment
Castillo Posted February 11, 2011 Share Posted February 11, 2011 Yeah, but this guy doesn't understands anything Link to comment
Tomek123 Posted February 12, 2011 Author Share Posted February 12, 2011 Again somthing wrong function onPlayerJoin ( ) local playeraccount = getPlayerAccount ( source ) clothes = getPedClothes" class="kw2">getPedClothes(source,0) end end addEventHandler ( "onPlayerJoin", getRootElement(), onPlayerJoin ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then clothes = getPedClothes" class="kw2">getPedClothes(source,0) setAccountData ( playeraccount, "play.clothes.shirt", playerclothes ) end end addEventHandler ( "onPlayerQuit", getRootElement(), onPlayerQuit ) Link to comment
proracer Posted February 12, 2011 Share Posted February 12, 2011 (edited) Try this: function onPlayerQuitSaveClothes() local playeracc = getPlayerAccount(source) if (playeracc) then setAccountData(playeracc, "player.clothes", getPedClothes" class="kw2">getPedClothes(source, 0)) end end function onPlayerJoinSaveClothes() local playeracc = getPlayerAccount(source) if (playeracc) then local clothes = getAccountData(playeracc, "player.clothes") if (clothes) then addPedClothes(source, clothes) end end end addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) addEventHandler("onPlayerJoin", root, onPlayerJoinSaveClothes) Small note: Didn't wanted to put lua code because it gives "class = kw2" bugs. Edited February 12, 2011 by Guest Link to comment
Tomek123 Posted February 12, 2011 Author Share Posted February 12, 2011 No work Console say me : "11:'then' expected near 'local' How fix this? In what i must put this? Link to comment
proracer Posted February 12, 2011 Share Posted February 12, 2011 Sorry for my noob mistake (forgot 'then' to close 'if'), it's fixed now.Try again. Link to comment
Tomek123 Posted February 12, 2011 Author Share Posted February 12, 2011 No work :\ Now console say me : "Bad argument @ 'addPedClothes' Link to comment
proracer Posted February 12, 2011 Share Posted February 12, 2011 Can you tell us what doesn't work? ( /debugscript 3 ) Link to comment
Castillo Posted February 12, 2011 Share Posted February 12, 2011 CHECK THE WIKI ARGUMENTS FOR addPedClothes, it requires 4 arguments: bool addPedClothes ( ped thePed, string clothesTexture, string clothesModel, int clothesType ) Link to comment
Tomek123 Posted February 12, 2011 Author Share Posted February 12, 2011 How then make clothes saver? Link to comment
SDK Posted February 12, 2011 Share Posted February 12, 2011 This could be an example for your clothes saver. local acc = getPlayerAccount(thePlayer) if acc then for i=0,17 do local texture, model = getPedClothe(thePlayer) if texture and model then setAccountData(acc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(acc, "clothes." .. tostring(i) .. ".model", model) end end end (Rename getPedClothe = getPedClothes) Clothes will be saved like this: clothes.0.texture clothes.0.model clothes.1.texture clothes.1.model ... I didn't do the loader, you can do that one yourself Link to comment
Tomek123 Posted February 12, 2011 Author Share Posted February 12, 2011 I do and now console say: "Bad argument @ 'getPlayerAccount' Bad argument @ 'addEventHandler'" Link to comment
proracer Posted February 12, 2011 Share Posted February 12, 2011 Show us your new code you made, please. Link to comment
Tomek123 Posted February 12, 2011 Author Share Posted February 12, 2011 function onPlayerQuitSaveClothes() local playeracc = getPlayerAccount(source) if (playeracc) then setAccountData(playeracc, "player.clothes", getPedClothes(source, 0)) end end local playeracc = getPlayerAccount(thePlayer) if acc then for i=0,17 do local texture, model = getPedClothes(thePlayer) if texture and model then setAccountData(acc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(acc, "clothes." .. tostring(i) .. ".model", model) end end end addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) addEventHandler("onPlayerJoin", root, onPlayerJoinSaveClothes) Link to comment
Castillo Posted February 12, 2011 Share Posted February 12, 2011 That doesn't makes any sense. function onPlayerQuitSaveClothes() local playeracc = getPlayerAccount(thePlayer) if acc then for i=0,17 do local texture, model = getPedClothes" class="kw2">getPedClothes(thePlayer) if texture and model then setAccountData(acc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(acc, "clothes." .. tostring(i) .. ".model", model) end end end end addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) Link to comment
Tomek123 Posted February 12, 2011 Author Share Posted February 12, 2011 Again no work but no have errors. Link to comment
proracer Posted February 12, 2011 Share Posted February 12, 2011 function onPlayerQuitSaveClothes() local playeracc = getPlayerAccount(thePlayer) if playeracc then for i=0,17 do local texture, model = getPedClothes(thePlayer) if texture and model then setAccountData(playeracc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(playeracc, "clothes." .. tostring(i) .. ".model", model) end end end end addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) Link to comment
SDK Posted February 12, 2011 Share Posted February 12, 2011 Offcourse it doesn't work, you need to script the loading part yourself... THIS IS ONLY STORAGE: function onPlayerQuitSaveClothes() local thePlayer = source local playeracc = getPlayerAccount(thePlayer) if playeracc then for i=0,17 do local texture, model = getPedClothe(thePlayer) if texture and model then setAccountData(playeracc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(playeracc, "clothes." .. tostring(i) .. ".model", model) end end end end addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) Link to comment
Tomek123 Posted February 13, 2011 Author Share Posted February 13, 2011 Now console say me arror "attempt to call global 'getPedClothe' Link to comment
Castillo Posted February 13, 2011 Share Posted February 13, 2011 OMFG you are stupid or what? he told you to change getPedClothe to getPedClothes Link to comment
Tomek123 Posted February 13, 2011 Author Share Posted February 13, 2011 Now i do somthing and now console say: Warning : bad argument @ 'getPlayerAccount' (string-defined function) Warning: bad argument @ 'addEventHandler* (string-defined function) This is script : local acc = getPlayerAccount(thePlayer) if acc then for i=0,17 do local texture, model = getPedClothes(thePlayer) if texture and model then setAccountData(acc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(acc, "clothes." .. tostring(i) .. ".model", model) end end end addEventHandler("onPlayerJoin", root, onPlayerGetSaveClothes) function onPlayerQuitSaveClothes() local thePlayer = source local playeracc = getPlayerAccount(thePlayer) if playeracc then for i=0,17 do local texture, model = getPedClothes(thePlayer) if texture and model then setAccountData(playeracc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(playeracc, "clothes." .. tostring(i) .. ".model", model) end end end end addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) Link to comment
Tomek123 Posted February 13, 2011 Author Share Posted February 13, 2011 Oh i fix this now Now say Warning : Bad argument getPedClothes And console say this maybe 20 time Link to comment
Castillo Posted February 13, 2011 Share Posted February 13, 2011 What you doing doesn't makes any sense. 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