[CS GO] Проблема с выдачей денег

ex3m777

Участник
Сообщения
7
Реакции
0
Всем привет..

Подскажите, как сделать, чтобы функция Event_OnPlayerSpawn работала со 2-го раунда?

PHP:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

public Plugin:myinfo =
{
	name = "VIP",
	author = "SzYma",
	description = "",
	version = "1.0.2",
	url = "http://3Mod.pl/"
};

public OnPluginStart()
{
	HookEvent("player_spawn", Event_OnPlayerSpawn);
}

public Event_OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	new team = GetClientTeam(client);
	new money = GetEntProp(client, Prop_Send, "m_iAccount");
	
	if (client > 0 && IsPlayerAlive(client))
	{
		if (IsPlayerGenericAdmin(client))
		{
			SetEntityHealth(client, 105);  //hp
			SetEntProp(client, Prop_Send, "m_ArmorValue", 100, 4); //armor
			SetEntProp(client, Prop_Send, "m_bHasHelmet", 1); //helm
			SetEntProp(client, Prop_Send, "m_iAccount", money + 500); //200$ plus
			
			GivePlayerItem(client, "weapon_smokegrenade"); //smoke
			GivePlayerItem(client, "weapon_flashbang"); //flash
			GivePlayerItem(client, "weapon_hegrenade"); //grenade
			GivePlayerItem(client, "weapon_flashbang"); //flash
			
			if(team == CS_TEAM_CT)
			{
			GivePlayerItem(client, "item_defuser"); //kombinerki		
			}
		}
	}
}

/*
@param client id

return bool
*/
bool:IsPlayerGenericAdmin(client)
{
	return CheckCommandAccess(client, "generic_admin", ADMFLAG_GENERIC, false);
}
 
Последнее редактирование:

ex3m777

Участник
Сообщения
7
Реакции
0
Re: Ограничения по раундам

с первым разобрался, но теперь другая беда.. не выдаются деньги, в чем проблема??

PHP:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

public OnPluginStart()
{
    HookEvent("round_start", Event_RoundStart);
    HookEvent("cs_match_end_restart", Event_RestartRound);
    HookEvent("player_spawn", Event_OnPlayerSpawn);
}

new round_counter = 0;

public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    round_counter++;
}

public Event_RestartRound(Handle:event, const String:name[], bool:dontBroadcast)
{
    round_counter = 0;
}

public Event_OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	new team = GetClientTeam(client);
	
	if (client > 0 && IsPlayerAlive(client) && (round_counter > 1))
	{
		if (IsPlayerGenericAdmin(client))
		{
			SetEntityHealth(client, 105);  //hp
			SetEntProp(client, Prop_Send, "m_ArmorValue", 100, 4); //armor
			SetEntProp(client, Prop_Send, "m_bHasHelmet", 1); //helm
			
			new Cash = GetEntProp(client, Prop_Send, "m_iAccount"); 
			if(Cash < 16000) SetEntProp(client, Prop_Send, "m_iAccount", Cash + 1500); 
			else if(Cash >= 16000) SetEntProp(client, Prop_Send, "m_iAccount", 16000); 
			
			GivePlayerItem(client, "weapon_flashbang"); //flash
			GivePlayerItem(client, "weapon_hegrenade"); //grenade
			
			if(team == CS_TEAM_CT)
			{
				GivePlayerItem(client, "item_defuser"); //kombinerki
			}		
		}
	}
}

/*
@param client id

return bool
*/
bool:IsPlayerGenericAdmin(client)
{
	return CheckCommandAccess(client, "generic_admin", ADMFLAG_GENERIC, false);
}
 

R1KO

fuck society
Сообщения
9,457
Реакции
7,786
  • Команда форума
  • #3
Re: Ограничения по раундам

Ксго ?
 

R1KO

fuck society
Сообщения
9,457
Реакции
7,786
  • Команда форума
  • #5
Re: Ограничения по раундам

У меня тоже после последней обновы что-то ни один плагин не выдает деньги.
 

ex3m777

Участник
Сообщения
7
Реакции
0
Re: Ограничения по раундам

заметил такую особенность, что если присоединится к серверу и при этом успел попасть в игру, то деньги даются, а если выдавать их при спавне, то не получится

может попробовать таймер поставить? или выдавать их в конце раунда?

update

PHP:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

public OnPluginStart()
{
    HookEvent("round_start", Event_RoundStart);
    HookEvent("cs_match_end_restart", Event_RestartRound);
    HookEvent("player_spawn", Event_OnPlayerSpawn);
    HookEvent("round_end", round_end);
	
}

new round_counter = 0;

public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    round_counter++;
}

public Event_RestartRound(Handle:event, const String:name[], bool:dontBroadcast)
{
    round_counter = 0;
}

public round_end(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
	
    if (client > 0 && IsPlayerAlive(client) && (round_counter > 1))
	{
		if (IsPlayerGenericAdmin(client))
		{
			new Cash = GetEntProp(client, Prop_Send, "m_iAccount"); 
			if(Cash < 16000) SetEntProp(client, Prop_Send, "m_iAccount", Cash + 1500); 
			else if(Cash >= 16000) SetEntProp(client, Prop_Send, "m_iAccount", 16000); 	
		}
	}
}

public Event_OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	new team = GetClientTeam(client);
	
	if (client > 0 && IsPlayerAlive(client))
	{
		if (IsPlayerGenericAdmin(client))
		{
			SetEntityHealth(client, 105);  //hp
			SetEntProp(client, Prop_Send, "m_ArmorValue", 100, 4); //armor
			SetEntProp(client, Prop_Send, "m_bHasHelmet", 1); //helm
			
			GivePlayerItem(client, "weapon_flashbang"); //flash
			GivePlayerItem(client, "weapon_flashbang"); //flash
			GivePlayerItem(client, "weapon_hegrenade"); //grenade
			
			if(team == CS_TEAM_CT)
			{
				GivePlayerItem(client, "item_defuser"); //kombinerki
			}		
		}
	}
}

/*
@param client id

return bool
*/
bool:IsPlayerGenericAdmin(client)
{
	return CheckCommandAccess(client, "generic_admin", ADMFLAG_GENERIC, false);
}

так тоже не работает ..
 
Последнее редактирование:
Сверху Снизу