• Setting a limit to a command?
    3 replies, posted
Hello everyone, I've been trying to figure this out for the past two days and I can't figure it out! I need to basically set a limit to using this command to 1 so they can only type it once instead of being able to spam it and it automatically going to a map-vote just because on person is spamming (!rtv) Here's the basic command: [CODE] elseif lowtext == "!rtv" then RTV.AddVote(ply)[/CODE] [CODE]function RTV.AddVote(ply) if !RTV.rocks[ply:SteamID()] and !RTV.voting then table.insert(RTV.rocks, ply:SteamID()) announcment({Color(204,102,0), ply:Name(), Color(255,255,255), " has rocked the vote!"}) RTV.CheckIfReady() end end[/CODE]
[lua] if !RTV.rocks[ply:SteamID()] and !RTV.voting then table.insert(RTV.rocks, ply:SteamID())[/lua] Looks like you already have something to prevent the player from doing it more than once. You're just inserting the players into the RTV.rocks table wrong. Don't use table.insert in this case, do this instead: [lua]RTV.rocks[ply:SteamID()] = true[/lua] This should do what you want.
Sadly that doesn't work. Even though it does limit how many times they can do it it doesn't pop open the menu when 2/2 players have typed the command.
[QUOTE=IGRed;42114888]Sadly that doesn't work. Even though it does limit how many times they can do it it doesn't pop open the menu when 2/2 players have typed the command.[/QUOTE] Then there's probably a problem with your RTV.CheckIfReady function.
Sorry, you need to Log In to post a reply to this thread.