Jump to content

Buy Slots Bug


DarkAruna97

Recommended Posts

Posted (edited)

Hola queria saber como puedo hacer para solucionar un bug en este scripts

porque al colocar la cantidad de slots a comprar funciona bien cuesta $5000 money 

pero al colocar -1 slots negativos el servidor te regala o entrega $5000 money por slots alguna solucion para solucionar ese bug

para que no entregue cash al colocar slots negativos y salga "No puedes comprar slots menor a (1)"

function buyslots( number )
    local account = source:getAccount ( )
       if not account:isGuest ( ) then
           local moneytotal = tonumber( number ) * 5000
           if getPlayerMoney( source ) >= moneytotal then
            local mygang = getPlayerGroup(source)
            if mygang then
                addGroupSlots( mygang, number )
                outputChatBox("Has comprado: "..number.." slots para tu grupo",source,0,200,0,true)
                source:takeMoney ( moneytotal )
                addActionReg( source, "Buy "..number.." slots to group: "..mygang)
            end
        else
            outputChatBox("No tienes dinero suficiente para comprar esa cantidad de slots",source,200,0,0,true)
        end
    end
end
addEvent("buyslotsforgroup",true)
addEventHandler("buyslotsforgroup",ELEMENTOGLOBAL,buyslots)

 

Edited by DarkAruna97
  • MTA Team
Posted
function buyslots( number )
  if number <= 0 then 
    outputChatBox("Numero de slots invalido",source,255,0,0,true)
    return 
  end
    local account = source:getAccount ( )
       if not account:isGuest ( ) then
           local moneytotal = tonumber( number ) * 5000
           if getPlayerMoney( source ) >= moneytotal then
            local mygang = getPlayerGroup(source)
            if mygang then
                addGroupSlots( mygang, number )
                outputChatBox("Has comprado: "..number.." slots para tu grupo",source,0,200,0,true)
                source:takeMoney ( moneytotal )
                addActionReg( source, "Buy "..number.." slots to group: "..mygang)
            end
        else
            outputChatBox("No tienes dinero suficiente para comprar esa cantidad de slots",source,200,0,0,true)
        end
    end
end
addEvent("buyslotsforgroup",true)
addEventHandler("buyslotsforgroup",ELEMENTOGLOBAL,buyslots)

 

Posted (edited)
20 hours ago, .:CiBeR:. said:

function buyslots( number )
  if number <= 0 then 
    outputChatBox("Numero de slots invalido",source,255,0,0,true)
    return 
  end
    local account = source:getAccount ( )
       if not account:isGuest ( ) then
           local moneytotal = tonumber( number ) * 5000
           if getPlayerMoney( source ) >= moneytotal then
            local mygang = getPlayerGroup(source)
            if mygang then
                addGroupSlots( mygang, number )
                outputChatBox("Has comprado: "..number.." slots para tu grupo",source,0,200,0,true)
                source:takeMoney ( moneytotal )
                addActionReg( source, "Buy "..number.." slots to group: "..mygang)
            end
        else
            outputChatBox("No tienes dinero suficiente para comprar esa cantidad de slots",source,200,0,0,true)
        end
    end
end
addEvent("buyslotsforgroup",true)
addEventHandler("buyslotsforgroup",ELEMENTOGLOBAL,buyslots)

Me dice esto y se ha bugueado todo el sistema :P

error:groupsystem/server/server.lua:2:attempt to compare string with numer.

 

Edited by DarkAruna97
  • Recently Browsing   0 members

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