Raised This Month: $ Target: $400
 0% 

Does not start the server


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
vadim7695
New Member
Join Date: Aug 2014
Old 08-09-2014 , 05:13   Re: Does not start the server
Reply With Quote #6

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <nvault>
 
#define PLUGIN "credits"
#define AUTHOR "Vadik"
#define VERSION "0.1"
#define TASK_LOOP_CREDITS    200 // <-- task it
 
new credits[33] //кредиты (ammo packs)
new s_AuthID[33][35] //steam_id игрока
new i_credits //Указатель для хранения файла
 
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    RegisterHam(Ham_Killed, "player", "player_killed", 1)
      
	i_credits = nvault_open("credits") //Открываем файл и сохраняем его в указателе

if (i_credits == INVALID_HANDLE)
set_fail_state("Error opening nVault file!") 
	
	register_logevent("show_credits", 2, "1=Round_Start")
}
 
public client_authorized(id)
{
    // Получаем и сохраняем в массиве Steam ID игрока
    get_user_authid(id, s_AuthID[id], charsmax(s_AuthID[]))
} 
 
public client_putinserver(id)
{
	//Изначально обнуляем статистику по id
	credits[id] = 0
	
	//Получаем кредиты игрок по steam_id
	new i_cred = nvault_get(i_credits, s_AuthID[id])
	
	//Если находим запись, то выставляем игроку полученное кличество кредитов
	if (i_cred)
	{
		credits[id] = i_cred
	}
	else
	{	
		new String[]
		num_to_str(credits[id],String,6)
		nvault_set(i_credits, s_AuthID, String) //сохраняем кредиты по стим_иду
	}
    
}

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)) //Получаем стим_ид игрока
					
					  new String[]
					  num_to_str(credits[attacker],String,6)
					  nvault_set(i_credits, s_AuthID, String) //сохраняем кредиты по стим_иду
					  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)) //Получаем стим_ид игрока
					
					  new String[]
					  num_to_str(credits[attacker],String,6)
					  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 show_credits(id)
{
	set_task("0.5", "loop_credits", TASK_LOOP_CREDITS + id, _, _, "b", _);
}

public loop_credits(id)
{
	 new pId = id - TASK_LOOP_CREDITS;
	set_hudmessage(255, 0, 0, 1.0, 1.0, 0, 0, 99999.0)
    show_hudmessage(id, credits[pId])
}


public plugin_end(){
     nvault_close(i_credits) //Закрываем сохранение
}
Here's what happened, I do everything correctly?
Please indicate errors.
TY
vadim7695 is offline
 



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 12:59.


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