AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Achievements Stop Counting (https://forums.alliedmods.net/showthread.php?t=193413)

MokeN 08-19-2012 04:11

Achievements Stop Counting
 
Heey

I made an achievement plugin an month ago, but i got a problem with it.
It doesn't stop counting when you've made the achievement..

Example:

Assasin II | 1432/1100

The 1100 is the requirement.

How do i fix this?

PHP Code:


public Event_DeathMsg()
{
    new 
iKiller read_data(1)
    new 
iVictim read_data(2)
    
    new 
weapon_name[24]
    
    
get_user_name(iKillerszName32)
    
    if(
is_user_alive(iKiller) && get_user_team(iKiller) != get_user_team(iVictim))
    {
        
Achievement[iKiller][MURDER]++
    
        if(
Achievement[iKiller][MURDER] == AchRequirement[MURDER])
        {
            
TotalAchievements[iKiller]++
            
emit_sound(iKillerCHAN_STATICgSoundAch1.0ATTN_NORM0PITCH_NORM);
            
ColorChat(0GREY"%s^4 %s^3 successfully unlocked the achievement^4 %s^3 and earned ^4%i $."prefixszNameAchName[MURDER], AchPoints[MURDER])
            
jbcash_add_user_cash(iKillerjbcash_get_user_cash(iKiller) + AchPoints[MURDER])    
                
            
SaveData(iKiller)
            }
        }
    }
    return 
PLUGIN_CONTINUE


Thanks in advance

Napoleon_be 08-19-2012 05:16

Re: Achievements Stop Counting
 
PHP Code:

public Event_DeathMsg()
{
    new 
iKiller read_data(1)
    new 
iVictim read_data(2)
    
    new 
weapon_name[24]
    
    
get_user_name(iKillerszName32)
    
    if(
is_user_alive(iKiller) && get_user_team(iKiller) != get_user_team(iVictim))
    {
        if(
Achievement[iKiller][MURDER] == AchRequirement[MURDER])
        {
            
TotalAchievements[iKiller]++
            
emit_sound(iKillerCHAN_STATICgSoundAch1.0ATTN_NORM0PITCH_NORM);
            
ColorChat(0GREY"%s^4 %s^3 successfully unlocked the achievement^4 %s^3 and earned ^4%i $."prefixszNameAchName[MURDER], AchPoints[MURDER])
            
jbcash_add_user_cash(iKillerjbcash_get_user_cash(iKiller) + AchPoints[MURDER])    
            
            
SaveData(iKiller)
        } else {
            
Achievement[iKiller][MURDER]++
        }
    }
    return 
PLUGIN_CONTINUE



ConnorMcLeod 08-19-2012 06:39

Re: Achievements Stop Counting
 
With napoleon code, once MURDER achievement is reached, on each kill code would consider that achievement has just been reached.
You should use similar code but make something to check whether player has already reached required kills or not.

MokeN 08-19-2012 14:32

Re: Achievements Stop Counting
 
Thanks, both of you! :)


All times are GMT -4. The time now is 05:50.

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