Jump to content

Bug al guardar skin


Destroyer.-

Recommended Posts

Hola, queria pedir ayuda sobre un guardado de skin es que cuando lo guardo si se guarda, pero si cojo otro skin (sin guardar) y me desconecto se me bugea y desaparece, no tira nada en debugscript solo tira cuando intento "cargar" el skin

  
function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) 
  if  not (isGuestAccount (getPlayerAccount (source))) then 
    local accountData = getAccountData (theCurrentAccount, "money") 
    if (accountData) then 
local lastmodel = getAccountData (theCurrentAccount, "lastSkin") 
  
 end    
  end 
end 
addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) 
  
  
function onQuit (quitType, reason, responsibleElement) 
  if not (isGuestAccount (getPlayerAccount (source))) then 
    account = getPlayerAccount (source) 
    if (account) then 
  
local model = tonumber(getElementData(source, "model") or 0) 
setAccountData(account,"lastSkin",model)  
       
    end 
  end 
end 
addEventHandler ("onPlayerQuit", getRootElement(), onQuit) 
  
--y aca hice ésto justamente para testear 
  
function testing() 
  
local acc = getPlayerAccount(source)  
local data = getAccountData(acc,"lastSkin")  
setElementModel(source,data)  
  
  
  
end 
addCommandHandler("skin",testing) 
  
function testing1(player) 
  
  
setElementData(player, "model", getElementModel(player)) 
outputChatBox("Skin Guardado Exitosamente.", player, 255, 20, 20, true) 
  
  
  
end 
addCommandHandler("skins",testing1) 
  
  
  
  
  

Como dije, me tira error al desconectarme con otro skin que no sea el guardado y entrar y poner /skin, espero me puedan ayudar :c

Bad Argument @ ´setElementModel´ [Expected number  at argument 2, got boolean] 

Link to comment
  
addEventHandler("onPlayerQuit", root, 
    function () 
        if ( not isGuestAccount( getPlayerAccount( source ) ) ) then 
            skin, money = getElementModel(source), getPlayerMoney(source) 
            setAccountData(getPlayerAccount(source), "data", skin..";"..money) 
        end 
    end 
) 
  
addEventHandler("onPlayerLogin", root, 
    function (_, acc) 
        data = getAccountData(acc, "data") 
        data = split(data, ";") 
        setElementModel(source, data[1]) 
        givePlayerMoney(source, data[2]) 
    end 
) 
  

Link to comment
  • Recently Browsing   0 members

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