Annas Posted May 12, 2015 Share Posted May 12, 2015 .. idk if it hard or not , but SCRIPTERS can make it .. i need to SAVE CLOTHES of CJ i one a SAVE SYSTEM FOR IT but when i change the skin to any number (not 0=CJ) and reconnect , + back to CJ skin , clothes will not still saved Help me with CLOTHES SAVE .. i wish you understand .. IF YOU NEED THE SCRIPT THAT'S I USED : clothes saver (saveclothes) https://community.multitheftauto.com/ind ... ls&id=1868 Link to comment
Walid Posted May 12, 2015 Share Posted May 12, 2015 Try it by yourself and we will help you . Link to comment
Annas Posted May 12, 2015 Author Share Posted May 12, 2015 Try it by yourself and we will help you . tryed --[[ original script by iAnnAs (iannas ben ahmed) --]] function saveClothes() local account = getPlayerAccount(source) if ( not isGuestAccount(account) ) and ( getElementModel(source) == 0 ) then local texture = {} local model = {} for i=0, 17, 1 do local clothesTexture, clothesModel = getPedClothes(source, i) if ( clothesTexture ~= false ) then table.insert(texture, clothesTexture) table.insert(model, clothesModel) else table.insert(texture, " ") table.insert(model, " ") end end local allTextures = table.concat(texture, ",") local allModels = table.concat(model, ",") outputDebugString("Clothessaver: Saved clothes") setAccountData(account, "Clothessaver:Texture", allTextures) setAccountData(account, "Clothessaver:Model", allModels) texture = {} model = {} end end addEventHandler("onPlayerQuit", getRootElement(), saveClothes) function setClothes() local account = getPlayerAccount(source) if ( not isGuestAccount(account) ) then local textureString = getAccountData(account, "Clothessaver:Texture") local modelString = getAccountData(account, "Clothessaver:Model") local textures = split(textureString, 44) local models = split(modelString, 44) for i=0, 17, 1 do if ( textures[i+1] ~= " " ) then addPedClothes(source, textures[i+1], models[i+1], i) end end exports.CSTtexts:sendMessage("Your CJ Clothes were added Back", 0, 255, 0, true) textures = {} models = {} end end addEventHandler("onPlayerLogin", getRootElement(), setClothes) Link to comment
Annas Posted May 12, 2015 Author Share Posted May 12, 2015 you didn't, show me your try as what i said mr.Walid , it's working , clothes saved but .. when i change it to any other Skin ID + reconnect and back the skin to CJ skin , (CLOTHES is setted back to 0) Link to comment
Walid Posted May 12, 2015 Share Posted May 12, 2015 You need to use removePedClothes on player login. Try this -- Save addEventHandler ( "onPlayerQuit", root, function ( ) local account = getPlayerAccount ( source ) if ( isGuestAccount( account ) ) then return end local clothes = { } for i=0, 17 do clothes[i] = { getPedClothes ( source, i ) } end clothes = toJSON ( clothes ) setAccountData ( account, "Clothes", clothes ) end ) -- Load addEventHandler ( "onPlayerLogin", root, function ( _, account ) local clothes = getAccountData ( account, "Clothes" ) if not clothes then return end removeAllPedClothes(source) for i, v in pairs ( fromJSON ( clothes ) ) do local text, id = unpack ( v ) if text then addPedClothes ( source, text, id, i ) end end end ) -- Remove all function removeAllPedClothes(thePed) for i=0, 17 do removePedClothes(thePed, i) end return true end Link to comment
Annas Posted May 12, 2015 Author Share Posted May 12, 2015 not work .. 1-i add this LUA in SERVER SIDE 2-i get clothes 3-reconnect 4-clothes saved (thx) 5-i changed the skin id to 230 6-reconnect 7-back the CJ skin (not saved , the CJ didn't have any clothes) HELP pls . Link to comment
Walid Posted May 12, 2015 Share Posted May 12, 2015 not work ..1-i add this LUA in SERVER SIDE 2-i get clothes 3-reconnect 4-clothes saved (thx) 5-i changed the skin id to 230 6-reconnect 7-back the CJ skin (not saved , the CJ didn't have any clothes) HELP pls . show me full code Link to comment
Annas Posted May 12, 2015 Author Share Posted May 12, 2015 show me full code i try your code , but not working Link to comment
Annas Posted May 12, 2015 Author Share Posted May 12, 2015 So .. MY CODE : --[[ original script by iAnnAs (iannas ben ahmed) --]] function saveClothes() local account = getPlayerAccount(source) if ( not isGuestAccount(account) ) and ( getElementModel(source) == 0 ) then local texture = {} local model = {} for i=0, 17, 1 do local clothesTexture, clothesModel = getPedClothes(source, i) if ( clothesTexture ~= false ) then table.insert(texture, clothesTexture) table.insert(model, clothesModel) else table.insert(texture, " ") table.insert(model, " ") end end local allTextures = table.concat(texture, ",") local allModels = table.concat(model, ",") outputDebugString("Clothessaver: Saved clothes") setAccountData(account, "Clothessaver:Texture", allTextures) setAccountData(account, "Clothessaver:Model", allModels) texture = {} model = {} end end addEventHandler("onPlayerQuit", getRootElement(), saveClothes) function setClothes() local account = getPlayerAccount(source) if ( not isGuestAccount(account) ) then local textureString = getAccountData(account, "Clothessaver:Texture") local modelString = getAccountData(account, "Clothessaver:Model") local textures = split(textureString, 44) local models = split(modelString, 44) for i=0, 17, 1 do if ( textures[i+1] ~= " " ) then addPedClothes(source, textures[i+1], models[i+1], i) end end exports.CSTtexts:sendMessage("Your CJ Clothes were added Back", 0, 255, 0, true) textures = {} models = {} end end addEventHandler("onPlayerLogin", getRootElement(), setClothes) function loadClothes(player) local account = getPlayerAccount(player) if ( not isGuestAccount(account) ) then local textureString = getAccountData(account, "Clothessaver:Texture") local modelString = getAccountData(account, "Clothessaver:Model") local textures = split(textureString, 44) local models = split(modelString, 44) for i=0, 17, 1 do if ( textures[i+1] ~= " " ) then addPedClothes(player, textures[i+1], models[i+1], i) end end exports.CSTtexts:sendMessage("Your CJ Clothes were added Back", 0, 255, 0, true) textures = {} models = {} else outputChatBox("Please login!", player, 255, 0, 0) end end addCommandHandler("loadClothes", loadClothes) function saveClothes(player) local account = getPlayerAccount(player) if ( not isGuestAccount(account) ) then if ( getElementModel(player) == 0 ) then local texture = {} local model = {} for i=0, 17, 1 do local clothesTexture, clothesModel = getPedClothes(player, i) if ( clothesTexture ~= false ) then table.insert(texture, clothesTexture) table.insert(model, clothesModel) else table.insert(texture, " ") table.insert(model, " ") end end local allTextures = table.concat(texture, ",") local allModels = table.concat(model, ",") outputDebugString("Clothessaver: Saved clothes") setAccountData(account, "Clothessaver:Texture", allTextures) setAccountData(account, "Clothessaver:Model", allModels) texture = {} model = {} else exports.CSTtexts:sendMessage("Your skin must be skin 0 (CJ Skin)", 255, 0, 0, true) end else outputChatBox("Please login!", player, 255, 0, 0) end end addCommandHandler("saveClothes", saveClothes) Link to comment
ALw7sH Posted May 12, 2015 Share Posted May 12, 2015 --[[ original script by iAnnAs (iannas ben ahmed) --]] function saveClothes() local account = getPlayerAccount(source) if ( not isGuestAccount(account) ) and ( getElementModel(source) == 0 ) then local texture = {} local model = {} for i=0, 17, 1 do local clothesTexture, clothesModel = getPedClothes(source, i) if ( clothesTexture ~= false ) then table.insert(texture, clothesTexture) table.insert(model, clothesModel) else table.insert(texture, " ") table.insert(model, " ") end end local allTextures = table.concat(texture, ",") local allModels = table.concat(model, ",") outputDebugString("Clothessaver: Saved clothes") setAccountData(account, "Clothessaver:Texture", allTextures) setAccountData(account, "Clothessaver:Model", allModels) texture = {} model = {} end end addEventHandler("onPlayerQuit", getRootElement(), saveClothes) function setClothes() local account = getPlayerAccount(source) if ( not isGuestAccount(account) ) then if ( getElementModel(player) == 0 ) then local textureString = getAccountData(account, "Clothessaver:Texture") local modelString = getAccountData(account, "Clothessaver:Model") local textures = split(textureString, 44) local models = split(modelString, 44) for i=0, 17, 1 do if ( textures[i+1] ~= " " ) then addPedClothes(source, textures[i+1], models[i+1], i) end end exports.CSTtexts:sendMessage("Your CJ Clothes were added Back", 0, 255, 0, true) textures = {} models = {} end end end addEventHandler("onPlayerLogin", getRootElement(), setClothes) function loadClothes(player) local account = getPlayerAccount(player) if ( not isGuestAccount(account) ) then if ( getElementModel(player) == 0 ) then local textureString = getAccountData(account, "Clothessaver:Texture") local modelString = getAccountData(account, "Clothessaver:Model") local textures = split(textureString, 44) local models = split(modelString, 44) for i=0, 17, 1 do if ( textures[i+1] ~= " " ) then addPedClothes(player, textures[i+1], models[i+1], i) end end exports.CSTtexts:sendMessage("Your CJ Clothes were added Back", 0, 255, 0, true) textures = {} models = {} else exports.CSTtexts:sendMessage("Your skin must be skin 0 (CJ Skin)", 255, 0, 0, true) end else outputChatBox("Please login!", player, 255, 0, 0) end end addCommandHandler("loadClothes", loadClothes) function saveClothes(player) local account = getPlayerAccount(player) if ( not isGuestAccount(account) ) then if ( getElementModel(player) == 0 ) then local texture = {} local model = {} for i=0, 17, 1 do local clothesTexture, clothesModel = getPedClothes(player, i) if ( clothesTexture ~= false ) then table.insert(texture, clothesTexture) table.insert(model, clothesModel) else table.insert(texture, " ") table.insert(model, " ") end end local allTextures = table.concat(texture, ",") local allModels = table.concat(model, ",") outputDebugString("Clothessaver: Saved clothes") setAccountData(account, "Clothessaver:Texture", allTextures) setAccountData(account, "Clothessaver:Model", allModels) texture = {} model = {} else exports.CSTtexts:sendMessage("Your skin must be skin 0 (CJ Skin)", 255, 0, 0, true) end else outputChatBox("Please login!", player, 255, 0, 0) end end addCommandHandler("saveClothes", saveClothes) addEventHandler("onElementModelChange",root, function(old,new) if ( getElementType(source) == "player" ) then if ( new == 0 ) then executeCommandHandler("loadClothes",source) end end end ) Link to comment
Annas Posted May 12, 2015 Author Share Posted May 12, 2015 --[[ original script by iAnnAs (iannas ben ahmed) --]] function saveClothes() local account = getPlayerAccount(source) if ( not isGuestAccount(account) ) and ( getElementModel(source) == 0 ) then local texture = {} local model = {} for i=0, 17, 1 do local clothesTexture, clothesModel = getPedClothes(source, i) if ( clothesTexture ~= false ) then table.insert(texture, clothesTexture) table.insert(model, clothesModel) else table.insert(texture, " ") table.insert(model, " ") end end local allTextures = table.concat(texture, ",") local allModels = table.concat(model, ",") outputDebugString("Clothessaver: Saved clothes") setAccountData(account, "Clothessaver:Texture", allTextures) setAccountData(account, "Clothessaver:Model", allModels) texture = {} model = {} end end addEventHandler("onPlayerQuit", getRootElement(), saveClothes) function setClothes() local account = getPlayerAccount(source) if ( not isGuestAccount(account) ) then if ( getElementModel(player) == 0 ) then local textureString = getAccountData(account, "Clothessaver:Texture") local modelString = getAccountData(account, "Clothessaver:Model") local textures = split(textureString, 44) local models = split(modelString, 44) for i=0, 17, 1 do if ( textures[i+1] ~= " " ) then addPedClothes(source, textures[i+1], models[i+1], i) end end exports.CSTtexts:sendMessage("Your CJ Clothes were added Back", 0, 255, 0, true) textures = {} models = {} end end end addEventHandler("onPlayerLogin", getRootElement(), setClothes) function loadClothes(player) local account = getPlayerAccount(player) if ( not isGuestAccount(account) ) then if ( getElementModel(player) == 0 ) then local textureString = getAccountData(account, "Clothessaver:Texture") local modelString = getAccountData(account, "Clothessaver:Model") local textures = split(textureString, 44) local models = split(modelString, 44) for i=0, 17, 1 do if ( textures[i+1] ~= " " ) then addPedClothes(player, textures[i+1], models[i+1], i) end end exports.CSTtexts:sendMessage("Your CJ Clothes were added Back", 0, 255, 0, true) textures = {} models = {} else exports.CSTtexts:sendMessage("Your skin must be skin 0 (CJ Skin)", 255, 0, 0, true) end else outputChatBox("Please login!", player, 255, 0, 0) end end addCommandHandler("loadClothes", loadClothes) function saveClothes(player) local account = getPlayerAccount(player) if ( not isGuestAccount(account) ) then if ( getElementModel(player) == 0 ) then local texture = {} local model = {} for i=0, 17, 1 do local clothesTexture, clothesModel = getPedClothes(player, i) if ( clothesTexture ~= false ) then table.insert(texture, clothesTexture) table.insert(model, clothesModel) else table.insert(texture, " ") table.insert(model, " ") end end local allTextures = table.concat(texture, ",") local allModels = table.concat(model, ",") outputDebugString("Clothessaver: Saved clothes") setAccountData(account, "Clothessaver:Texture", allTextures) setAccountData(account, "Clothessaver:Model", allModels) texture = {} model = {} else exports.CSTtexts:sendMessage("Your skin must be skin 0 (CJ Skin)", 255, 0, 0, true) end else outputChatBox("Please login!", player, 255, 0, 0) end end addCommandHandler("saveClothes", saveClothes) addEventHandler("onElementModelChange",root, function(old,new) if ( getElementType(source) == "player" ) then if ( new == 0 ) then executeCommandHandler("loadClothes",source) end end end ) not work , when i reconnect , clothes not saved .. 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