SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 18/08/2011, 11:46 PM   #1
iPLEOMAX
High-roller
 
iPLEOMAX's Avatar
 
Join Date: Mar 2011
Location: AE
Posts: 1,250
Reputation: 746
Lightbulb :: iAchieve :: Dynamic Achievement System - (Notify-on-achieve) (Stylish Textdraws) (uses Y_INI for saving/loading)

iAchieve
* Dynamic Achievement System *

Image


Hello Guys, This is another include release by me which is (i think) quite better than my other ones. ^^
What I've made here is an achievement system which automatically
notifies a player on achievement and gives rewards as you wish...

How does this work?
Suppose you wan't a player to achieve "Sam Fisher" for having 20 fists kills in the night.
You simply do:

pawn Code:
//On top of script:
new Ach_SamFisher;
//In GameModeInit:
Ach_SamFisher = CreateAchievement("Sam Fisher","Nice Combat Skill!~n~You killed 20 people at night using only your fists!~n~+50 score and +50000$!", 20);
//Why '20' at last? Because that's how many kills you'll need someone to make.

Now, You add this:
pawn Code:
GivePlayerAchievement(killerid, Ach_SamFisher, 1);// in OnPlayerDeath when someone punches a player at night.
//Now, whenever the player will do a fist kill at night, achievement will go up++. And When he does 20 fist kills, it pops up! YAY!

So, how to give prize?
pawn Code:
//There is this callback:
public OnPlayerAchieve( playerid, achid )
{
    if(achid == Ach_SamFisher)
    {
        GivePlayerMoney(playerid, 50000); SetPlayerScore(playerid, GetPlayerScore(playerid)+50);
        SendClientMessageToAll(0xFF0000FF, "Someone just achieved Sam Fisher achievement!");
    }
}
//You gave the prizes! cool!

Easy, isn't it?

Other functions/callbacks:
pawn Code:
native CreateAchievement(title[], info[], unlockvalue); //Creates a new achievement.
native LoadPlayerAchievements(playerid); //Use this OnPlayerLogin or somewhere you like to load all achs.
native SetPlayerAchievement(playerid, achid, value); //Direct setting a value of an achievement.
native GivePlayerAchievement(playerid, achid, value); //adding/removing the value of an achievement.
native GetPlayerAchievement(playerid, achid); //Check how many times player did something for the ach.
native bool:DidPlayerAchieve(playerid, achid); //Did the player Achieve this Achievement?

Another Example:
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 520)
    {
        if(!DidPlayerAchieve(playerid, Ach_SamFisher))
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0xFF0000FF, "You need to achieve 'Sam Fisher' Achievement in order to use this!");
        }
    }
    return true;
}

NOTE: The default Max Achievements are '20' to increase it,
add this at the top:

pawn Code:
#undef MAX_ACHIEVEMENTS
#define MAX_ACHIEVEMENTS 100 //to have 100 achievements.

Credits/Requirements:
****** ::
YSI Includes - Download here
foreach - Download here

Deskoft ::
- His Ach System inspired me..

Me ::
- for the work.

Save Location/Folder Path:
/scriptfiles/achievements/user/
/scriptfiles/achievements/main/

Note: If you don't have this path the system won't work.

Download: (Last Update: 25-Aug-11)
1) Fixed a minor 'unlock' bug.
2) Fixed SetPlayerAchievement Bug.
3) Fixed Crash on Loop bug
4) Made some corrections.
Pastebin - Patched version
Pastebin - Old

btw, edit the include as you wish, I don't have time for it and I can't release a newer version soon.

Thanks for visiting!

Bugs:
2 Bugs Found and Solved. Thanks to the reporters/reasons.
- If you find one, report here please.

__________________
Goodbye SA-MP.

Last edited by iPLEOMAX; 26/04/2012 at 07:23 PM.
iPLEOMAX is offline   Reply With Quote
Old 18/08/2011, 11:48 PM   #2
GameStar.
Little Clucker
 
GameStar.'s Avatar
 
Join Date: Dec 2010
Location: Hungary
Posts: 19
Reputation: 5
Default Re: :: iAchieve :: Dynamic Achievement System - (Notify-on-achieve) (Stylish Textdraws) (uses Y_INI for saving/loading)

Nice work.
GameStar. is offline   Reply With Quote
Old 18/08/2011, 11:50 PM   #3
Zh3r0
High-roller
 
Join Date: Mar 2008
Posts: 4,510
Reputation: 398
Default Re: :: iAchieve :: Dynamic Achievement System - (Notify-on-achieve) (Stylish Textdraws) (uses Y_INI for saving/loading)

Nice piece of script. Looks nice, and easy to use!
__________________
Zh3r0 is offline   Reply With Quote
Old 18/08/2011, 11:52 PM   #4
oFLu
Little Clucker
 
oFLu's Avatar
 
Join Date: Jul 2011
Posts: 45
Reputation: 4
Default Re: :: iAchieve :: Dynamic Achievement System - (Notify-on-achieve) (Stylish Textdraws) (uses Y_INI for saving/loading)

Very Nice Thanks
__________________
oFLu is offline   Reply With Quote
Old 18/08/2011, 11:58 PM   #5
Forbidden
Huge Clucker
 
Join Date: May 2011
Posts: 269
Reputation: 5
Default AW: :: iAchieve :: Dynamic Achievement System - (Notify-on-achieve) (Stylish Textdraws) (uses Y_INI for saving/loading)

Seen this on Cops and robbers servers ,
Good job!
Forbidden is offline   Reply With Quote
Old 19/08/2011, 12:00 AM   #6
iPLEOMAX
High-roller
 
iPLEOMAX's Avatar
 
Join Date: Mar 2011
Location: AE
Posts: 1,250
Reputation: 746
Default Re: :: iAchieve :: Dynamic Achievement System - (Notify-on-achieve) (Stylish Textdraws) (uses Y_INI for saving/loading)

Quote:
Originally Posted by GameStar. View Post
Nice work.
Quote:
Originally Posted by Zh3r0 View Post
Nice piece of script. Looks nice, and easy to use!
Quote:
Originally Posted by oFLu View Post
Very Nice Thanks
Quote:
Originally Posted by Forbidden View Post
Seen this on Cops and robbers servers ,
Good job!
Thanks for the quick and positive comments! ^_^
__________________
Goodbye SA-MP.
iPLEOMAX is offline   Reply With Quote
Old 19/08/2011, 02:10 AM   #7
Naruto_Emilio
Banned
 
Join Date: Apr 2011
Location: North Africa
Posts: 1,297
Reputation: 365
Default Re : :: iAchieve :: Dynamic Achievement System - (Notify-on-achieve) (Stylish Textdraws) (uses Y_INI for saving/loading)

PIECE OF CAKE, good job
Naruto_Emilio is offline   Reply With Quote
Old 19/08/2011, 02:45 AM   #8
Deskoft
Guest
 
Posts: n/a
Default Re: :: iAchieve :: Dynamic Achievement System - (Notify-on-achieve) (Stylish Textdraws) (uses Y_INI for saving/loading)

Great job, iPLEO.
  Reply With Quote
Old 19/08/2011, 05:49 AM   #9
Kaperstone
Banned
 
Join Date: May 2011
Location: Russia
Posts: 3,004
Reputation: 824
Default Re: :: iAchieve :: Dynamic Achievement System - (Notify-on-achieve) (Stylish Textdraws) (uses Y_INI for saving/loading)

nice and thanks
will use..
Kaperstone is offline   Reply With Quote
Old 19/08/2011, 06:19 AM   #10
doreto
High-roller
 
doreto's Avatar
 
Join Date: Aug 2010
Posts: 1,667
Reputation: 118
Default Re: :: iAchieve :: Dynamic Achievement System - (Notify-on-achieve) (Stylish Textdraws) (uses Y_INI for saving/loading)

nice i will use thanks
doreto is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Cyanide's Gang Spray/Tag System (Plug n' Play | Saving, Loading, & Crouching Support) Cyanide Includes 81 25/07/2013 07:25 PM
Y_INI Loading Help randomkid88 Help Archive 3 06/06/2011 04:47 PM
Saving and loading with Y_ini StilThere Help Archive 0 03/06/2011 07:44 PM
[ini][How To] Creating an account system - Accounts saving and loading Zezombia Help Archive 42 30/11/2009 10:10 PM


All times are GMT. The time now is 11:17 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.