|
Veteran Member
|
08-13-2017
, 22:34
Re: [REQ] Disable helmet on pistol rounds
|
#11
|
Quote:
Originally Posted by vortex.
Sorry for late, here:
PHP Code:
#include <sourcemod>
int round;
bool noarmor = false;
public Plugin myinfo =
{
name = "No HELMET when pistol rounds",
author = "Vortéx!",
version = "1.0",
url = "https://forums.alliedmods.net/showthread.php?t=299971"
}
public void OnPluginStart()
{
HookEvent("round_start", roundstart);
HookEvent("player_spawned", spawn);
}
public Action roundstart(Handle event, const char[] name, bool dontBroadcast)
{
round = GetTeamScore(2) + GetTeamScore(3) + 1;
if(round < 4) // first round
{
noarmor = true;
}
else if(round > 3 && round < 16) // finish pistol rounds
{
noarmor = false;
}
else if(round > 15 && round < 18) // after half time
{
noarmor = true;
}
else if(round > 17) // finish pistol rounds
{
noarmor = false;
}
}
public Action spawn(Handle event, const char[] name, bool dontBroadcast)
{
if(noarmor)
{
int id = GetClientOfUserId(GetEventInt(event,"userid"));
SetEntProp(id, Prop_Send, "m_bHasHelmet", 0);
SetEntProp(id, Prop_Send, "m_ArmorValue", 0, 0);
}
}
public Action CS_OnBuyCommand(int client, const char[] sWeapon)
{
if(noarmor)
{
if (StrContains(sWeapon, "kevlar", false) != -1 || StrContains(sWeapon, "helmet", false) != -1)
{
PrintToChat(client, "You can not buy kevlar or helmet when pistol round");
return Plugin_Handled;
}
}
return Plugin_Continue;
}
|
Try this one, only changed how rounds are counted.
__________________
|
|
|
|