event onPlayerMoneyChanged
addEventHandler('onPlayerLogin',root,function()
local acc=getPlayerAccount(source)
if not getAccountData(acc,'money') then
setAccountData(acc,'money',getPlayerMoney(source))
end
end)
setTimer(function()
for k,plr in ipairs(getElementsByType('player'))do
if getElementType(plr)=='player' then
if getPlayerMoney(plr)~=tonumber(getAccountData(getPlayerAccount(plr),'money')) then
local acc=getPlayerAccount(plr)
if not isGuestAccount(acc) then
setAccountData(acc,'money',money)
triggerEvent('onPlayerMoneyChanged',root,getAccountName(acc),getPlayerMoney(plr),plr)
end
end
end
end
end,1000,0)
addEvent('onPlayerMoneyChanged',true)
parameters:
string accname,number money, player plr
accname=اسم حساب اللي تغيرت فلوسه
money=الفلوس الجديده بعد التغير
plr=اللاعب اللي تغيرت فلوسه
مثال:
Example:
addEventHandler('onPlayerMoneyChanged',root,function(accname,money,plr)
setAccountData(getAccount(accname),'mymoney',money)
end)
بالتوفيق للجميع