Raised This Month: $32 Target: $400
 8% 

Achievements API


Post New Thread Reply   
 
Thread Tools Display Modes
B3N4K
Senior Member
Join Date: Jun 2008
Location: Czech Republic
Old 09-03-2011 , 04:32   Re: Achievements API
Reply With Quote #11

Awesome work! Finally some free Achievements API!
B3N4K is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 09-05-2011 , 11:40   Re: Achievements API
Reply With Quote #12

Quote:
Originally Posted by B3N4K View Post
Awesome work! Finally some free Achievements API!
Thank you!
Xellath is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 09-05-2011 , 15:26   Re: Achievements API
Reply With Quote #13

A while ago I was planning to make my own similar achievements API system but I will definitely use this one if it is well-coded (haven't looked at the code yet, hope it's good).

I'd also suggest to add SQL support and make simple web interface (not neccessarly anything fency).


Anyways, good job !

Last edited by t3hNox; 09-05-2011 at 15:30. Reason: suggestion added
t3hNox is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 09-05-2011 , 15:41   Re: Achievements API
Reply With Quote #14

Thank you, t3hNox.

SQL support is already done. Check main post about cvars and saving.

About a php part; I could put together one once I have some spare time on my hands. A lot going on with school and such, but will do along with the API tutorial.

Thanks for all the support so far!
Xellath is offline
dfwu.dark
Senior Member
Join Date: Mar 2011
Location: In dreams...
Old 09-07-2011 , 10:52   Re: Achievements API
Reply With Quote #15

i am using this in my server and it works quite good...thx a lot
__________________
[url]http://hw-movie.blogspot.com[/url]
Watch Latest Movies Online For Free !...
dfwu.dark is offline
Send a message via Skype™ to dfwu.dark
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 09-09-2011 , 10:18   Re: Achievements API
Reply With Quote #16

How to check if the achievement is done while ingame or check the list of achievements?
Does the player receive any notification about completed achievement?

Last edited by Racoon; 09-09-2011 at 11:24.
Racoon is offline
Send a message via ICQ to Racoon
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 09-09-2011 , 12:27   Re: Achievements API
Reply With Quote #17

Quote:
Originally Posted by Racoon View Post
How to check if the achievement is done while ingame or check the list of achievements?
If you take a look in one of the _addict, _1337 or example plugins you can see the basic idea behind it.

Explained in psuedo-code:
Code:
global variable holding objective info++

check if GetClientAchievementStatus( global var ) == _In_Progress
    // achievement not completed
    SetAchievementData( )
    // to save current progress

    check if GetClientAchievementStatus( global var ) == _Unlocked
        // achievement earned
        // send completed to api and announce
        ClientAchievementCompleted( .Announce = true )
    endif
else
    // achievement already completed
    // send completed to api, but don't announce
    ClientAchievementCompleted( .Announce = false );
endif
Thank you for your suggestion about a list of achievements. Will be implanted into the API shortly.

Quote:
Originally Posted by Racoon View Post
Does the player receive any notification about completed achievement?
Yes. Notifications are text-based (or the elegant CZTutor messages if running CZ), and will show text to everyone on the server. Also, when an achievement is completed and announced by the plugin, a forward is called:
Code:
/*  * Called when a player has recently earned an achievement  *  * @param      AchiPointer - Pointer to achievement  * @param      Client - Index of player  *  * @noreturn  *  */ forward Forward_ClientEarnedAchievement( const AchiPointer, const Client );

The forward is mainly to award additional things, specific things, that choose yourself. If you want a model to be awarded for completing the achievement, for example.

Native ClientAchievementCompleted( ) from the API:
PHP Code:
public _ClientAchievementCompletedPluginParams )
{
    new 
Client get_param);
    new 
AchievementPointer get_param);
    
    
AchievementsCompletedClient ]++;
    
    if( 
get_param) )
    {
        new 
AchievementDataAchievementsStruct ];
        
ArrayGetArrayAchievementAchievementPointerAchievementData );
        
        new 
DataAchievementDataStruct ];
        
ArrayGetArrayAchievementData_Data ], AchievementPointerData );
        
        
#if defined UseCZTutor
            
CreateTutorMessageClientrandom_num1), 
                
"Achievement Earned: %s",
                 
AchievementData_Name ]
                );
        
#endif
        
        
new ClientNameMaxClients ];
        
get_user_nameClientClientNamecharsmaxClientName ) );
        
        
#if defined UseChatColor
            
client_print_color0DontChange
                
"^4[ Achievements API ]^3 %s unlocked achievement: ^4%s ^3- Progress: %i/%i",
                
ClientName,
                
AchievementData_Name ],
                
AchievementsCompletedClient ],
                
ArraySizeAchievement )
                );
        
#else
            
client_print0print_chat
                
"[ Achievements API ] %s unlocked achievement: %s - Progress: %i/%i",
                
ClientName,
                
AchievementData_Name ],
                
AchievementsCompletedClient ],
                
ArraySizeAchievement )
                );
        
#endif
            
        
ExecuteForwardForwardClientAchievementForwardAchievementReturnAchievementPointerClient );
    }

Xellath is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 09-14-2011 , 14:33   Re: Achievements API
Reply With Quote #18

I've got a problem with GetClientAchievementStatus native. Error output:
Code:
L 09/14/2011 - 21:26:51: Invalid cellvector handle provided (10:1:1)
L 09/14/2011 - 21:26:51: [AMXX] Displaying debug trace (plugin "achievement_api2
.amxx")
L 09/14/2011 - 21:26:51: [AMXX] Run time error 10: native error (native "ArrayGe
tArray")
L 09/14/2011 - 21:26:51: [AMXX]    [0] achievement_api2.sma::_GetClientAchieveme
ntStatus (line 230)
L 09/14/2011 - 21:26:51: Unhandled dynamic native error
L 09/14/2011 - 21:26:51: [AMXX] Displaying debug trace (plugin "zzTest.amxx")
L 09/14/2011 - 21:26:51: [AMXX] Run time error 10: native error (native "GetClie
ntAchievementStatus")
L 09/14/2011 - 21:26:51: [AMXX]    [0] zzTest.sma::fnCurrentStats (li
ne 107)
Line 107 from zzTest.sma:
Code:
		for(new i = 0 ; i < Achievements; i++)
		{
			g_iCurrentProgress[id][i] = GetAchievementData( g_szName[id], AchievementInfo[ i ][ Save_Name ] );
			
			if( GetClientAchievementStatus( AchievementPointer[ i ], g_iCurrentProgress[ id ][ i ] ) == _Unlocked ) // This is line 107.
			{
				ClientAchievementCompleted( id, AchievementPointer[ i ], .Announce = false ); 		
			}
		}
AMXX version 1.8.1.3746.
t3hNox is offline
Lokogaditano
Senior Member
Join Date: Apr 2009
Old 09-14-2011 , 16:50   Re: Achievements API
Reply With Quote #19

Any tutorial for noobs? I read everithing and I dont understand....how to make achievementes for my jailbreak
Lokogaditano is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 09-14-2011 , 17:39   Re: Achievements API
Reply With Quote #20

Quote:
Originally Posted by t3hNox View Post
I've got a problem with GetClientAchievementStatus native. Error output:
Code:
L 09/14/2011 - 21:26:51: Invalid cellvector handle provided (10:1:1)
L 09/14/2011 - 21:26:51: [AMXX] Displaying debug trace (plugin "achievement_api2
.amxx")
L 09/14/2011 - 21:26:51: [AMXX] Run time error 10: native error (native "ArrayGe
tArray")
L 09/14/2011 - 21:26:51: [AMXX]    [0] achievement_api2.sma::_GetClientAchieveme
ntStatus (line 230)
L 09/14/2011 - 21:26:51: Unhandled dynamic native error
L 09/14/2011 - 21:26:51: [AMXX] Displaying debug trace (plugin "zzTest.amxx")
L 09/14/2011 - 21:26:51: [AMXX] Run time error 10: native error (native "GetClie
ntAchievementStatus")
L 09/14/2011 - 21:26:51: [AMXX]    [0] zzTest.sma::fnCurrentStats (li
ne 107)
Line 107 from zzTest.sma:
Code:
		for(new i = 0 ; i < Achievements; i++)
		{
			g_iCurrentProgress[id][i] = GetAchievementData( g_szName[id], AchievementInfo[ i ][ Save_Name ] );
			
			if( GetClientAchievementStatus( AchievementPointer[ i ], g_iCurrentProgress[ id ][ i ] ) == _Unlocked ) // This is line 107.
			{
				ClientAchievementCompleted( id, AchievementPointer[ i ], .Announce = false ); 		
			}
		}
AMXX version 1.8.1.3746.
Thank you for the report!

Updated to v0.0.3. Check changelog for documentation.

v0.0.3 also received two additional natives:
  • Code:
    /*  * Returns the name of the achievement  *  * @param      AchievementPointer - Pointer from the registration of the achievement  * @param      Description - Name passed by reference  *  * @return    Returns the name by reference (2nd param)  */ native GetAchievementName( AchievementPointer, Name[ ] );
  • Code:
    /*  * Returns the description of the achievement  *  * @param      AchievementPointer - Pointer from the registration of the achievement  * @param      Description - Description passed by reference  *  * @return    Returns the description by reference (2nd param)  */ native GetAchievementDesc( AchievementPointer, Description[ ] );

A new plugin was also introduced; a MOTD plugin that allows you to see your current achievements earned (by saying /achievements).

Quote:
Originally Posted by Lokogaditano View Post
Any tutorial for noobs? I read everithing and I dont understand....how to make achievementes for my jailbreak
I'll make one shortly, you'll have to wait a while. Sorry.
Xellath is offline
Reply



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 23:00.


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