Raised This Month: $ Target: $400
 0% 

Need Help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GraffityMaster
Member
Join Date: Jan 2007
Old 01-27-2007 , 13:29   Need Help
Reply With Quote #1

The plugin runs...but the exp. dosent work
and it shows things like :
"256 is now level n !!!"

Code:
 
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
new g_PlayerXP[33];
new g_PlayerLevel[33];
#define Max_Level 11
new LEVELS[Max_Level] =
{ 
 50,  //0
 100,  //1
 200, //2
 400, //3
 800, //4
 1600, //5
 3200, //6
 6400, //7
 12800, //8
 25600, //9
 51200, //10
}
new msgtext
public plugin_init() {
 register_plugin("Counter-Strike XP", "1.0", "Claw")
 register_event("DeathMsg", "DeathMsg", "a")
 register_event("ResetHUD", "ResetHud", "b")
 msgtext = get_user_msgid("StatusText") 
 register_concmd("say /myxp", "ShowHUD")
 
}
 
public DeathMsg()
{
 
    //get data from event
    new attacker = read_data(1)
    new victim = read_data(2)
 
    new nume[32]
    get_user_name(attacker, nume, 31)
 
    //if player kills himself do not add xp
    if(victim == attacker)
 return PLUGIN_HANDLED;
 
    //if player is lvl 10 do not add more xp
 
    if(g_PlayerLevel[attacker] == Max_Level)
          return PLUGIN_HANDLED;
 
    //add xp (+10)
    g_PlayerXP[attacker] += 10
    //creates a exp. msg near crosshare
    set_hudmessage(0, 50, 100, 0.50, 0.54, 0, 6.0, 2.0)
    show_hudmessage(attacker, "+10xp")
    //console msg 
    client_print(attacker, print_console, "*** +10 xp ***")
    if(g_PlayerXP[attacker] >= LEVELS[g_PlayerLevel[attacker]]) //check if player xp is big enough for level up
    {
     //level up player
        ++g_PlayerLevel[attacker];
        //level up player info
 set_hudmessage(0, 50, 100, 0.50, 0.41, 0, 6.0, 2.0)
 show_hudmessage(0, "%d is now level %n !!! ",nume , g_PlayerLevel[attacker])
 
 //plays a lvl up sound
        client_cmd(attacker, "spk ^"events/task_complete.wav^" " )
        ShowHUD(attacker)
 
    }
    return PLUGIN_CONTINUE;
}
public ShowHUD(id)    
{ 
    new HUD[51]
    new nume[32]
    get_user_name(id, nume, 31)
    format(HUD, 50, "[%s]Level: %i XP: %i", nume, g_PlayerLevel[id], g_PlayerXP[id]) 
    message_begin(MSG_ONE, msgtext, {0,0,0}, id) 
    write_byte(0) 
    write_string(HUD) 
    message_end() 
    return
}

Last edited by GraffityMaster; 01-27-2007 at 17:08.
GraffityMaster is offline
 



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 22:29.


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