Okay, this is probably my weirdest and most hard task for someone to program.
Brief notice: I know nothing about lua coding apart from the small times I’ve code monkeyed. So, if you do explain lua, please treat me like a child that was dropped as a baby nonstop since the day they were born.
Background information: So, on my server I got a playermodel for an African Penguin. Fairly simple, right? I have it in my dedicated server in the addons folder, and it is in my pointshop which has no mods to it besides a subcategory mod that doesn’t really change much.
This African Penguin playermodel is really small and so we decided to call it OP, as virtually nobody can hit it. I had many suggestions and urged to get rid of it, or better yet, adjust its size, however my players decided against it.
Question: So, that’s the background to me weird question, and this is: How can I randomly select someone who is currently playing the game, and then give that playermodel to them?
Needed Information: So I understand this will count as an addon, I guess, and so nobody will really help as it’s frankly a waste of time, however I understand that it’ll need a Random Number Generator (RNG) and then it’d give a command that’d then give them that playermodel. I assume it would be kind of simple, like just select someone at random using that RNG, and then run a command to give my playermodel (the model of which is located in garrysmod/addons/African Penguin/tsbb/animals/african_penguin.mdl) using a command to give them the model.
Instructions as to what I need and how I think I do it: As someone who can’t do basic lua, I don’t know how to do this, so I installed Bite My Apple’s Addon which can be found at https://forums.ulyssesmod.net/index.php/topic,6184 which works as a command of !setmodel [name] [model]. So, could you help me write a basic lua file that would randomly select a player, fetch their name, and then run “ulx setmodel [fetched name] models/tsbb/animals/african_penguin.mdl” ?
What I need: So basically, what I want to know is how to randomly select someone and then fetch their name, and then use that name in a command, and then run that command in the server console as an addon to my server that plays every round.
Optional help: HOWEVER, I would also like limitations to this. Would it be possible to limit it so that this command is only ran if there are over 6 players on the server, and it cannot happen to the same person twice in a row? Could I also make it run an announcement like csay throughout the server, announcing that the fetched name has become the penguin?
Thanks so much for anybody that would dare help me! I know this is tricky and likely a waste of time, but thank you even if you just wanted to say hi or wanted to have a look.