#Paper Posted February 11, 2011 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
Castillo Posted February 11, 2011 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
proracer Posted February 11, 2011 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.
Castillo Posted February 11, 2011 Posted February 11, 2011 Yeah, but this guy doesn't understands anything
Tomek123 Posted February 12, 2011 Author 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 )
proracer Posted February 12, 2011 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
Tomek123 Posted February 12, 2011 Author Posted February 12, 2011 No work Console say me : "11:'then' expected near 'local' How fix this? In what i must put this?
proracer Posted February 12, 2011 Posted February 12, 2011 Sorry for my noob mistake (forgot 'then' to close 'if'), it's fixed now.Try again.
Tomek123 Posted February 12, 2011 Author Posted February 12, 2011 No work :\ Now console say me : "Bad argument @ 'addPedClothes'
proracer Posted February 12, 2011 Posted February 12, 2011 Can you tell us what doesn't work? ( /debugscript 3 )
Castillo Posted February 12, 2011 Posted February 12, 2011 CHECK THE WIKI ARGUMENTS FOR addPedClothes, it requires 4 arguments: bool addPedClothes ( ped thePed, string clothesTexture, string clothesModel, int clothesType )
SDK Posted February 12, 2011 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
Tomek123 Posted February 12, 2011 Author Posted February 12, 2011 I do and now console say: "Bad argument @ 'getPlayerAccount' Bad argument @ 'addEventHandler'"
Tomek123 Posted February 12, 2011 Author 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)
Castillo Posted February 12, 2011 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)
proracer Posted February 12, 2011 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)
SDK Posted February 12, 2011 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)
Tomek123 Posted February 13, 2011 Author Posted February 13, 2011 Now console say me arror "attempt to call global 'getPedClothe'
Castillo Posted February 13, 2011 Posted February 13, 2011 OMFG you are stupid or what? he told you to change getPedClothe to getPedClothes
Tomek123 Posted February 13, 2011 Author 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)
Tomek123 Posted February 13, 2011 Author Posted February 13, 2011 Oh i fix this now Now say Warning : Bad argument getPedClothes And console say this maybe 20 time
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