AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CS:GO] AchievementsGO 2.0 - create your own achievements! (https://forums.alliedmods.net/showthread.php?t=324482)

MAGNET12 05-17-2020 08:17

[CS:GO] AchievementsGO 2.0 - create your own achievements!
 
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

eliteroyal 05-17-2020 09:18

Re: AchievementsGO 2.0
 
1 Attachment(s)
Hi, how to use with tibarification shop?

MAGNET12 05-17-2020 09:25

Re: AchievementsGO 2.0
 
This plugin doesn't seem to have any natives that can set the currency. You'd need to modify the plugin and add some

Agent Wesker 05-18-2020 12:12

Re: [CS:GO] AchievementsGO 2.0 - create your own achievements!
 
Could you add a feature to view a sorted list of top players (most accumulated achievements) and specific players?

Example:
/ac magnet12 -> for specific player
/top_ac ->for list

LaGgLs 05-18-2020 13:23

Re: [CS:GO] AchievementsGO 2.0 - create your own achievements!
 
1 Attachment(s)
Dont know if you want to add it but heres a swedish translations

MAGNET12 05-19-2020 11:40

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

Originally Posted by Agent Wesker (Post 2700871)
Could you add a feature to view a sorted list of top players (most accumulated achievements) and specific players?

Example:
/ac magnet12 -> for specific player
/top_ac ->for list

This feature was available in the old version, however i decided to remove it, since i didn't find it useful

MAGNET12 05-19-2020 11:41

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

Originally Posted by LaGgLs (Post 2700877)
Dont know if you want to add it but heres a swedish translations

tack sa mycket!

MAGNET12 05-29-2020 18:20

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

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

XHUNTERX 05-29-2020 19:53

Re: [CS:GO] AchievementsGO 2.0 - create your own achievements!
 
dude is a great add-on
can you add them for me

Code:

[DEAGLE MASTER]
[AK47 MASTER]

thank you so much

alex123pavlov 05-31-2020 17:46

Re: [CS:GO] AchievementsGO 2.0 - create your own achievements!
 
How do I fix the error?
[SM] Exception reported: Language phrase "MainMenuTitle" not found (arg 6)
[SM] Blaming: AchievementsGO.smx
[SM] Call stack trace:
[SM] [0] Format
[SM] [1] Line 13. E:\sourcemod\scripting\include\AchievementsGO/AchievementsGO_Menu.sp: ShowAchiewementsMenu


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

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