Skip to content

Commit

Permalink
Fix DrewViewModel based on @Cruze03 suggestion (#464)
Browse files Browse the repository at this point in the history
* Fix DrewViewModel based on @Cruze03 suggestion

* Apply this change to alive players

* Fix spaces...

* Use TTT macro

* Update no_weapon_fix.sp

Co-authored-by: Bara <mail@bara.dev>
  • Loading branch information
Mrkl21full and Bara committed Apr 12, 2020
1 parent 2a10b67 commit 87d214d
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions addons/sourcemod/scripting/no_weapon_fix.sp
Expand Up @@ -34,9 +34,6 @@ int g_iFakeItemClass;

int m_hMyWeapons;

#define LoopIngameClients(%1) for(int %1=1;%1<=MaxClients;++%1)\
if(IsClientInGame(%1))

enum struct PlayerData {
int FakeRef;
int Cooldown;
Expand Down Expand Up @@ -83,7 +80,7 @@ public void OnPluginStart()

HookEvent("item_equip", Event_ItemEquip);

LoopIngameClients(i)
LoopValidClients(i)
OnClientPutInServer(i);
}

Expand Down Expand Up @@ -216,6 +213,22 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
return Plugin_Continue;
}

public void TTT_OnRoundStart(int id, int i, int t, int d)
{
RequestFrame(Frame_ResetDrawViewModel);
}

void Frame_ResetDrawViewModel()
{
LoopValidClients(i)
{
if (IsPlayerAlive(i))
{
SetEntProp(i, Prop_Data, "m_bDrawViewmodel", 1);
}
}
}

void PreventThrowable(int client, int iWeapon)
{
float fUnlockTime = GetGameTime() + 0.5;
Expand Down

0 comments on commit 87d214d

Please sign in to comment.