DarkAruna97 Posted October 20, 2016 Share Posted October 20, 2016 (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 October 20, 2016 by DarkAruna97 Link to comment
MTA Team 0xCiBeR Posted October 21, 2016 MTA Team Share Posted October 21, 2016 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) Link to comment
DarkAruna97 Posted October 21, 2016 Author Share Posted October 21, 2016 (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 error:groupsystem/server/server.lua:2:attempt to compare string with numer. Edited October 21, 2016 by DarkAruna97 Link to comment
Tomas Posted October 21, 2016 Share Posted October 21, 2016 if number and tonumber(number) <= 0 then outputChatBox("Numero de slots invalido",source,255,0,0,true) return end Link to comment
-Rex- Posted October 23, 2016 Share Posted October 23, 2016 (edited) Ese es Mi sistema de grupos.... Y Eso se modifica en el client side Edited October 23, 2016 by -Rex- Link to comment
Recommended Posts