AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   Basic Donator Interface (https://forums.alliedmods.net/showthread.php?t=122315)

toazron1 03-25-2010 14:43

Basic Donator Interface
 
Note: This plugin has moved
The new thread can be found here:
http://forums.alliedmods.net/showthread.php?t=145542


Information here left for thread legacy

Natives:
PHP Code:

/**
 * Register a menu item.
 * 
 * @param name            Name of the menu item.
 * @param func            Callback for menu items.
 * @return                Menu item ID.
 */
native DonatorMenu_RegisterItem(const String:name[], DonatorMenuCallback:callback);

/**  
 * Get a clients donator level, -1 if invalid
 * 
 * @param iClient    Client
 * @return            Donator level
 */
native GetDonatorLevel(iClient);

/**  
 * Sets a clients donator level
 *
 * @param iClient        Client
 * @param iLevel        Donator level
 * @return                Nothing
 */
native SetDonatorLevel(iClientiLevel);

/**  
 * Returns True if a client is a donator, -1 if invalid
 * 
 * @param iClient    Client
 * @return            bool
 */
native bool:IsClientDonator(iClient);

/**  
 * Returns True if a steamid is a donator, -1 if invalid
 * 
 * @param iClient    Client
 * @return            bool
 */
native bool:FindDonatorBySteamId(const String:szSteamId[]);

/**  
 * Returns a clients connect message
 
 * @param iClient        Client
 * @return                Clients connect message
 */
native GetDonatorMessage(iClient, const String:szMessage[], iLength);

/**  
 * Sets a donators connect message
 *
 * @param iClient        Client
 * @param szMessage        Message to show on donator connect
 * @return                Nothing
 */
native SetDonatorMessage(iClient, const String:szMessage[]); 

Forwards:
PHP Code:

/**
 * Forwards when a donator connects.
 *
 * @param iClient        Client
 * @noreturn
 */
forward OnDonatorConnect(iClient);

/**
 * Forwards for everyone (right after OnPostAdminCheck)
 *
 * @param iClient        Client
 * @noreturn
 */
forward OnPostDonatorCheck(iClient); 

Usage
For example, if you wanted to make donators immune to the auto team balance in gScramble you can add an IsClientDonator(client) check into the IsValidTarget(...) check to skip a player who is a donator.

Another feature is a centralized menu for plugins to register with which can minimize the amount of commands a player has to remember. This menu can be access by typing whatever CHAT_TRIGGER is set to (defaults !donators).

To register a menu with the core:
PHP Code:

public OnAllPluginsLoaded()
{
    
DonatorMenu_RegisterItem("MENU TITLE"MenuCallback);


See one of the attached plugins for an example of a fully functional example.

toazron1 03-25-2010 14:44

Re: Basic Donator Interface
 
Plugins using this interface:

TF2: Donator Recognition

bouncer 03-25-2010 17:58

Re: Basic Donator Interface
 
question...
the db that u wrote about setting up named donators, thats to fetch from db all donators so it knows who's a donator in server right?

What if a client on connect is given custom flag o (our donator flag) , would this plugin then see him as a donator?

How to change all instances of your flag to my flag o?
cause I can't figure out what flag you're using.

toazron1 03-25-2010 18:05

Re: Basic Donator Interface
 
This reads a database to get who is a donator, it does not currently have anyway of using flags to set donators.

bouncer 03-25-2010 18:17

Re: Basic Donator Interface
 
Ah I would use it.. but I realy don't want to create new database and all that... too much.

I rather have plugin check if the user has flag o . Cause we have another plugin that automatically assigns players' flags depending on what usergroup they are in on our vbulletin site.

It basically automatically gives them admin rights depending on their usergroup on our site :)


So yeah... would use it gladly but unfortunetly wont I guess since it doesnt work on checking if person has flag o

toazron1 03-25-2010 18:34

Re: Basic Donator Interface
 
That is an interesting setup, but just checking "o" is far too simple for what I'm looking to accomplish with this.

Rob1991 03-25-2010 18:37

Re: Basic Donator Interface
 
Is it possible to set this up with the following?

Premium / VIP

- VIP Skin
- Immunity to Team Swap
- Immunity to vote kick/ban/mute
- Immunity to high ping kicker
- Free defusal when CT each round
- Free HE, FLASH, SMOKE - Flash disabled for non VIP
- Set $200 at round start

Can you help me set this up? Im not sure about this plugin or how it works. Is the above possible?

toazron1 03-25-2010 18:42

Re: Basic Donator Interface
 
Short answer: No.
Long answer: Yes, but that is not within the scope of this plugin since it is a core. You would need to make (or have someone make) a separate plugin which hooks into this one using the forwards and natives.

Rob1991 03-25-2010 18:54

Re: Basic Donator Interface
 
Ahh ok thanks for your reply anyway. Would it be hard to make these separate plug-ins to do this? I wouldn't know where to start.

toazron1 03-25-2010 19:08

Re: Basic Donator Interface
 
I don't code for any other game than TF2, but I don't think it would be hard for someone to make that and hook it into this one.


All times are GMT -4. The time now is 08:29.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.