Admin powers skin: how to restrict unpriveliged players from using it?

Status
Not open for further replies.

OtherChen

The other one
I'm putting together a simple skin for server hosts and admins with stuff like invisibility, noclip, and insta-kill explosions. I'd like to prevent most players from selecting the skin by killing them instantly if a certain flag isn't set. But how would I set such a flag? Currently I've got a few options:
  • Only allow the server and admin to use the skin
  • Only allow the player on node 0 to use the skin
  • Set a password separate from the "verify" password, and make sure the player enters that password before selecting the skin
This is probably a job for Lua, but I don't know how to do any of these things.
 
Well, while we don't have stuff like that set by skin, Terminal(if you don't mind waiting) has a permissions setup with passwords similar to what you're looking for. It is indeed a job for Lua, but it isn't very hard to set up anyways. As for your request specifically, you can create a command with a password on it that will define a variable for you specifically and you can have the skin detect that before allowing you to switch to it.
 
The expression (player == server or player == admin) can be used to determine if a player is the host or verified. ("player" is assumed to be the variable of the player you're checking. "server" and "admin" are global variables that point to the player structs of the server and admin, respectively.) The rest of the script would simply be checking if the player's using your skin and that equation works out to false.

However, you don't explicitly have to kill the player. You can simply send a command to the player's console input to change them back to a default skin (you can either store the skin they used before and switch back to it, or just default them to Sonic), using the COM_BufInsertText(player, command) function. (Directly setting player.skin wouldn't change all of the skin-related values properly.)
 
Last edited:
Status
Not open for further replies.

Who is viewing this thread (Total: 0, Members: 0, Guests: 0)

Back
Top