←  Problemy

AMXX.pl: Support AMX Mod X i SourceMod

»

Opoźnienie poprzez timer

  • +
  • -
devil11 - zdjęcie devil11 20.05.2018

Witajcie

Mam mały problem z vipem, chodzi o to że podczas połączenia gracza vip innemu graczowi znikają modele broni, dowiedziałem się że jest to spowodowane przez PlayerSpawn i GivePlayerItem i teraz mój problem.

Mam oto taki kod,

public Action PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
	int client = GetClientOfUserId(GetEventInt(event, "userid"));
	if(!IsPlayerVIP(client)) return;
	if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
		SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
	if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
		SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
	int money = GetEntProp(client, Prop_Send, "m_iAccount");
	if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
	SetEntProp(client, Prop_Send, "m_iAccount", money+200);
	if(GetClientTeam(client) == CS_TEAM_CT)
		if(GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0) GivePlayerItem(client, "item_defuser");
	for(int x = 0; x < 1; x++)
			if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
		if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetHe) < 1) GivePlayerItem(client, "weapon_hegrenade");
	for(int x = 0; x < 1; x++)
			if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
		if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetFlash) < 1) GivePlayerItem(client, "weapon_flashbang");
	for(int x = 0; x < 1; x++)
			if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
		if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetSmoke) < 1) GivePlayerItem(client, "weapon_smokegrenade");
	if(GetClientTeam(client) == CS_TEAM_CT)
	{
		for(int x = 0; x < 1; x++)											// ilosc inc 
			if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
			if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetInc) < 1) GivePlayerItem(client, "weapon_incgrenade");
	}
	else if(GetClientTeam(client) == CS_TEAM_T)
	{
		for(int x = 0; x < 1; x++)
				if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
			if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetMol) < 1) GivePlayerItem(client, "weapon_molotov");
	}
}

I teraz jak mogę poprzez timer opóźnić otrzymywanie bonusa z tego, niestety muszę ograniczyć dodawanie broni timerem np na 0.2

			if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
		if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetHe) < 1) GivePlayerItem(client, "weapon_hegrenade");
Odpowiedz