mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
make sure default pistol is given on cookiescached
This commit is contained in:
parent
5312c31253
commit
0591499471
@ -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,35 +935,45 @@ public Action Hook_GunTouch(int entity, int client)
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
void GivePlayerDefaultGun(int client)
|
||||
{
|
||||
if (!(gI_HUDSettings[client] & (HUD_GLOCK|HUD_USP)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int iSlot = CS_SLOT_SECONDARY;
|
||||
int iWeapon = GetPlayerWeaponSlot(client, iSlot);
|
||||
char sWeapon[32];
|
||||
|
||||
if (gI_HUDSettings[client] & HUD_USP)
|
||||
{
|
||||
strcopy(sWeapon, 32, (gEV_Type == Engine_CSS) ? "weapon_usp" : "weapon_usp_silencer");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcopy(sWeapon, 32, "weapon_glock");
|
||||
}
|
||||
|
||||
if (iWeapon != -1)
|
||||
{
|
||||
RemovePlayerItem(client, iWeapon);
|
||||
AcceptEntityInput(iWeapon, "Kill");
|
||||
}
|
||||
|
||||
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 && (gI_HUDSettings[client] & (HUD_GLOCK|HUD_USP)))
|
||||
if (gEV_Type != Engine_TF2)
|
||||
{
|
||||
int iSlot = CS_SLOT_SECONDARY;
|
||||
int iWeapon = GetPlayerWeaponSlot(client, iSlot);
|
||||
char sWeapon[32];
|
||||
|
||||
if (gI_HUDSettings[client] & HUD_USP)
|
||||
{
|
||||
strcopy(sWeapon, 32, (gEV_Type == Engine_CSS) ? "weapon_usp" : "weapon_usp_silencer");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcopy(sWeapon, 32, "weapon_glock");
|
||||
}
|
||||
|
||||
if (iWeapon != -1)
|
||||
{
|
||||
RemovePlayerItem(client, iWeapon);
|
||||
AcceptEntityInput(iWeapon, "Kill");
|
||||
}
|
||||
|
||||
iWeapon = GivePlayerItem(client, sWeapon);
|
||||
FakeClientCommand(client, "use %s", sWeapon);
|
||||
GivePlayerDefaultGun(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user