• Get Random nickname from server for a giveaway or something got error
    1 replies, posted
Hello i dont know why its keeping says error can anyone help me? [CODE]concommand.Add( "getrandom", getrandom ) function getrandom ( ) local rply = math.random(1, #player.GetAll()) for _, ply in pairs( #rply ) do print( ply:Nick() .. ", " .. ply:SteamID() .. "\n" ) PrintMessage( HUD_PRINTTALK, ply:Nick() .. ", " ) end end[/CODE] [CODE] [ERROR] lua/rand.lua:13: bad argument #1 to 'pairs' (table expected, got number) 1. pairs - [C]:-1 2. unknown - lua/rand.lua:13 3. unknown - lua/includes/modules/concommand.lua:54 [/CODE]
local ply = player.GetAll()[rply]
Sorry, you need to Log In to post a reply to this thread.