Good day.
There is a plugin:
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <nvault>
#define PLUGIN "credits"
#define AUTHOR "Vadik"
#define VERSION "0.1"
new credits[33] //value
new s_AuthID[35] //steam_id player
new i_credits //Pointer to store the file
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Killed, "player", "player_killed", 1)
i_credits = nvault_open("credits") //Open the file and save it in the index
if (i_credits == INVALID_HANDLE)
set_fail_state("Error opening nVault file!")
}
public client_authorized(id)
{
// Obtain and store in an array of Steam ID Player
get_user_authid(id, s_AuthID[id], charsmax(s_AuthID[]))
}
public client_putinserver(id)
{
//Initially clears the statistics by id
credits[id] = 0
//Receive value for the player steam_id
new i_cred = nvault_get(i_credits, s_AuthID[id])
//If you find a record that puts the player received the amount of value
if (i_cred)
{
credits[id] = i_cred
}
else
{
nvault_set(i_credits, s_AuthID, credits[id]) //reserve credits for steam id
}
}
public player_killed(victim, attacker, shouldgib)
{
if(!is_user_connected(attacker) || !is_user_connected(victim))
return HAM_IGNORED
switch(cs_get_user_team(victim))
{
case(CS_TEAM_CT):
{
if(cs_get_user_team(attacker) == CS_TEAM_T)
{
credits[attacker]++
get_user_authid(attacker, s_AuthID, charsmax(s_AuthID))
nvault_set(i_credits, s_AuthID, credits[attacker])
client_print(attacker, print_chat, "You got 1 credit for killing the enemy")
}
}
case(CS_TEAM_T): // Жертва - Т
{
if(cs_get_user_team(attacker) == CS_TEAM_CT)
{
credits[attacker]+=3
get_user_authid(attacker, s_AuthID, charsmax(s_AuthID))
nvault_set(i_credits, s_AuthID, credits[attacker])
client_print(attacker, print_chat, "You got 3 credit for killing the enemy")
}
}
}
return HAM_IGNORED
}
public Round_Start()
{
set_task( 1.0, "Hud_Soobshenie", _ ,_ ,_ ,"b" );
}
public Hud_Soobshenie(id)
{
set_hudmessage(255, 0, 0, 1.0, 1.0, 0, 0, 2.0)
show_hudmessage(id, credits[id])
}
public plugin_end(){
nvault_close(i_credits)
}
Plugin compiled, but the server does not start, what's the problem?
P.S. Plugins writing about 2 weeks
P.S.S. Sorry for my English, Google translate
TY