Raised This Month: $ Target: $400
 0% 

Xp shop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MAGNIFICUS.
Member
Join Date: Apr 2012
Old 08-06-2012 , 03:17   Xp shop
Reply With Quote #1

Hello, dear alliedmodders coders!

i making xp mod, by tutorial, but i cant found normal / working xp shop, compile with my plugin.

there`s a source:
Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>

new PlayerXP[33]
new XP_Kill,XP_Knife,XP_Hs,SaveXP,g_vault
public plugin_init()
{
    register_plugin("XpMod", "1.0", "Fxfighter")
 
    register_event("DeathMsg", "eDeath", "a") 
 
    SaveXP = register_cvar("SaveXP","1")
    XP_Kill=register_cvar("XP_per_kill", "20")
    XP_Hs=register_cvar("XP_hs_bonus","20")
    XP_Knife=register_cvar("XP_knife_bonus","20")
    g_vault = nvault_open("animod")
 
    register_clcmd("say /xp", "ShowHud")
    register_clcmd("say_team /xp", "ShowHud")
}
public eDeath(  ) 
{
    new attacker = read_data( 1 )
    new headshot = read_data( 3 )
    new clip, ammo, weapon = get_user_weapon(attacker,clip,ammo);
 
    PlayerXP[attacker] += get_pcvar_num(XP_Kill)
 
    if(headshot)
    PlayerXP[attacker] += get_pcvar_num(XP_Hs)
 
    if(weapon == CSW_KNIFE)
    PlayerXP[attacker] += get_pcvar_num(XP_Knife)
 

    ShowHud(attacker)
    SaveData(attacker)
}

public ShowHud(id)
{
    set_hudmessage(255, 0, 0, 0.75, 0.01, 0, 6.0, 15.0)
    show_hudmessage(id, "XP: %i^n",PlayerXP[id])
}


public client_connect(id)
{
    if(get_pcvar_num(SaveXP) == 1)
    {
 
        LoadData(id)
    }
}
public client_disconnect(id)
{
    if(get_pcvar_num(SaveXP) == 1)
    {
 
        SaveData(id)
    }
    PlayerXP[id] = 0
}
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])
    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])
    nvault_get(g_vault,vaultkey,vaultdata,255)
 
    replace_all(vaultdata, 255, "#", " ")
 
    new playerxp[32]
 
    parse(vaultdata, playerxp, 31)
 
    PlayerXP[id] = str_to_num(playerxp)
 
    return PLUGIN_CONTINUE
}
can you, guys, can add a working xp shop ?
MAGNIFICUS. 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 17:39.


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