Raised This Month: $51 Target: $400
 12% 

Always-Usable Impulse


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   General Purpose       
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-14-2016 , 07:26   Always-Usable Impulse
Reply With Quote #1

This plugin is very simple and small.
Impulse commands are only executable while the player is able to shoot. More technically: only executable while gpGlobals->time is greater than m_flNextAttack. This plugin lets players execute impulse commands (like impulse 100 for flashlight) and +use during some events that it is disabled because of what's said above. These events include reloading and changing weapons.

Written because one of my Steam friends requested it. Don't really expect it to be approved, but someone might find it useful. Probably most useful for deathrun and kreedz servers with timers, as it removes the need to wait your weapon to reload to start/end the timer.

Changelog:
Code:
v1.2.0
    Fixed the plugin not working on Linux servers
    Added support for more games for AMXX 1.8.2 and previous versions
v1.1.0
    Made plugin be more compatible with func_tank entities
v1.0.0
    Initial release
Attached Files
File Type: sma Get Plugin or Get Source (alwaysusable_impulse.sma - 898 views - 2.4 KB)

Last edited by klippy; 01-29-2016 at 13:22.
klippy is offline
icimaro1337
Junior Member
Join Date: Jan 2016
Location: Moldova, Chisinau
Old 01-14-2016 , 07:34   Re: Always-Usable Impulse
Reply With Quote #2

Thank you a lot
icimaro1337 is offline
Send a message via Skype™ to icimaro1337
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 01-14-2016 , 07:35   Re: Always-Usable Impulse
Reply With Quote #3

Quote:
Originally Posted by KliPPy View Post
but someone might find it useful. Probably most useful for deathrun and kreedz servers with timers, as it removes the need to wait your weapon to reload to start/end the timer.
Nice sharing, thank you very much.

Quote:
Originally Posted by KliPPy View Post
Don't really expect it to be approved, but someone might find it useful.
So, Code Snippets/Tutorials is the best place to share, 'cuz it is a more a snippet.
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 01-14-2016 at 07:35. Reason: spelling fix
addons_zz is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-14-2016 , 07:38   Re: Always-Usable Impulse
Reply With Quote #4

Quote:
Originally Posted by addons_zz View Post
So, Code Snippets/Tutorials is the best place to share, 'cuz it is a more a snippet.
Not really, as it is more of a real usable plugin than a code snippet. Code snippets are usually stock functions that help other scripters deal with a problem more easily.

Last edited by klippy; 01-14-2016 at 07:38.
klippy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-14-2016 , 09:05   Re: Always-Usable Impulse
Reply With Quote #5

This will enable impulse while you're using a func_tank entity ; I'm not sure if it's a good idea (might creates issues, but really don't know what would be the behavior).
Minimum you can do is at least documenting this. There are probably not that much map with func_tank.
And actually, you could directly hooking ItemPostFrame I guess (this is not called when you are dead or game is over).

Spoiler
__________________

Last edited by Arkshine; 01-14-2016 at 09:10.
Arkshine is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-14-2016 , 13:30   Re: Always-Usable Impulse
Reply With Quote #6

I just updated code, and now it avoids calling ImpulseCommands if the player is using a func_tank entity. However, I tested the previous plugin version with a func_tank entity, and in my opinion, it is better the way it is with my plugin. Without it, to quit using a func_tank, you have to walk away, but my plugin would allow players to press +use to stop using it. No issues observed.

I knew I could hook CBasePlayer::ItemPostFrame, but it is not a virtual function, so it's not possible with Hamsandwich. It's good as it is in my opinion, no need for adding Orpheu or Okapi (unless they (or similar new module) become default modules in AMXX). Just avoiding dependencies here.
klippy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-14-2016 , 18:42   Re: Always-Usable Impulse
Reply With Quote #7

About tank, you do what you want really, just documenting if not implemented is fine too.
About ItemPostFrame, for some reasons, I thought they were virtual; so nevermind.
__________________
Arkshine is offline
ujjl
Senior Member
Join Date: Jul 2009
Location: Hungary
Old 01-28-2016 , 13:45   Re: Always-Usable Impulse
Reply With Quote #8

Great work! Some notes:
PHP Code:
m_pTank find_ent_data_info("CBasePlayer""m_pTank"); 
will return the OS actual offset, using this in
PHP Code:
get_pdata_ent(thism_pTank
will crash the server on linux or mac, as extra 20 will be added to it.
PHP Code:
m_pTank 1408
is for cstrike only.
__________________
- blupi blupi

Last edited by ujjl; 01-28-2016 at 14:24.
ujjl is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-28-2016 , 15:08   Re: Always-Usable Impulse
Reply With Quote #9

Quote:
Originally Posted by ujjl View Post
Great work! Some notes:
PHP Code:
m_pTank find_ent_data_info("CBasePlayer""m_pTank"); 
will return the OS actual offset, using this in
PHP Code:
get_pdata_ent(thism_pTank
will crash the server on linux or mac, as extra 20 will be added to it.
PHP Code:
m_pTank 1408
is for cstrike only.
Oh, I didn't know it returns OS specific offset. I guess I will just subtract 20 from it if it's a Linux server. I'll fix it soon, not today though, got some work to do. Had someone tell me the plugin didn't work for them. They were probably running a Linux server, and that was the cause of it.

Last edited by klippy; 01-28-2016 at 15:21.
klippy is offline
ujjl
Senior Member
Join Date: Jul 2009
Location: Hungary
Old 01-29-2016 , 05:07   Re: Always-Usable Impulse
Reply With Quote #10

PHP Code:
public Player_PostThink_Post(this) {
    
    if( !
g_hasExecuted[this] ) {
        static 
m_pTankm_pTank get_ent_data_entity(this"CBasePlayer""m_pTank")
        
set_ent_data_entity(this"CBasePlayer""m_pTank"0)
        
ExecuteHamBHam_Player_ImpulseCommandsthis )
        
set_ent_data_entity(this"CBasePlayer""m_pTank"m_pTank)
    }

This will not stop controlling the tank, when use pressed.
__________________
- blupi blupi
ujjl is offline
Reply



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 15:16.


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