View Single Post
Thraka
AlliedModders Donor
Join Date: Aug 2005
Old 06-03-2010 , 14:05   Re: [ANY] MechaWare: Custom Achievements 2.0! (0.32)
Reply With Quote #82

This is based on 0.32.

Ok. I've modified the achievements plugin a bit to really create a true custom plugin trigger. The mw_achievements_get_ach table has a new column named id_name which must be the last (or 6th) column. This is a named identifier for the achievement because the ID may not always be the same.
Code:
`id_name` varchar(128) NOT NULL
The include file for plugins to use the achievements system has been expanded to not only allow triggering the achievement, but to query the achievement system for status. So you (from a plugin) can ask if a specific achievement (either by id_name or id) has been completed for a user or not.

There is also a forward in the achievement plugin now that will notify other plugins when an achievement has been completed.

I've attached all the files I've changed. My name is in each section that changed as THRAKA. Just search for the text THRAKA and you can easily find the additions.

The real reason for id_name is because I didn't want to have to hijack the task system for a fake event and run it through the whole detection system when I know I want to (through a plugin) trigger the achievement. This also has the added benefit of allowing an achievement to use the standard task based detections AND also be triggered through a plugin.


EDIT:
I've attached index.php which is the new admin page and supports the new id_name column, this was based on website v0.5. Additionally, I fixed the bug for deleting an achievement that gives you an error but still succeeds. Another bug I fixed is when you save an achievement (edit) which has no tasks, it would create a duplicate.

EDIT2:
Updated events.inc. There is a bug (even in original code) which allows an achievement to be triggered when it has no task associated with it when another achievement is actually achieved
Updated mw_achievements.sp. I think I left a print statement somewhere. I removed it.
Attached Files
File Type: inc mw_achievement_natives.inc (1.6 KB, 105 views)
File Type: inc sql.inc (8.5 KB, 102 views)
File Type: sp Get Plugin or Get Source (mw_achievements.sp - 103 views - 11.1 KB)
File Type: zip admin_index_php.zip (7.4 KB, 130 views)
File Type: inc events.inc (13.9 KB, 103 views)

Last edited by Thraka; 06-04-2010 at 01:24.
Thraka is offline