Jump to content

Error


Recommended Posts

Bien, tengo un error con el siguiente script:

    function creatingTables() 
        exports.scoreboard:addScoreboardColumn("Cash") 
        executeSQLCreateTable("playerData", "account STRING, Cash INT, DMAttempts INT, DDAttempts INT") 
        outputChatBox("Cash System by KHD started.") 
        for index, player in ipairs(getElementsByType("player")) do 
            addAccountIfNotExists(player) 
        end 
    end 
    addEventHandler("onResourceStart", resourceRoot, creatingTables) 
      
    function addAccountIfNotExists(player) 
        local account = getPlayerAccount(player) 
        local CheckPlayer = executeSQLSelect ( "playerData", "*", "account = '" .. account .. "'" ) 
          
        if ( type( CheckPlayer ) == "table" and #CheckPlayer == 0 ) or not CheckPlayer then 
            executeSQLInsert ( "playerData", "'"..account.."','0','0','0'" ) 
        else 
            local Cash  = tonumber(CheckPlayer [1]["Cash"]) 
            setElementData(source,"Cash", Cash) 
            setElementData(source,"data.money",Cash,true)         
        end 
    end 
      
    addEventHandler("onPlayerJoin",root,function () addAccountIfNotExists(source) end) 
      
    function DestructionMoney(mapInfo,mapOptions,gameOptions) 
    info = mapInfo.modename 
    if mapInfo.modename == "Destruction derby" then 
        for k,v in ipairs(getElementsByType("player")) do 
            local account = getPlayerAccount(v) 
            local DDAttempts = executeSQLSelect ( "playerData", "DDAttempts","account = '" .. account .. "'") 
            local DDAttempts = tonumber(DDAttempts[1]["DDAttempts"]) + 1 
            executeSQLUpdate ( "playerData", "DDAttempts = '"..DDAttempts.."'","account = '" .. account .. "'") 
            setElementData(v,"data.DDAttempts",DDAttempts,true) 
            end 
        end 
    end 
    addEvent("onMapStarting") 
    addEventHandler("onMapStarting", getRootElement(), DestructionMoney) 
      
    function DestructionMoney2(thePlayer) 
        local playername = getPlayerName(thePlayer) 
        local account = getPlayerAccount(thePlayer) 
        local Cash = executeSQLSelect ( "playerData", "Cash","account = '" .. account .. "'") 
        
        outputChatBox("*Wins: "..playername.." took $"..get('MoneyForDD').." for winning the map!",getRootElement(),255,255,0) 
        local Cash  = tonumber(Cash[1]["Cash"]) + get('MoneyForDD') 
        setElementData(thePlayer ,"Cash", Cash) 
        setElementData(thePlayer ,"data.money",Cash,true) 
        setElementData(thePlayer ,"data.playername",playername,true) 
        executeSQLUpdate ( "playerData", "Cash = '"..Cash.."'","account = '" .. account .. "'") 
    end 
      
    function hunterBonus(pickupID, pickupType, vehicleModel) 
    if (info == "Destruction derby" and pickupType == "vehiclechange" and vehicleModel == 425) then     
        local account = getPlayerAccount(source) 
        local Cash = executeSQLSelect ( "playerData", "Cash","account = '" .. account .. "'") 
        local Cash = tonumber(Cash[1]["Cash"]) + 1000   
        outputChatBox("*Hunter: "..getPlayerName(source).." gets a $1000 hunter bonus!",source,25,125,225,true ) 
        setElementData(source ,"Cash", Cash) 
        setElementData(source ,"data.money",Cash,true) 
        executeSQLUpdate ( "playerData", "Cash = '"..Cash.."'","serial = '" .. serial .. "'") 
        end 
    end 
    addEventHandler("onPlayerPickUpRacePickup",getRootElement(),hunterBonus) 
     
        addCommandHandler("cash", 
    function (thePlayer) 
         local money = tonumber(getElementData(thePlayer,"data.money")) 
         if (money) then 
               outputChatBox("Your money is $".. tostring(money) .."!",thePlayer,0,255,0) 
         end 
    end) 

ERROR: [gameplay]\cash-KHD\cash.lua:31: attempt to concatenate local 'account' (a userdata value) 

El caso esque antes funcionaba bien, usaba serial envez de cuentas, pero ahora para hacer el server mas profesional, con su login y todo, lo he tenido que cabiar y no va...

Link to comment
  • Recently Browsing   0 members

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