This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[HELP] Achievements


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Heartbeat
Member
Join Date: Nov 2011
Location: Denmark
Old 12-29-2011 , 11:41   [HELP] Achievements
Reply With Quote #1

[MY PROBLEM] The problem i am having is that im not getting the achievements, when i fx. get my first kill.
[MY PROBLEM] This plugin can compile but is not working.

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <nvault>

new killstreak[32], deathstreak[33], killstreak_deagle[33], killstreak_knife[33]

new 
bool:first_kill[33], bool:marine[33], bool:rambo[33], bool:killer[33], bool:looser[33]

new 
g_Vault

public plugin_init()
{
    
register_plugin("Achievements""1.0""fLaXXiE")
    
    
g_Vault nvault_open("Achievements")
    
    
register_event("DeathMsg""DeathMsg""a""1=0""2=0")
    
    
RegisterHam(Ham_Spawn"player""HamSpawn"1)
    
    
register_clcmd("say /a""Achievements")
    
register_clcmd("say_team /a""Achievements")
}

public 
client_putinserver(id)
{
    
set_task(10.0"ShowMarketing"id 149)
}

public 
Achievements(id)
{
    new 
cb menu_makecallback("Achievements_CallBack")
    new 
menu menu_create("Achievements""Achievements_Handle")
    
menu_additem(menu"First Kill"__cb)
    
menu_additem(menu"Marine"__cb)
    
menu_additem(menu"Rambo"__cb)
    
menu_additem(menu"Killer"__cb)
    
menu_additem(menu"Looser"__cb)
    
menu_display(idmenu)
}

public 
Achievements_CallBack(idmenuitem)
{
    if(!
first_kill[id] && item == || !marine[id] && item == || !rambo[id] && item == || !killer[id] && item == || !looser[id] && item == 4)
    {
        return 
ITEM_DISABLED
    
}
    else
    {
        return 
ITEM_ENABLED
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
Achievements_Handle(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        return 
PLUGIN_HANDLED
    
}
    
    
menu_display(idmenu)
    
    switch(
item)
    {
        case 
0:
        {
            
client_print(idprint_chat"[Achievements] Earned for your first Kill")
        }
        
        case 
1:
        {
            
client_print(idprint_chat"[Achievements] Earned for your first Deagle Kill")
        }
        
        case 
2:
        {
            
client_print(idprint_chat"[Achievements] Earned for 3 Kills in a row with Knife")
        }
        
        case 
3:
        {
            
client_print(idprint_chat"[Achievements] Earned for 10 Kills in a row")
        }
        
        case 
4:
        {
            
client_print(idprint_chat"[Achievements] Earned for 10 Deaths in a row")
        }
    }
    
    return 
PLUGIN_CONTINUE
}

public 
DeathMsg()
{
    new 
victim read_data(2)
    new 
attacker read_data(1)
    
    if(!
is_user_alive(attacker))
    {
        
killstreak[attacker] = 0
    
}
    
    if(
victim != attacker)
    {
        switch(
get_user_weapon(attacker))
        {
            case 
CSW_DEAGLE:
            {
                
killstreak_deagle[attacker] ++
            }
            
            case 
CSW_KNIFE:
            {
                
killstreak_knife[attacker] ++
            }
        }
        
        
killstreak[attacker] ++
    }
    
    if(
attacker != victim)
    {
        
deathstreak[attacker] ++
    }
    
    switch(
deathstreak[attacker])
    {
        case 
10:
        {
            
looser[attacker] = true
            client_print
(attackerprint_chat"Congratulations, you have earned Achievement ^"Looser^"")
            
SaveData(attacker)
        }
    }
    
    switch(
killstreak[attacker])
    {
        case 
1:
        {
            
first_kill[attacker] = true
            client_print
(attackerprint_chat"Congratulations, you have earned Achievement ^"First Kill^"")
            
SaveData(attacker)
        }
        
        case 
10:
        {
            
killer[attacker] = true
            client_print
(attackerprint_chat"Congratulations, you have earned Achievement: ^"Killer^"")
            
SaveData(attacker)
        }
    }
    
    switch(
killstreak_deagle[attacker])
    {
        case 
7:
        {
            
marine[attacker] = true
            client_print
(attackerprint_chat"Congratulations, you have earned Achievementn ^"Marine^"")
            
SaveData(attacker)
        }
    }
    
    switch(
killstreak_knife[attacker])
    {
        case 
5:
        {
            
rambo[attacker] = true
            client_print
(attackerprint_chat"Congratulations, you have earned Achievementn ^"Rambo^"")
            
SaveData(attacker)
        }
    }
    
    return 
PLUGIN_CONTINUE
}

public 
HamSpawn(id)
{
    if(!
is_user_alive(id))
    {
        return 
PLUGIN_HANDLED
    
}
    
    if(
marine[id])
    {
        
strip_user_weapons(id)
        
give_item(id"weapon_knife")
        
give_item(id"weapon_deagle")
        
cs_set_user_bpammo(idCSW_DEAGLE35)
    }
    
    if(
rambo[id])
    {
        
give_item(id"weapon_m249")
    }
    
    return 
PLUGIN_CONTINUE
}

public 
SaveData(id)
{
    new 
AuthID[35]
    
get_user_authid(id,AuthID,34)
    
    new 
vaultkey[64],vaultdata[256]
    
format(vaultkey,63,"%s-Mod",AuthID)
    
format(vaultdata,255,"%i#%i#",marine[id])
    
nvault_set(g_Vault,vaultkey,vaultdata)
    return 
PLUGIN_CONTINUE
}

public 
LoadData(id)
{
    new 
AuthID[35]
    
get_user_authid(id,AuthID,34)
    
    new 
vaultkey[64],vaultdata[256]
    
format(vaultkey,63,"%s-Mod",AuthID)
    
format(vaultdata,255,"%i",marine[id])
    
nvault_get(g_Vault,vaultkey,vaultdata,255)
    
    
replace_all(vaultdata255"#"" ")
    
    new 
marine_a[32]
    
    
parse(vaultdatamarine_a31)
    
    
marine[id] = str_to_num(marine_a)
    
    return 
PLUGIN_CONTINUE
}  

public 
ShowMarketing(id)
{
    
id -= 149
    client_print
(idprint_chat"[Achievements] This server is running Achievements 1.0")
}

public 
client_disconnect(id)
{
    
remove_task(id 149)
}

public 
plugin_end()
{
    
nvault_close(g_Vault)

1. How can i fix this?
2. What is wrong with this problem?

- For help i will give Karma ++

Last edited by Heartbeat; 12-30-2011 at 06:09.
Heartbeat is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 12-29-2011 , 13:49   Re: [HELP] Achievements
Reply With Quote #2

You didn't even say what was wrong with it. We're not going to look through every single line of the code looking for something wrong if we don't know what the problem is to begin with.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Heartbeat
Member
Join Date: Nov 2011
Location: Denmark
Old 12-29-2011 , 13:58   Re: [HELP] Achievements
Reply With Quote #3

Help me please!

Last edited by Heartbeat; 12-29-2011 at 17:34.
Heartbeat is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 12-30-2011 , 05:26   Re: [HELP] Achievements
Reply With Quote #4

Quote:
Originally Posted by Heartbeat View Post
Help me please!
Nicely spoken.
Don't bump until' 15 days have passed and as said above, Give info!
Erox902 is offline
Heartbeat
Member
Join Date: Nov 2011
Location: Denmark
Old 12-30-2011 , 06:09   Re: [HELP] Achievements
Reply With Quote #5

Okay, i have given more info now.
Heartbeat 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:16.


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