Raised This Month: $ Target: $400
 0% 

Help with XP plz


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zapdos1
BANNED
Join Date: Jul 2009
Location: Chile - La Serena
Old 12-23-2009 , 18:35   Help with XP plz
Reply With Quote #1

well, i was testing this plugin, and the thing is what, when i kill somebody, it doesn't give me XP

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>  

new PlayerXP[33],PlayerLevel[33
new 
XP_KillSaveXP
new g_vault  

new const LEVELS[7] = { 010020040080016003200 }  

public 
plugin_init() 
{
    
register_plugin("Boxing_levels""1.0""Zapdos1")
    
    
//Cvars 
    
SaveXP register_cvar("amx_svxp","1")
    
XP_Kill=register_cvar("amx_xpkill""20")
    
    
//nvault
    
g_vault nvault_open("boxingmodd")
    
    
//clcmd
    
register_clcmd("say /myboxxp""ShowHud")
    
    
//dictionary
    
register_dictionary("boxing.txt")
}

public 
eDeath(  ) 
{
    new 
attacker read_data(1)
    
    
PlayerXP[attacker] += get_pcvar_num(XP_Kill
    
    while(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) 
    { 
        
client_print(attackerprint_chat"[AMXX] %L"LANG_PLAYER"LEVEL_MESSAGE"PlayerLevel[attacker]) 
        
PlayerLevel[attacker] += 
    

    
    
ShowHud(attacker)
}

public 
ShowHud(id

   
set_hudmessage(255000.10.806.012.0
   
show_hudmessage(id"Level: %i^nXP: %i",PlayerLevel[id],PlayerXP[id])  
}  

public 
client_connect(id
{
    if(
get_pcvar_num(SaveXP) == 1
    { 
        
LoadData(id
    } 
}  

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#",PlayerXP[id],PlayerLevel[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#%i#",PlayerXP[id],PlayerLevel[id]) 
    
nvault_get(g_vault,vaultkey,vaultdata,255
    
replace_all(vaultdata255"#"" "
    new 
playerxp[32], playerlevel[32
    
parse(vaultdataplayerxp31playerlevel31
    
PlayerXP[id] = str_to_num(playerxp
    
PlayerLevel[id] = str_to_num(playerlevel
    return 
PLUGIN_CONTINUE 

Zapdos1 is offline
Zombiezzz
Veteran Member
Join Date: Nov 2009
Location: Nov 2009
Old 12-23-2009 , 23:51   Re: Help with XP plz
Reply With Quote #2

i had the same problem when i wasm aking my Mexcian Mod. I searched in scriptign help and found one that worked.
try this http://forums.alliedmods.net/showpos...70&postcount=2
__________________
Zombiezzz is offline
AfteR.
Veteran Member
Join Date: Dec 2008
Location: λ
Old 12-24-2009 , 01:37   Re: Help with XP plz
Reply With Quote #3

Quote:
public eDeath( )
When do you register that? o.O
AfteR. is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 12-24-2009 , 09:05   Re: Help with XP plz
Reply With Quote #4

Quote:
Originally Posted by AfteR. View Post
When do you register that? o.O
Yep, you dont register your death event.

Code:
// in plugin init
register_event("DeathMsg", "DeathMsg", "a");
// rename eDeath the DeathMsg or the way around doesnt matter
__________________
I am out of order!
grimvh2 is offline
Zapdos1
BANNED
Join Date: Jul 2009
Location: Chile - La Serena
Old 12-24-2009 , 10:02   Re: Help with XP plz
Reply With Quote #5

thanks , it works

Last edited by Zapdos1; 12-24-2009 at 15:51.
Zapdos1 is offline
Reply


Thread Tools
Display Modes

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 04:09.


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