Tokio Posted June 29, 2019 Share Posted June 29, 2019 (edited) client: local Admins = {} addEvent("updateAdmins",true) addEventHandler("updateAdmins",root, function(t) Admins = t end) function isPlayerAdmin(player) if(Admins[player]) then return true end return false end function asdi() for k,v in ipairs(Admins) do outputChatBox(k) end end addCommandHandler("asd",asdi) server: local Admins = {} function isPlayerAdmin(player) if(Admins[player]) then return true end return false end addEventHandler("onPlayerLogin",root, function() if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ))then if not(Admins[source])then Admins[source]= source triggerClientEvent("updateAdmins",source,Admins) end end end) addEventHandler("onPlayerQuit",root, function() if(Admins[source])then Admins[source]= nil triggerClientEvent("updateAdmins",source,Admins) end end) No errors, no warnings... What wrong? Edited June 29, 2019 by Tokio Link to comment
Moderators Patrick Posted June 29, 2019 Moderators Share Posted June 29, 2019 HUNGARIAN A táblázatodban a sorok indexe a player elementje és nem számok, növekvő sorrendben. Ezért ipairs helyett pairs-t kell használnod. Lényegében ezt veheted egy "szabálynak" is, ha saját indexű sorokat használsz, és nem table.insert-el adod hozzá a sorokat a táblázathoz, akkor pairs-t kell használni és jó lesz. ENGLISH Because you use custom indexed array (index is the player's element), you need to use pairs instead of ipairs. for element, value in pairs(Admins) do outputChatBox(getPlayerName(element) .. " is admin!") end 1 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