Raised This Month: $ Target: $400
 0% 

[TUT/Snippet] Doing timed stuff without CreateTimers


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-11-2015 , 17:07   Re: [TUT/Snippet] Doing timed stuff without CreateTimers
Reply With Quote #5

Quote:
Originally Posted by Chdata View Post
I do.

As for what Powerlord said... wot? I don't know how you're getting OnGameFrame out of that. You only need to set the next attack once, rather than multiple frames, depending on what you're doing.

For example, VSH sets your next attack to 2 seconds after you get a backstab, instead of the normal 0.6s fire rate of the knife.

And when you climb walls as a sniper it does more or less the same thing... but the plugin doesn't use OnGameFrame at all. (It does use a think hook for something else now though).

PHP Code:
stock SetNextAttack(iWeaponFloat:flSecs 0.0) {
    if (
iWeapon <= MaxClients || !IsValidEntity(iWeapon))  return;
    new 
Float:flNext GetGameTime() + flSecs;
    
SetEntPropFloat(iWeaponProp_Send"m_flNextPrimaryAttack"flNext);
    
SetEntPropFloat(iWeaponProp_Send"m_flNextSecondaryAttack"flNext);

Simple 5 line function.

If you want to delay every attack you'd just use TF2Items/TF2Attributes and use the fire rate penalty attribute.
I'm getting OnGameFrame out of that because Think hooks are called from eiface.h's GameFrame.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode