Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ulx.randomgen(calling_ply, reward)
- ulx.fancyLogAdmin(calling_ply, true, "#A created a random vote!")
- local names = {}
- for k, v in ipairs(player.GetAll()) do
- if IsValid(v) && v:IsPlayer() then
- table.insert(names, v:Nick())
- end
- end
- local winner = names[math.random(#names)]
- for k, v in ipairs(player.GetAll()) do
- if string.lower(reward) == "reward" then
- v:ChatPrint(winner .. " was randomly selected as the winner!")
- else
- v:ChatPrint(winner .. " was randomly selected as the winner! They got: " .. reward .. "!")
- end
- end
- end
- local randomname = ulx.command("Custom", "ulx randomgen", ulx.randomgen, "!random", true)
- randomname:defaultAccess(ULib.ACCESS_ADMIN)
- randomname:addParam{type=ULib.cmds.StringArg, hint="reward", ULib.cmds.takeRestOfLine}
- randomname:help("A random player will be given a reward (not automatic, you must add it to their account).")
- //Made from scratch by Zero
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement