make sure default pistol is given on cookiescached

This commit is contained in:
rtldg 2021-10-26 21:40:17 +00:00
parent 5312c31253
commit 0591499471

View File

@ -498,6 +498,11 @@ public void OnClientCookiesCached(int client)
{
gI_HUD2Settings[client] = StringToInt(sHUDSettings);
}
if (gEV_Type != Engine_TF2 && IsValidClient(client, true) && GetClientTeam(client) > 1)
{
GivePlayerDefaultGun(client);
}
}
public void Player_ChangeClass(Event event, const char[] name, bool dontBroadcast)
@ -930,14 +935,13 @@ public Action Hook_GunTouch(int entity, int client)
return Plugin_Continue;
}
public void Player_Spawn(Event event, const char[] name, bool dontBroadcast)
void GivePlayerDefaultGun(int client)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (!(gI_HUDSettings[client] & (HUD_GLOCK|HUD_USP)))
{
return;
}
if (!IsFakeClient(client))
{
if (gEV_Type != Engine_TF2 && (gI_HUDSettings[client] & (HUD_GLOCK|HUD_USP)))
{
int iSlot = CS_SLOT_SECONDARY;
int iWeapon = GetPlayerWeaponSlot(client, iSlot);
char sWeapon[32];
@ -959,6 +963,17 @@ public void Player_Spawn(Event event, const char[] name, bool dontBroadcast)
iWeapon = GivePlayerItem(client, sWeapon);
FakeClientCommand(client, "use %s", sWeapon);
}
public void Player_Spawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (!IsFakeClient(client))
{
if (gEV_Type != Engine_TF2)
{
GivePlayerDefaultGun(client);
}
}
}