opnaiC Posted August 19, 2016 Share Posted August 19, 2016 function startStats (player) statTable = {} for index, player in ipairs(getElementsByType("player")) do local account = getPlayerAccount(player) if account and not isGuestAccount(account) then local playerName = getPlayerName(player) local faction = getAccountData(account, "faction") or 0 local lvls = getAccountData(account, "lvl") or 0 table.insert(statTable,{playerName,faction,lvls}) end end triggerClientEvent(player,"addItems", player, statTable) end addEventHandler ("onResourceStart", root, startStats) function addItems(statTable) for i,v in pairs (statTable) do windowMenuLable1 = guiCreateLabel(x*12, y*36, x*277, y*22, "Имя: "..v[1], false, windowMenu3) windowMenuLable2 = guiCreateLabel(x*12, y*68, x*277, y*22, "Уровень: "..v[3], false, windowMenu3) windowMenuLable3 = guiCreateLabel(x*12, y*100, x*277, y*22, "Фракция: "..v[2], false, windowMenu3) end end addEvent ("addItems", true) addEventHandler ("addItems", root, addItems) Error: What did I wrong? Link to comment
Bonsai Posted August 19, 2016 Share Posted August 19, 2016 The triggerClientEvent function is outside of the loop so you cannot use the "player" variable of the loop. Instead it uses the resource variable also called "player", that is provided by onResourceStart event. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now