Permalink
Browse files

Add #245

  • Loading branch information...
Bara committed Dec 1, 2017
1 parent 46b64d2 commit 74a5c0edf7fabaaadcc5591fd8178272df6fec27
@@ -114,6 +114,7 @@ void SetupConfig()
g_cPrimaryWeaponUpdate = AutoExecConfig_CreateConVar("ttt_primary_weapon_update", "0", "What should happen on round start with the primary weapon? 0 - nothing, 1 - drop old weapon, 2 - remove old weapon", _, true, 0.0, true, 2.0);
g_cSecondaryWeaponUpdate = AutoExecConfig_CreateConVar("ttt_secondary_weapon_update", "0", "What should happen on round start with the secondary weapon? 0 - nothing, 1 - drop old weapon, 2 - remove old weapon", _, true, 0.0, true, 2.0);
g_cAdvert = AutoExecConfig_CreateConVar("ttt_show_advert_message", "1", "Print a message on player spawn with some ttt details (like \"Trouble in Terrorist Town Version X.X.XXXX\")", _, true, 0.0, true, 1.0);
g_cInnocentKnife = AutoExecConfig_CreateConVar("ttt_give_innocent_knife", "1", "Give innocent a knife?", _, true, 0.0, true, 1.0);
g_cpluginTag.AddChangeHook(OnConVarChanged);
g_ckickImmunity.AddChangeHook(OnConVarChanged);
@@ -261,6 +261,7 @@ ConVar g_cCheckDuringWarmup = null;
ConVar g_cPrimaryWeaponUpdate = null;
ConVar g_cSecondaryWeaponUpdate = null;
ConVar g_cAdvert = null;
ConVar g_cInnocentKnife = null;
Handle g_hRules = null;
bool g_bRules[MAXPLAYERS + 1] = { false, ... };
@@ -1194,10 +1194,26 @@ stock void TeamInitialize(int client)
CS_SwitchTeam(client, CS_TEAM_T);
}
}
if (GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1)
if (g_cInnocentKnife.BoolValue && GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1)
{
GivePlayerItem(client, "weapon_knife");
}
else
{
char sBuffer[32];
int iEnt;
while ((iEnt = GetPlayerWeaponSlot(client, CS_SLOT_KNIFE)) != -1)
{
GetEntityClassname(iEnt, sBuffer, sizeof(sBuffer));
if (StrContains(sBuffer, "knife", false) != -1 || StrContains(sBuffer, "bayonet", false) != -1)
{
TTT_SafeRemoveWeapon(client, iEnt);
}
}
}
int iWeapon = GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY);
@@ -363,7 +363,17 @@ public Action Timer_Delete(Handle timer, any userid)
PerformBlind(client, 0);
SetEntProp(client, Prop_Data, "m_CollisionGroup", g_iCollision[client]);
SetEntityRenderMode(client, g_rmRenderMode[client]);
GivePlayerItem(client, "weapon_knife");
ConVar g_cInnocentKnife = FindConVar("ttt_give_innocent_knife");
if (g_cInnocentKnife.BoolValue && TTT_GetClientRole(client) == TTT_TEAM_INNOCENT)
{
GivePlayerItem(client, "weapon_knife");
}
else
{
GivePlayerItem(client, "weapon_knife");
}
}
}
}

0 comments on commit 74a5c0e

Please sign in to comment.