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

[CS:GO] AchievementsGO 2.0 - create your own achievements!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author
MAGNET12
Member
Join Date: Dec 2017
Plugin ID:
7114
Plugin Version:
2.0
Plugin Category:
All
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Create achievements/missions in easy way
    Old 05-17-2020 , 08:17   [CS:GO] AchievementsGO 2.0 - create your own achievements!
    Reply With Quote #1

    I present second release of a plugin, that allows creating your own achievements/missions on the server in easy way. The previous version has had a lot of flaws and it was written in a very poor way. I hope the plugin will come in handy for people, who plan to create its own missions system and look for a comfortable solution

    How does it work?
    Plugin gives access to native functions and forwards, that allows for creating your achievements/missions and managing them from any plugin. Thanks to its diversity, it's possible to expand plugins, that already exist (such as Zombie or JailBreak for instance), but also to create standalone plugins - it's up to you.

    Commands
    Code:
    sm_ac
    sm_achievements
    sm_mission
    sm_missions
    Configuration
    1. Put package content onto your server (except ago_sample_missions if you don't wish to),
    2. Decide where you want informations to be stored - MySQL or SQLite. Depending on your answer, paste the following config in addons/sourcemod/configs/databases.cfg:

    For SQLite:
    Code:
    "AchievementsGO"
    {
      "driver"    "sqlite"
      "database"  "AchievementsGO"
    }
    For MySQL:
    Code:
    "AchievementsGO"
    {
      "driver"			"mysql"
      "host"				"HOST" // edit
      "database"			"AchievementsGO" // edit (optional)
      "user"				"USER" // edit
      "pass"				"HASLO" // edit
      //"timeout"			"0"
      "port"			"PORT" // edit, 3306 by default
    }
    3. Start creating

    How to create achievement/mission?
    Here's a sample plugin:
    Code:
    #include <AchievementsGO>
    
    int missionOne;
    int missionTwo;
    int missionThree;
    int missionFour;
    int missionFive;
    
    public void OnPluginStart() {
        RegConsoleCmd("sm_pkt", FreePoint);
    }
    
    public Action FreePoint(int client, int args) {
        AGO_AddPoint(client, missionOne);
    }
    
    public void AGO_OnRegisterAchievements() {
        AGO_AddAchievement("Keyboard master", "Type !pkt 5 times", "", 5, 1, OnIdGranted);
        AGO_AddAchievement("Mission two", "Mission two desc\nPrice: XXX", "", 60, 2, OnIdGranted);
        AGO_AddAchievement("Mission three", "Mission three desc\nPrice: XXX", "Catalog 1", 50, 3, OnIdGranted);
        AGO_AddAchievement("Mission four", "Mission four desc\nPrice: XXX", "Catalog 1", 11, 8, OnIdGranted);
        AGO_AddAchievement("Mission five", "Mission five desc\nPrice: +10 HP", "Catalog 2", 48, 1027, OnIdGranted);
    }
    
    public void AGO_OnPlayerAchievementsLoaded(int client) {
      if (AGO_IsAchievementCompleted(client, missionFive)) {
        // here the code, that assigns extra 10HP (some flag for instance)
      }
    }
    
    public void OnIdGranted(int achievementID, int temporaryID) {
        switch(temporaryID) {
            case 1: {
                missionOne = achievementID;
            }
            case 2: {
                missionTwo = achievementID;
            }
            case 3: {
                missionThree = achievementID;
            }
            case 8: {
                missionFour = achievementID;
            }
            case 1027: {
                missionFive = achievementID;
            }
        }
    }
    The place, where achievements are being registered, is function AGO_OnRegisterAchievements(). Inside we use AGO_AddAchievement, that contains a couple arguments:
    Code:
    native bool AGO_AddAchievement(char[] Name, char[] Description, char[] Category, int Value, int temporaryID, Function functionCallback);
    Name - achievement/mission name,
    Category - folder, the achievements will be assigned to. It allows easy groupping and organising according to your needs. When leaving this field blank (""), the achievement will remain without any category,
    Value - amount of points, that needs to be met to consider achievement finished. It can represent anything (ex. amount of required kills, amount of footsteps etc.),
    TemporaryID - auxiliary identifier, that helps to identify achievement, which will be registered by the engine and its ID will return to the callback. It has to be unique only within the single plugin range, where achievements are being implemented,
    functionCallback - independent ID is assigned to each mission. This parameter is just a function, where this information will go to.

    In the previous version, mission's ID was assigned via return (int mission = AGO_AddAchievement...), but it required synchronous and asynchronous queries to be mixed - this solution eliminates the issue.

    When ID is retrieved (assigned to some variable), we can start adding points to it. Most of the time, AGO_AddPoints will be used (as shown in the example above, where "keyboard master" can be finished by typing 5x !pkt command in the chat), but there are couple of native/forwards, that are available here

    AchievementsGO.cfg:
    Code:
    // Show chat notification to all players when player finishes achievement?
    // -
    // Default: "1"
    ago_achievement_notification_all "1"
    
    // Show chat notification when finishing achievement?
    // -
    // Default: "1"
    ago_achievement_notification_chat "1"
    
    // Show HintText notification when finishing achievement?
    // -
    // Default: "1"
    ago_achievement_notification_hint "1"
    
    // After how many days of inactivity player's records will be deleted? (0 - off, not recommended)
    // -
    // Default: "30"
    ago_database_time_kick "30"
    
    // Minimal amount of players for the achievements to work
    // -
    // Default: "3"
    ago_players_amount "3"
    Important note
    Bare in mind, that every time you make a change (ie add new mission or modify existing one), you should restart your server. Reloading plugin is not enough

    Available translations:
    - English,
    - Polish,
    - Swedish (by LaGgLs),
    - French (by Cripix)

    Updates:
    2.0 - first release
    2.1 - added "enforce" parameter in functions that add points. It allows to grant points even if there's not enough players on the server

    Screens (sorry for being lazy and not changing lang to eng. Plugin supports multilang though):
    https://imgur.com/a/9nxGL7W
    https://imgur.com/a/F3wTG4n
    https://imgur.com/a/XLaKtKM

    GitHub Repo

    Repository contains AGO engine and sample achievements, that give zephyrus store credits. Feel free to edit it according to your needs
    __________________

    Last edited by MAGNET12; 06-03-2020 at 17:43.
    MAGNET12 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 00:25.


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