PDA

View Full Version : Problem with script with payout money



czempion15
12-26-2019, 06:48 PM
Hello.
I have problem with script, when we payout more that 100cc script give all cc from backpack.
There is code:

if PlayerTable.JOGO == Games.NULL and table.contains(_Commands_Payout, Message) and 2 <= os.difftime(os.time(), Last_Payout) then
local posx, posy, posz = 0, 0, 0
local totalValue = PlayerTable.BALANCE
if 0 < PlayerTable.BALANCE then
posx, posy, posz = Positions.Counter_Pos.x, Positions.Counter_Pos.y, Positions.Counter_Pos.z
end
if posx ~= 0 and posy ~= 0 and posz ~= 0 then
while PlayerTable.BALANCE > 100 do
if 0 < Container_Index.CC_BP:ItemCount() then
for i = Container_Index.CC_BP:ItemCount() - 1, 0, -1 do
local Spot = Container_Index.CC_BP:GetItemData(i)
if Spot.id == 3043 then
local beforePay_Count = Container_Index.CC_BP:ItemCount() - 1
Container_Index.CC_BP:MoveItemToGround(i, posx, posy, posz, 100)
wait(Self.Ping() + 450)
if beforePay_Count ~= Container_Index.CC_BP:ItemCount() - 1 then
PlayerTable.BALANCE = PlayerTable.BALANCE - 100
end
else
end
end
elseif 1 < Container_Index.Extra_CC_BP:ItemCount() then
for i = Container_Index.Extra_CC_BP:ItemCount() - 1, 0, -1 do
local Spot = Container_Index.Extra_CC_BP:GetItemData(i)
if Spot.id == 3043 then
local beforePay_Count = Container_Index.Extra_CC_BP:ItemCount() - 1
Container_Index.Extra_CC_BP:MoveItemToGround(i, posx, posy, posz, 100)
wait(Self.Ping() + 450)
if beforePay_Count ~= Container_Index.Extra_CC_BP:ItemCount() - 1 then
PlayerTable.BALANCE = PlayerTable.BALANCE - 100
end
else
end
end
elseif backToCheck() then
for i = Container_Index.Extra_CC_BP:ItemCount() - 1, 0, -1 do
local Spot = Container_Index.Extra_CC_BP:GetItemData(i)
if Spot.id == 3043 then
local beforePay_Count = Container_Index.Extra_CC_BP:ItemCount() - 1
Container_Index.Extra_CC_BP:MoveItemToGround(i, posx, posy, posz, 100)
wait(Self.Ping() + 450)
if beforePay_Count ~= Container_Index.Extra_CC_BP:ItemCount() - 1 then
PlayerTable.BALANCE = PlayerTable.BALANCE - 100
end
break
end
end
end
end
if PlayerTable.BALANCE <= 100 then
if 0 < Container_Index.CC_BP:ItemCount() then
for i = Container_Index.CC_BP:ItemCount() - 1, 0, -1 do
local Spot = Container_Index.CC_BP:GetItemData(i)
if Spot.id == 3043 then
local beforePay_Count = Container_Index.CC_BP:ItemCount() - 1
Container_Index.CC_BP:MoveItemToGround(i, posx, posy, posz, PlayerTable.BALANCE)
wait(Self.Ping() + 450)
if beforePay_Count ~= Container_Index.CC_BP:ItemCount() - 1 then
PlayerTable.BALANCE = PlayerTable.BALANCE - PlayerTable.BALANCE
end
break
end
end
elseif 1 < Container_Index.Extra_CC_BP:ItemCount() then
for i = Container_Index.Extra_CC_BP:ItemCount() - 1, 0, -1 do
local Spot = Container_Index.Extra_CC_BP:GetItemData(i)
if Spot.id == 3043 then
local beforePay_Count = Container_Index.Extra_CC_BP:ItemCount() - 1
Container_Index.Extra_CC_BP:MoveItemToGround(i, posx, posy, posz, PlayerTable.BALANCE)
wait(Self.Ping() + 1000)
if beforePay_Count ~= Container_Index.Extra_CC_BP:ItemCount() - 1 then
PlayerTable.BALANCE = PlayerTable.BALANCE - PlayerTable.BALANCE
end
break
end
end
end
Self.Say("Your Money: " .. math.floor(totalValue) .. "cc.")
end
end
PlayerTable.BALANCE = 0
Last_Payout = os.time()
end
end
end
end
end)