Raised This Month: $ Target: $400
 0% 

Need Help


Post New Thread Reply   
 
Thread Tools Display Modes
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
GraffityMaster
Member
Join Date: Jan 2007
Old 01-27-2007 , 17:06   Re: Need Help
Reply With Quote #2

Bumb
__________________
GraffityMaster is offline
blackops7799
Senior Member
Join Date: May 2006
Old 01-27-2007 , 17:20   Re: Need Help
Reply With Quote #3

Code:
show_hudmessage(0, "%d is now level %n !!! ",nume , g_PlayerLevel[attacker])

change %d to %s, and %n to %i

Code:
show_hudmessage(0, "%s is now level %i !!! ",nume , g_PlayerLevel[attacker])
blackops7799 is offline
GraffityMaster
Member
Join Date: Jan 2007
Old 01-27-2007 , 18:00   Re: Need Help
Reply With Quote #4

+karma it worked now...this dosent work
Thanks a lot

Code:
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
}
__________________
GraffityMaster is offline
blackops7799
Senior Member
Join Date: May 2006
Old 01-28-2007 , 14:59   Re: Need Help
Reply With Quote #5

It looks like it should work. What does it say in-game?
blackops7799 is offline
GraffityMaster
Member
Join Date: Jan 2007
Old 01-28-2007 , 15:02   Re: Need Help
Reply With Quote #6

it dosent show up in game
never mind fixed it..

changed
Code:
return
to
Code:
return PLUGIN_CONTINUE;
Thanks a lot dude
__________________
GraffityMaster 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 22:29.


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