AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with XP plz (https://forums.alliedmods.net/showthread.php?t=113138)

Zapdos1 12-23-2009 18:35

Help with XP plz
 
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 



Zombiezzz 12-23-2009 23:51

Re: Help with XP plz
 
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

AfteR. 12-24-2009 01:37

Re: Help with XP plz
 
Quote:

public eDeath( )
When do you register that? o.O

grimvh2 12-24-2009 09:05

Re: Help with XP plz
 
Quote:

Originally Posted by AfteR. (Post 1029350)
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


Zapdos1 12-24-2009 10:02

Re: Help with XP plz
 
thanks :D, it works


All times are GMT -4. The time now is 04:09.

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