Jump to content

Ayuda simple!


Chaz-CR

Recommended Posts

Bueno tengo este problema, tengo un sistema de guardado general pero este no tiene un guardado de ropa cuando tienes a CJ, asi que busque por estos lados y me encontre con uno y todo bien pero a la hora de salir y volver a entrar solo entra con el skin 0 osea el de CJ asi hayas escogido otro skin aleatorio como ejemplo el 235 que tengo que modificarle o quitarle para que no me de ese problema? Gracias!

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) 
        setElementModel(source,0) 
        for i=0, 17, 1 do 
            if ( textures[i+1] ~= " " ) then 
                addPedClothes(source, textures[i+1], models[i+1], i) 
            end 
        end 
        outputChatBox("Clothes were added by clothessaver", source, 0, 255, 0) 
        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) 
        setElementModel(player,0) 
        for i=0, 17, 1 do 
            if ( textures[i+1] ~= " " ) then 
                addPedClothes(player, textures[i+1], models[i+1], i) 
            end 
        end 
        outputChatBox("Clothes were added by clothessaver", player, 0, 255, 0) 
        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 
            outputChatBox("Your skin must be skin 0 (CJ Skin)", player, 255, 0, 0) 
        end 
    else 
        outputChatBox("Please login!", player, 255, 0, 0) 
    end 
end 
addCommandHandler("saveClothes", saveClothes) 

Link to comment

Intenta esto:

function saveClothes() 
    local account = getPlayerAccount(source) 
setAccountData(account, "PreviousModel", getElementModel(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) 
    local model = getAccountData(account, "PreviousModel") 
    if ( not isGuestAccount(account) ) 
    if model == 0 then 
        local textureString = getAccountData(account, "Clothessaver:Texture") 
        local modelString = getAccountData(account, "Clothessaver:Model") 
        local textures = split(textureString, 44) 
        local models = split(modelString, 44) 
        setElementModel(source,0) 
        for i=0, 17, 1 do 
            if ( textures[i+1] ~= " " ) then 
                addPedClothes(source, textures[i+1], models[i+1], i) 
            end 
        end 
        outputChatBox("Clothes were added by clothessaver", source, 0, 255, 0) 
        textures = {} 
        models = {} 
    else 
        setElementModel(source, model) 
        outputChatBox("Clothes were added by clothessaver", source, 0, 255, 0) 
    end 
    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) 
        setElementModel(player,0) 
        for i=0, 17, 1 do 
            if ( textures[i+1] ~= " " ) then 
                addPedClothes(player, textures[i+1], models[i+1], i) 
            end 
        end 
        outputChatBox("Clothes were added by clothessaver", player, 0, 255, 0) 
        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 
            outputChatBox("Your skin must be skin 0 (CJ Skin)", player, 255, 0, 0) 
        end 
    else 
        outputChatBox("Please login!", player, 255, 0, 0) 
    end 
end 
addCommandHandler("saveClothes", saveClothes) 

Edited by Guest
Link to comment
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 
        outputChatBox("Clothes were added by clothessaver", source, 0, 255, 0) 
        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 
        outputChatBox("Clothes were added by clothessaver", player, 0, 255, 0) 
        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 
            outputChatBox("Your skin must be skin 0 (CJ Skin)", player, 255, 0, 0) 
        end 
    else 
        outputChatBox("Please login!", player, 255, 0, 0) 
    end 
end 
addCommandHandler("saveClothes", saveClothes) 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...