Raised This Month: $51 Target: $400
 12% 

[ANY] Weddings


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author
Dr. O
Junior Member
Join Date: Jul 2013
Location: The House of Dr. O
Plugin ID:
3792
Plugin Version:
2.0.4
Plugin Category:
Fun Stuff
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    12 
    Plugin Description:
    Get married! Propose to other players, browse, accept and revoke proposals or get divorced again. Top couples will be chosen according to their combined score.
    Old 07-28-2013 , 05:15   [ANY] Weddings
    #1

    ...WEDDINGS...


    Finally, you can get married to the people you have been playing with and start a stable relationship with them. Good luck with that!
    This is my first plugin, please report any bugs you'll find.

    Installation

    Extract the zip to your sourcemod folder. If you update to a new version, make sure you delete the file "cfg\sourcemod\weddings.cfg" so that the updated one can be created.
    By default, the sourcemod-local database will be used. To use a custom one, e.g. the same among multiple servers, define a "weddings" entry in "sourcemod\configs\databases.cfg" and set sm_weddings_database to 1.

    Commands
    • sm_marry
    Opens a menu so you can browse all connected singles on the server and propose to one by selecting.
    • sm_revoke
    Revokes a proposal you have made.
    • sm_proposals
    Opens a menu so you can browse all players who have proposed to you, selecting one will accept the proposal and you will be married. Congratz ;)
    • sm_divorce
    Ends your marriage. But why would you do that?
    • sm_couples
    Opens a menu with the top couples, i.e. those who have the highest score. Also displays the corresponding wedding dates.
    • sm_weddings_reset
    Admin command, default flag: ban. Resets database tables.


    CVars

    Code:
    // How many minutes clients must wait after successful command usage.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "30.000000"
    sm_weddings_command_delay "0"
    
    // What database to use. Change takes effect on plugin reload.
    // 0 = sourcemod-local | 1 = custom
    // If set to 1, a "weddings" entry is needed in "sourcemod\configs\databases.cfg".
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    sm_weddings_database "0"
    
    // Whether to prevent unmarried clients from joining the server.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    sm_weddings_disallow_unmarried "0"
    
    // Message to display to kicked clients.
    // Only applies if sm_weddings_disallow_unmarried is set to 1.
    // -
    // Default: "Unmarried clients currently not allowed"
    sm_weddings_kick_message "Unmarried clients currently not allowed"
    
    // How many couples to show in the !couples menu.
    // -
    // Default: "10"
    // Minimum: "3.000000"
    // Maximum: "100.000000"
    sm_weddings_show_couples "10"


    Natives/Forwards

    Code:
    /**
     * Retrieves the slot number of a client's partner. Use this function to check whether a client is married.
     *
     * @param client            The slot number of the client.
     * @return                    The slot number of the partner, -2 if the client is not married, -1 if the partner is not connected.
     *                            If 0 is returned, then either the client is not connected, or the marital status is still being checked.
     */
    native GetPartnerSlot(client);
    
    
    /**
     * Retrieves the name of a client's partner.
     *
     * @param client            The slot number of the client.
     * @param buffer            Destination buffer, will be empty if the client is not married.
     * @param maxLen            Destination buffer length.
     * @noreturn
     */
    native GetPartnerName(client, String:buffer[], maxLen);
    
    
    /**
     * Retrieves the steam ID of a client's partner.
     *
     * @param client            The slot number of the client.
     * @param buffer            Destination buffer, will be empty if the client is not married.
     * @param maxLen            Destination buffer length.
     * @noreturn
     */
    native GetPartnerID(client, String:buffer[], maxLen);
    
    
    /**
     * Retrieves the marriage score of a client.
     *
     * @param client            The slot number of the client.
     * @return                    The marriage score, -1 if the client is not married.
     */
    native GetMarriageScore(client);
    
    
    /**
     * Retrieves the timestamp of a client's wedding.
     *
     * @param client            The slot number of the client.
     * @return                    The timestamp of the wedding, -1 if the client is not married.
     */
    native GetWeddingTime(client);
    
    
    /**
     * Fills an array with the proposals of all connected clients.
     * Given a client with slot number x, array[x] = -2 means the client has not proposed to anyone,
     * array[x] = -1 means the client has proposed but the target is not connected.
     * array[x] = 0 means that either the client is not connected, or the marital status is still being checked.
     * Any other number indicates the slot number of the target.
     * This array will NOT be updated! To update the array call GetProposals again.
     *
     * @param array                Destination array.
     * @param maxLen            Destination array length. This should be MaxClients + 1.
     * @noreturn
     */
    native GetProposals(array[], maxLen);
    
    
    /**
     * Fills an array with the marital statuses of all connected clients.
     * Given a client with slot number x: array[x] = -2 means the client is not married,
     * array[x] = -1 means the client is married but the partner is not connected.
     * array[x] = 0 means that either the client is not connected, or the marital status is still being checked.
     * Any other number indicates the slot number of the partner.
     * This array will NOT be updated! To update the array call GetMarriages again.
     *
     * @param array                Destination array.
     * @param maxLen            Destination array length. This should be MaxClients + 1.
     * @noreturn
     */
    native GetMarriages(array[], maxLen);
    
    
    /**
     * Called when a client makes a marriage proposal.
     *
     * @param proposer            The slot number of the proposer. 
     * @param target            The slot number of the target.
     * @noreturn                      
     */
    forward OnProposal(proposer, target);
    
    
    /**
     * Called when a client accepts a marriage proposal.
     *
     * @param proposer            The slot number of the proposer. 
     * @param accepter            The slot number of the accepter.
     * @noreturn                      
     */
    forward OnWedding(proposer, accepter);
    
    
    /**
     * Called when a client divorces.
     *
     * @param divorcer            The slot number of the divorcer.
     * @param partner            The slot number of the partner, -1 if the partner is not connected.
     * @noreturn                      
     */
    forward OnDivorce(divorcer, partner);
    Changelog

    Code:
    1.0
    - Initial release.
    
    1.1 
    - Bots no longer listed in the !marry menu.
    - Added sm_weddings_version cvar.
    
    1.2
    - Fixed a rare but possible bug.
    - Minor code changes.
    
    1.3
    - Added a bunch of natives.
    - Added sm_weddings_show_couples cvar.
    - Added auto-generated weddings.cfg file.
    
    1.4
    - Added support for a custom database.
    - Code changes.
    
    1.5
    - Connecting players no longer listed in the !marry menu.
    - Modified divorce notification: duration of marriage included.
    - More natives.
    
    1.6
    - Added sm_weddings_reset admin command.
    
    1.7
    - Added sm_weddings_command_delay cvar.
    - Fixed a bug.
    
    1.8
    - Blocking bi-directional proposals, notifying about an existing proposal instead.
    - Bug fixes.
    
    1.9
    - Added sm_weddings_disallow_unmarried, sm_weddings_kick_message cvars.
    - Advanced command usage storing, allowing greater delays.
    - Added combined marriage score: sum of frags of both clients.
    - Top couples ordered by marriage score.
    - Bug fixes.
    
    1.9b
    - Small bug fixes.
    
    2.0
    - Switched to threaded-sql for better performance.
    - Drastically reduced interaction with the database by optimizing code.
    - Reworked existing native functions.
    - Added new native functions.
    
    2.0b
    - A few necessary fixes.
    
    2.0.1
    - Even more fixes.
    
    2.0.2
    - Filled some documentation gaps.
    
    2.0.3
    - Small bug fixes.
    
    2.0.4
    - Swapped marriage date and score in the !couples menu so that points are more easily visible.
    Credits

    Special thanks to:

    Testers from the awesome pvkii community:
    - Dinah
    - Sir Whiskeyngton
    - Asmundr

    Screenshots
    Attached Thumbnails
    Click image for larger version

Name:	Clipboard01.jpg
Views:	2870
Size:	33.6 KB
ID:	123323   Click image for larger version

Name:	Clipboard02.jpg
Views:	1700
Size:	13.8 KB
ID:	123324   Click image for larger version

Name:	Clipboard03.jpg
Views:	1428
Size:	36.2 KB
ID:	123325   Click image for larger version

Name:	Clipboard07.jpg
Views:	1738
Size:	11.7 KB
ID:	123335   Click image for larger version

Name:	1.jpg
Views:	1532
Size:	26.0 KB
ID:	128049  

    Click image for larger version

Name:	2.jpg
Views:	2106
Size:	58.5 KB
ID:	128050  
    Attached Files
    File Type: zip weddings_2.0.4.zip (36.7 KB, 1864 views)

    Last edited by Dr. O; 01-10-2015 at 13:06.
    Dr. O is offline
     



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


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


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