Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.

  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

[forums.alliedmods.net] tAdminByPassword v0.0.1 (2012-04-06)


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7177
  • Lokalizacja:AMXX.PL
Offline

Napisano 06.04.2012 14:10

Description
This plugin allows to not only have one server password specified by sv_password, but to have several passwords each giving different access permissions.

Requirements
This requires the Connect extension (only the Source 2009 engine is supported).
Thanks to asherkin for this.

Configuration
This plugin uses a modular approach for its configuration backend. At this time there is only a keyvalues-password store implemented.
There are three options that can be set for each password: A group to assign to the player, an immunity value and a flag string. If you don't specify any of those, but just the password it will allow you to get on the server like the original sv_password one.
After changing one of the stores, you can reload (and reapply) the passwords by using the command: sm_reloadpasswords.

Using KeyValues
This is pretty much the same as you already know from the core admin system.
Configure passwords by editing addonssourcemodconfigsadmin_passwords.cfg.



Code: "Passwords"
{
"1234"
{
"groups" "Administrator"
"flags" "z"
"immunity" "99"
}
}Players connecting using the password '1234' would be added to the group 'Administrator', be given the 'z' flag and an immunity value of 99.



Writing your own stores




PHP Code:

/**
* This gets called everytime the core requires the password
* storage to be refilled. All store implementations need to
* react to this call and (re)add all of their passwords.
* They don't need to call SVP_ReapplyPasswords, if they are
* adding all of their passwords within this call.
*
* @noreturn
*/
forward SVP_OnRefillRequest();

/**
* This needs to be called by asynchronous storages after
* adding all it's passwords to the SVP core, so all clients
* will be rechecked and their access rights adjusted.
*
* @noreturn
*/
native SVP_ReapplyPasswords();

/**
* Adds a new password to the SVP core.
*
* @param sPassword Password to set access rights for.
* @param sGroups Groups the client joining using this password
* will be in. Comma separated.
* @param sFlags Flags the client will be assigned to.
* @param iImmunity Immunity level for the client.
* @return Whether the password got stored successfully.
* @error Empty password, password already registered or
* internal error in creating the password trie.
*/
native bool:SVP_AddPassword(const String:sPassword[], const String:sGroups[] = "", const String:sFlags[] = "", iImmunity = -1);


/**
* Adds a new password trie to the SVP core. This is the raw version of
* SVP_AddPassword().
*
* @param sPassword Password to set access rights for.
* @param hTrie A trie handle containing at least one of the
* following keys:
* flags -- Bit string of ADMFLAG values.
* groups -- an avp array containg group name
* strings.
* immunity -- integer immunity value.
* @return Whether the password got stored successfully.
* @error Empty password, password already registered or
* internal error in creating the password trie.
*/
native bool:SVP_AddPasswordTrie(const String:sPassword[], Handle:hTrie);

/**
* Gets the password a client connected with.
*
* @param iClient Client to retrieve the password from.
* @param sPassword String buffer to store the password
* @param maxlen Size of the string buffer.
*
* @return false if the client did not connect using a
* password.
*/
native bool:SVP_GetClientPassword(iClient, String:sPassword[], maxlen);


/**
* Checks whether a password already has access rights assigned.
*
* @param sPassword Password to check.
*
* @return true if the password is already set.
*/
native bool:SVP_PasswordExists(const String:sPassword[]);




Public Servers:
You don't have to set the sv_password convar for this, but then your players need to connect via console to get their permissions:

connect <ip>:<port>;password <password>

Bugs
Report any you find, this is not as well tested as I would have liked it to.

Attached Files Dołączona grafika tAdminPasswords_0.0.1.zip (16.5 KB) Dołączona grafika Get Plugin or Get Source (tAdminPasswords.core.sp - 8.7 KB) Dołączona grafika Get Plugin or Get Source (tAdminPasswords.keyvalues.sp - 1.8 KB) Dołączona grafika tadminpasswords.inc (2.8 KB) Dołączona grafika admin_passwords.cfg (587 Bytes)

Wyświetl pełny artykuł




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych