Ha átalakítod a Zerot akkor így néz ki:
mysql = exports.mysql
function giveMoney(thePlayer, amount)
amount = tonumber( amount ) or 0
if amount == 0 then
return true
elseif thePlayer and isElement(thePlayer) and amount > 0 then
amount = math.floor( amount )
if tonumber(amount) > 0 then
end
exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"money\", getMoney( thePlayer ) + amount, false )
if getElementType(thePlayer) == \"player\" then
mysql:query_free(\"UPDATE characters SET money = money + \" .. amount .. \" WHERE id = \" .. getElementData( thePlayer, \"dbid\" ) )
setElementData(thePlayer, \"money\", amount)
elseif getElementType(thePlayer) == \"team\" then
mysql:query_free(\"UPDATE factions SET bankbalance = bankbalance + \" .. amount .. \" WHERE id = \" .. getElementData( thePlayer, \"id\" ) )
end
return true
end
return false
end
function takeMoney(thePlayer, amount, rest)
amount = tonumber( amount ) or 0
if amount == 0 then
return true, 0
elseif thePlayer and isElement(thePlayer) and amount > 0 then
amount = math.ceil( amount )
local money = getMoney( thePlayer )
if rest and amount > money then
amount = money
end
if amount == 0 then
return true, 0
elseif hasMoney(thePlayer, amount) then
exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"money\", money - amount, false )
if getElementType(thePlayer) == \"player\" then
mysql:query_free(\"UPDATE characters SET money = money - \" .. amount .. \" WHERE id = \" .. getElementData( thePlayer, \"dbid\" ) )
setElementData(thePlayer, \"money\", amount)
local ujpenz = getMoney( thePlayer )
if ujpenz > 0 then
end
elseif getElementType(thePlayer) == \"team\" then
mysql:query_free(\"UPDATE factions SET bankbalance = bankbalance - \" .. amount .. \" WHERE id = \" .. getElementData( thePlayer, \"id\" ) )
end
return true, amount
end
end
return false, 0
end
function setMoney(thePlayer, amount, onSpawn)
amount = tonumber( amount ) or 0
if thePlayer and isElement(thePlayer) and amount >= 0 then
amount = math.floor( amount )
exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"money\", amount, false )
if tonumber(amount) > 0 then
end
if getElementType(thePlayer) == \"player\" then
if not onSpawn then
mysql:query_free(\"UPDATE characters SET money = \" .. amount .. \" WHERE id = \" .. getElementData( thePlayer, \"dbid\" ) )
end
setElementData(thePlayer, \"money\", amount)
elseif getElementType(thePlayer) == \"team\" then
mysql:query_free(\"UPDATE factions SET bankbalance = \" .. amount .. \" WHERE id = \" .. getElementData( thePlayer, \"id\" ) )
end
return true
end
return false
end
function hasMoney(thePlayer, amount)
amount = tonumber( amount ) or 0
if thePlayer and isElement(thePlayer) and amount >= 0 then
amount = math.floor( amount )
return getMoney(thePlayer) >= amount
end
return false
end
function getMoney(thePlayer, nocheck)
if not nocheck then
checkMoneyHacks(thePlayer)
end
return getElementData(thePlayer, \"money\") or 0
end
function checkMoneyHacks(thePlayer)
if not getMoney(thePlayer, true) or getElementType(thePlayer) ~= \"player\" then return end
local safemoney = getMoney(thePlayer, true)
local hackmoney = getElementData(thePlayer, \"money\")
if (safemoney < hackmoney) then
setElementData(thePlayer, \"money\", safemoney)
sendMessageToAdmins(\"Moneyhack gyanú: \"..getPlayerName(thePlayer))
return true
else
return false
end
end