AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need Help (https://forums.alliedmods.net/showthread.php?t=50484)

GraffityMaster 01-27-2007 13:29

Need Help
 
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
}


GraffityMaster 01-27-2007 17:06

Re: Need Help
 
Bumb

blackops7799 01-27-2007 17:20

Re: Need Help
 
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])

GraffityMaster 01-27-2007 18:00

Re: Need Help
 
+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
}


blackops7799 01-28-2007 14:59

Re: Need Help
 
It looks like it should work. What does it say in-game?

GraffityMaster 01-28-2007 15:02

Re: Need Help
 
it dosent show up in game :)
never mind fixed it..

changed
Code:

return
to
Code:

return PLUGIN_CONTINUE;
Thanks a lot dude


All times are GMT -4. The time now is 22:29.

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