Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <tf2>
- #include <tf2_stocks>
- #include <sdkhooks>
- int attack[MAXPLAYERS+1];
- new offset_ammo;
- new offset_clip
- public OnPluginStart()
- {
- HookEvent("object_deflected", Deflect, EventHookMode_Post);
- offset_ammo = FindSendPropInfo("CBasePlayer", "m_iAmmo");
- offset_clip = FindSendPropInfo("CBaseCombatWeapon", "m_iClip1");
- }
- public void OnClientPutInServer(client)
- {
- SDKHook(client, SDKHook_OnTakeDamage, OnClientTakeDamage);
- }
- public Action OnClientTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3])
- {
- damage = 0.0;
- return Plugin_Changed;
- }
- public Action Deflect(Handle hEvent, char[] strEventName, bool bDontBroadcast)
- {
- int rocket = GetEventInt(hEvent, "object_entindex");
- RemoveEdict(rocket);
- return Plugin_Continue;
- }
- public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
- {
- if (!IsPlayerAlive(client)) return Plugin_Continue;
- new iWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
- new ammotype = GetEntProp(iWeapon, Prop_Send, "m_iPrimaryAmmoType")*4;
- SetEntData(weapon, offset_clip, 99, 4, true);
- SetEntData(client, ammotype+offset_ammo, 99, 4, true);
- TF2_RegeneratePlayer(client);
- if (buttons & IN_ATTACK)
- {
- attack[client] = 1;
- }
- if (buttons & IN_ATTACK2)
- {
- attack[client] = 2;
- }
- if (attack[client] == 1)
- {
- buttons |= IN_ATTACK;
- }
- if (attack[client] == 2)
- {
- buttons |= IN_ATTACK2;
- }
- ModRateOfFire(iWeapon);
- return Plugin_Continue;
- }
- stock ModRateOfFire(weapon)
- {
- new Float:m_flNextPrimaryAttack = GetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack");
- new Float:m_flNextSecondaryAttack = GetEntPropFloat(weapon, Prop_Send, "m_flNextSecondaryAttack");
- SetEntPropFloat(weapon, Prop_Send, "m_flPlaybackRate", 10.0);
- new Float:fGameTime = GetGameTime();
- new Float:fPrimaryTime = ((m_flNextPrimaryAttack - fGameTime) - 0.99);
- new Float:fSecondaryTime = ((m_flNextSecondaryAttack - fGameTime) - 0.99);
- SetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack", fPrimaryTime + fGameTime);
- SetEntPropFloat(weapon, Prop_Send, "m_flNextSecondaryAttack", fSecondaryTime + fGameTime);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement