Raised This Month: $ Target: $400
 0% 

How to compile this ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
David92
Junior Member
Join Date: Aug 2012
Old 09-29-2014 , 18:44   How to compile this ?
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <adv_vault>

//#define ZP_42

new CAMPO_KILLSCAMPO_POINTS

enum 
{
    
KILL_ZOMBIE,
    
KILL_NEMESIS,
    
#if !defined ZP_42
    
KILL_ASSASSIN,
    
KILL_SNIPER,
    
#endif
    
KILL_INFECT,
    
KILL_HUMAN,
    
KILL_SURVIVOR,
    
MAX_KILLS
}

new const 
points_per_kill[MAX_KILLS] = {
    
1,    // Zombie
    
4,    // Nemesis
    #if !defined ZP_42
    
4,    // Assassin
    
6,    // Sniper
    #endif
    
1,    // Infect
    
2,    // Human
    
5,    // Survivor
}


new 
g_kills[33][MAX_KILLS]
new 
g_points[33]
new 
g_name[33][32]

// HLSDK: #define MAX_MOTD_LENGTH 1536
new motd[1536]
new 
g_vaultg_sortg_maxplayersg_msgSayTextcvar_reset

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /rank""clcmd_rank")
    
register_clcmd("say /top15""clcmd_oldtop")
    
register_clcmd("say /top10""clcmd_top")
    
    
cvar_reset register_cvar("zp_stats_reset""0")
    
    
register_event("DeathMsg""event_death""a")
    
register_event("HLTV" "round_start" "a""1=0""2=0")
    
    
g_msgSayText get_user_msgid("SayText")
    
g_maxplayers get_maxplayers()
    
    
g_vault adv_vault_open("zp_stats"false)
    
    
CAMPO_POINTS adv_vault_register_field(g_vault"points")
    
CAMPO_KILLS adv_vault_register_field(g_vault"kills"DATATYPE_ARRAYMAX_KILLS)
    
    
adv_vault_init(g_vault)
    
    
g_sort adv_vault_sort_create(g_vaultORDER_DESC02000CAMPO_POINTS)
}

public 
client_infochanged(id)
{
    if(!
is_user_connected(id)) return

    static 
newname[32]
    
get_user_info(id"name"newname31)

    if(!
equal(newnameg_name[id]))
    {
        
copy(g_name[id], 31newname)
        
load_data(id)
    }
}

public 
client_putinserver(id)
{
    
get_user_name(idg_name[id], 31)
    
load_data(id)
}

public 
client_disconnect(id)
{
    
save_data(id)
}

public 
fw_adv_vault_closed(vault)
{
    if(
vault == g_vault)
    {
        if(
get_pcvar_num(cvar_reset))
        {
            
adv_vault_clear(g_vaultCLEAR_ALL)
            
set_pcvar_num(cvar_reset0)
        }
        else 
round_start(true)
    }
}

public 
round_start(skip)
{
    for(new 
id=1id <= g_maxplayersid++)
    {
        if(
is_user_connected(id)) save_data(id)
    }
    
    if(!
skip)
    {
        
adv_vault_sort_update(g_vaultg_sort)
        
update_motd()
    }
}

public 
event_death()
{
    static 
attackervictim
    attacker 
read_data(1)
    
victim read_data(2)
    
    if(
attacker == victim || !is_user_connected(attacker) || !is_user_connected(victim))
        return
    
    static class
    class = 
get_class(victim)
    
    
g_kills[attacker][class]++
    
g_points[attacker] += points_per_kill[class]
}

public 
zp_user_infected_post(victiminfector)
{
    if(
infectorg_kills[infector][KILL_INFECT] += points_per_kill[KILL_INFECT]
}

get_class(victim)
{
    if(
zp_get_user_zombie(victim))
    {
        if(
zp_get_user_nemesis(victim)) return KILL_NEMESIS
        
        
#if !defined ZP_42
        
else if(zp_get_user_assassin(victim)) return KILL_ASSASSIN
        
#endif
    
        
return KILL_ZOMBIE
    
}
    else if(
zp_get_user_survivor(victim)) return KILL_SURVIVOR
    
#if !defined ZP_42
    
else if(zp_get_user_sniper(victim)) return KILL_SNIPER
    
#endif
    
    
return KILL_HUMAN
}

save_data(id)
{
    
adv_vault_set_start(g_vault)
   
    
adv_vault_set_field(g_vaultCAMPO_POINTSg_points[id])
    
adv_vault_set_field(g_vaultCAMPO_KILLSg_kills[id])
   
    
adv_vault_set_end(g_vault0g_name[id])
}

load_data(id)
{
    if(!
adv_vault_get_prepare(g_vault_g_name[id]))
    {
        
arrayset(g_kills[id], 0MAX_KILLS)
        
g_points[id] = 0
        
return
    }

    
g_points[id] = adv_vault_get_field(g_vaultCAMPO_POINTS)
    
adv_vault_get_field(g_vaultCAMPO_KILLS,  g_kills[id], MAX_KILLS)
}

public 
clcmd_rank(id)
{
    new 
rank_position adv_vault_sort_key(g_vaultg_sort0g_name[id])
    
    if(!
rank_positionchat_color(id"!g-!tYou're not ranked")
    else 
chat_color(id"!g-!tYou ranking is !y%d !tof !y%d !twith !y%d !tpoints"rank_positionadv_vault_sort_numresult(g_vaultg_sort), g_points[id])
}

public 
clcmd_oldtop(id)
{
    
client_cmd(id"say /top10")
    return 
PLUGIN_HANDLED
}

public 
clcmd_top(id)
{
    
show_motd(idmotd"ZP TOP-10")


update_motd()
{
    new 
kills[MAX_KILLS], pointskeyindexnick[96], len

    motd
[0] = 0
    
    add
(motdcharsmax(motd),
    
"<html><style>\
    body{background:#040404;font-family:Verdana, Arial, Sans-Serif;font-size:7pt;}\
    .t{color:#808080;text-align:left; }\
    #h{background: #222; font-weight:bold;}\
    #p{color:#D41313;}\
    #n{color:#fff;}\
    </style><body>\
    <table cellspacing=0 width=100% class=t>"
)

    
add(motdcharsmax(motd),
    
"<tr><td id=h width=7%>#</td>\
    <td id=h>Nick</td>\
    <td id=h>Points</td>\
    <td id=h>Zombie</td>\
    <td id=h>Humans</td>\
    <td id=h>Infect</td></tr>"
)
    
    
len strlen(motd)

    new 
toploop min(adv_vault_sort_numresult(g_vaultg_sort), 10)

    for(new 
position=1position <= toploopposition++)
    {
        
keyindex adv_vault_sort_position(g_vaultg_sortposition)

        if(!
adv_vault_get_prepare(g_vaultkeyindex)) continue
        
        
points adv_vault_get_field(g_vaultCAMPO_POINTS)
        
adv_vault_get_field(g_vaultCAMPO_KILLSkillsMAX_KILLS)
        
        
adv_vault_get_keyname(g_vaultkeyindexnickcharsmax(nick))

        
replace_all(nickcharsmax(nick), "<""&lt")
        
replace_all(nickcharsmax(nick), ">""&gt")
  
        
len += formatex(motd[len], charsmax(motd)-len,
        
"<tr><td id=p>#%d</td>\
        <td id=n>%s</td>\
        <td>%d</td>\
        <td>%d</td>\
        <td>%d</td>\
        <td>%d</td>"
positionnickpointskills[KILL_ZOMBIE], kills[KILL_HUMAN], kills[KILL_INFECT])
    }

    
add(motdcharsmax(motd), "</table></body></html>")
}

stock chat_color(const id, const input[], any:...)
{
    new 
count 1players[32], i
    
static msg[191]

    if(
numargs() == 2)
        
copy(msg190input)
    else
        
vformat(msg190input3)

    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
    if(
id) {
        if(!
is_user_connected(id)) return
        
players[0] = id
    
}
    else 
get_players(playerscount"ch")

    for(
0counti++)
    {
        
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_players[i])
        
write_byte(players[i])
        
write_string(msg)
        
message_end()
    }

error line adv_vault_open

Last edited by David92; 09-29-2014 at 18:45.
David92 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-29-2014 , 21:40   Re: How to compile this ?
Reply With Quote #2

You have to compile it locally after you have downloaded the required include into the includes folder. See how to compile locally here.
__________________

Last edited by fysiks; 09-29-2014 at 21:41.
fysiks is offline
Destro-
Veteran Member
Join Date: Jun 2010
Location: $me->location();
Old 09-29-2014 , 22:15   Re: How to compile this ?
Reply With Quote #3

This plugin require the api [API] Advanced Vault System
As fysiks said, you must compile local.
__________________

Last edited by Destro-; 09-29-2014 at 22:15.
Destro- 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:38.


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