Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include sdktools
- float fNextAttack[MAXPLAYERS + 1], flGameTime[MAXPLAYERS + 1], flLastTime[MAXPLAYERS + 1];
- static const char gMelee[][] =
- {
- "baseball_bat",
- "cricket_bat",
- "crowbar",
- "electric_guitar",
- "fireaxe",
- "frying_pan",
- "golfclub",
- "katana",
- "machete",
- "tonfa",
- "knife"
- };
- static const float gSpeed[] =
- {
- 0.04,
- 0.04,
- 0.04,
- 0.04,
- 0.00,
- 0.04,
- 0.04,
- 0.04,
- 0.04,
- 0.15,
- 0.04
- };
- int g_iNextPAttO;
- public void OnPluginStart()
- {
- g_iNextPAttO = FindSendPropInfo("CBaseCombatWeapon","m_flNextPrimaryAttack");
- }
- public void OnGameFrame()
- {
- for(int i = 1;i < MaxClients; i++)
- {
- if(IsClientInGame(i))
- {
- int iCurrentWeapon = GetEntPropEnt(i, Prop_Send, "m_hActiveWeapon");
- if(IsValidEntity(iCurrentWeapon))
- {
- char sWeaponEx[56];
- GetEntityClassname(iCurrentWeapon, sWeaponEx, sizeof sWeaponEx);
- if(strcmp(sWeaponEx, "weapon_melee") == 0)
- {
- GetEntPropString(iCurrentWeapon, Prop_Data, "m_strMapSetScriptName", sWeaponEx, sizeof sWeaponEx);
- for(int v; v < 11; v++)
- {
- if(strcmp(sWeaponEx, gMelee[v]) == 0)
- {
- fNextAttack[i] = GetEntDataFloat(iCurrentWeapon, g_iNextPAttO);
- flGameTime[i] = GetGameTime();
- if ((flGameTime[i] - flLastTime[i]) > 0.5)
- {
- SetEntDataFloat(iCurrentWeapon, g_iNextPAttO, fNextAttack[i] - gSpeed[v], true);
- flLastTime[i] = GetGameTime();
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement