Raised This Month: $32 Target: $400
 8% 

TS Natives (Version: 0.1b)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 03-26-2009 , 18:44   TS Natives (Version: 0.1b)
Reply With Quote #1

Version: 0.1b

This was quickly done, tested, but probably not well enough. I'm going to add alot more, but it might have some use currently.
As of right now, there is one forward, that is called each time a player does a stunt.

Include the "include" below in your plugin to use this forward.

Code:
 TS_Stunt(id,Stunt:Type)
Usage:
Code:
public TS_Stunt(id,Stunts:Type)     if(Type == ST_DIVE)         client_print(id,print_chat,"[TS] You just dived!");
List of stunts:
Code:
enum Stunts {     ST_DIVE = 0,     ST_DIVE_LEFT,     ST_DIVE_RIGHT,     ST_BACKFLIP,     ST_FRONTFLIP, }

Planned:
Blocking of Stunts
Attack's Forward (Hooking Melee Attacks)

If you have any suggestions, please post

NOTE: You must be running the plugin on the server, for this to work.
There are also empty forwards in the include, do not use them.
Attached Files
File Type: inc TSDYNatives.inc (492 Bytes, 244 views)
File Type: sma Get Plugin or Get Source (TSDyNatives.sma - 815 views - 1.8 KB)
__________________
Oh yeah

Last edited by Drak; 03-28-2009 at 19:59.
Drak is offline
Send a message via MSN to Drak
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-26-2009 , 18:58   Re: TS Natives (Version: 0.1a)
Reply With Quote #2

You are not allowed to attach *.amxx file ; you should remove it, Drak.
Arkshine is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 03-26-2009 , 19:03   Re: TS Natives (Version: 0.1a)
Reply With Quote #3

I only did that, because it requires a local compile, and make it more convenient for the downloader.
The .sma is still attached, but since the rules state so. Okay.
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-26-2009 , 20:36   Re: TS Natives (Version: 0.1a)
Reply With Quote #4

I think it would be best to separate the .inc into a TSDYNatives.inc for the forward and TSDYNatives_const.inc for the enum{ }. Or, you should just add the enum{ } in your TSDyNatives.sma. This is because there is not reason to include the forward in the plugin that executes it.

Also, a little optimization:
Code:
public forward_PostThink(id) {     if(!g_Stunt[id] || !is_user_alive(id))         return FMRES_IGNORED         static Return         switch(pev(id, pev_sequence))     {         case 95: ExecuteForward(g_Forwards[0],Return,id,ST_DIVE);         case 96: ExecuteForward(g_Forwards[0],Return,id,ST_DIVE_LEFT);         case 97: ExecuteForward(g_Forwards[0],Return,id,ST_DIVE_RIGHT);         case 149: ExecuteForward(g_Forwards[0],Return,id,ST_FRONTFLIP);         case 152: ExecuteForward(g_Forwards[0],Return,id,ST_BACKFLIP);     }         g_Stunt[id] = 0     return FMRES_HANDLED }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 03-27-2009 , 10:55   Re: TS Natives (Version: 0.1a)
Reply With Quote #5

Your method is very unreliable. You should get DS's message logger and check through the messages if there's anything sent when you stunt.

Also, Exolent is wrong about the optimization in the switch statement, but correct about the combination of the stop at the beginning. In the assembly, though, it's not less or faster code, it's just that you avoid the pev() call if g_Stunt[id] is false.

Another possible optimization:

PHP Code:
enum Stunts
{
    
ST_DIVE 95,
    
ST_DIVE_LEFT 96,
    
ST_DIVE_RIGHT 97,
    
ST_BACKFLIP 149,
    
ST_FRONTFLIP 152

PHP Code:
switch(Animation)
{
    case 
ST_DIVE,ST_DIVE_LEFT,ST_DIVE_RIGHT,ST_FRONTFLIP,ST_BACKFLIPExecuteForward(g_Forwards[0],Return,id,Animation);

__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Drak
Veteran Member
Join Date: Jul 2005
Old 03-28-2009 , 19:58   Re: TS Natives (Version: 0.1a)
Reply With Quote #6

The only message sent when stunts are done, is the "TSMBlur" and as far as I can tell, is only sent when a stunt is done.
But it's the same amount of arguments for each stunt. So I just make sure a stunt as been done before I actually check the animation.

But, I updated to what you suggested Hawk.
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
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 09:27.


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