استخدم setAccountData
لتخزين اسم الاعب على الحساب
وحولته عادي oop هذا كود كان عندي كان
function accounts(_, arg2)
if eventName == "onResourceStart" then
for k, v in ipairs(getElementsByType("player")) do
local account = getPlayerAccount(v)
if account and not isGuestAccount(account) then
setAccountData(account, "nick", getPlayerName(v))
end
end
elseif eventName == "onPlayerLogin" then
setAccountData(arg2, "nick", getPlayerName(source))
elseif eventName == "onPlayerChangeNick" then
local account = getPlayerAccount(source)
if account and not isGuestAccount(account) then
setAccountData(account, "nick", arg2)
end
end
end
addEventHandler("onResourceStart", resourceRoot, accounts)
addEventHandler("onPlayerLogin", root, accounts)
addEventHandler("onPlayerChangeNick", root, accounts)