Jump to content

no me guarda bien el dinero el script de savemoney


russelvelt

Recommended Posts

buenas a todos tengo un problemita en el resource para guardar dinero osea todo anda bien me guarda normal exepto cuando por ejemplo tengo $8000 de dinero y compro algo de $5000 mi dinero queda en $3000 pero a la hora de reconectar al servidor este vuelve a $8000 y quisiera saber el problema aqui muestro como es

node = xmlLoadFile ("player.xml") 
  
function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) 
    if not (isGuestAccount (getPlayerAccount(source))) then 
        local accountData = getAccountData (theCurrentAccount, "money") 
        if (accountData) then 
            local playerMoney = getAccountData(theCurrentAccount, "money") 
            setPlayerMoney(source, playerMoney) 
              end 
              end 
            end 
            addEventHandler("onPlayerLogin", getRootElement(), playerLogin) 
  
function onQuit() 
    if not (isGuestAccount (getPlayerAccount (source))) then 
        account = getPlayerAccount (source) 
        if (account) then 
            setAccountData(account,"money", tostring(getPlayerMoney(source))) 
        end 
    end 
end 
addEventHandler("onPlayerQuit", getRootElement(), onQuit) 

Link to comment
GUIEditor_Window = {} 
GUIEditor_Button = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.3,0.2,0.4,0.5,"",true) 
guiSetAlpha(GUIEditor_Window[1],225) 
guiCreateStaticImage ( 0, 0, 1, 0.8,"image.png",true,GUIEditor_Window[1]) 
guiSetVisible(GUIEditor_Window[1],false) 
GUIEditor_Button[1] = guiCreateButton(0.52,0.85,0.45,0.1,"SI",true,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(0,0.85,0.45,0.1,"NO",true,GUIEditor_Window[1]) 
  
function showGUI2() 
guiSetVisible (GUIEditor_Window[1],true) 
showCursor(true) 
end 
addEvent("showGUI2",true) 
addEventHandler("showGUI2",getRootElement(),showGUI2) 
  
addEvent("hideGUI2",true) 
addEventHandler("hideGUI2",getRootElement(), 
function () 
guiSetVisible(GUIEditor_Window[1],false) 
showCursor (false) 
end) 
  
addEventHandler("onClientGUIClick",getRootElement(), 
function (player) 
   if (source == GUIEditor_Button[2]) then 
   guiSetVisible (GUIEditor_Window[1],false) 
   showCursor (false) 
   elseif (source == GUIEditor_Button[1]) then 
   money = getPlayerMoney (source) 
   if (money < 10) then 
   outputChatBox ("vas a pagar $10?",225,0,0) 
   else 
   player = getLocalPlayer() 
     playSound( "item.mp3", false ) 
   outputChatBox ("compraste comida",225,225,0) 
   takePlayerMoney(10) 
   setElementHealth ( player, getElementHealth(player) + 25 ) 
   end 
  end 
end) 
  

Link to comment
  • Recently Browsing   0 members

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