Thread: SM Parachute
View Single Post
Sheepdude
SourceMod Donor
Join Date: Aug 2012
Location: Chicago
Old 01-20-2013 , 20:57   Re: SM Parachute
Reply With Quote #549

Old code:
Code:
Line 421: if (IsClientInGame(x) && IsPlayerAlive(x))
New code:
Code:
Line 421: if (IsClientInGame(x) && IsPlayerAlive(x) && CheckCommandAccess(x, "sm_parachute", ADMFLAG_GENERIC, true))
Example admin_overrides.cfg:
Code:
Overrides
{
	"sm_parachute" "do"
}
In this example, only admins that have both the "d" flag and the "o" flag will be able to use the parachute.

I don't know how expensive CheckCommandAccess is, so for optimization it would be better to do a status array which is populated in OnClientAuthorized. I wanted to make the point that adding admin access is really as easy as that, though. If you have a loose wallet, donate to SourceMod.

Edit: Fine, I felt bad about not doing the optimization so here it is, and a precompiled version for ya. Keep in mind that with this version only people who are given override access can use the parachute, and nobody else. I assume that's how you wanted it. Though you can do "sm_parachute" "" in overrides to give access to everyone.

(available on page 56)
__________________

Last edited by Sheepdude; 01-21-2013 at 16:54.
Sheepdude is offline