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

No Recoil (Universal)


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
Charr
Senior Member
Join Date: Jul 2005
Location: Long Island, New York, U
Old 08-12-2006 , 21:30   No Recoil (Universal)
Reply With Quote #1

No Recoil (Universal)
As the title states, this is a no recoil plugin. I made it while looking at Knektor's No recoil plugin, and I noticed that it had CS only functionality.

Commands:
amx_norecoil - Allows an administrator to either enable / disable no recoil (Normal = disabled [0 = Off, 1 = All on, 2 = admin only])
amx_norecoil_level - Sets the access level for admin only no recoil. Having multiple flags in the requirements should work.

This plugin is untested, and I would test it myself if I had a capable machine.
Attached Files
File Type: sma Get Plugin or Get Source (amx_norecoil.sma - 836 views - 2.7 KB)
__________________
Charr is offline
Send a message via AIM to Charr Send a message via MSN to Charr
ziecore
Junior Member
Join Date: May 2005
Old 09-13-2006 , 10:14   Re: No Recoil (Universal)
Reply With Quote #2

Welcome to the AMX Mod X 1.75-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/groups/amxmodx/tmp3/phpGf2vAK.sma(96) : error 017: undefined symbol "fm_IVecFVec"

1 Error.
Could not locate output file /home/groups/amxmodx/public_html/websc3/phpGf2vAK.amx (compile failed).

am i missing something?
ziecore is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 09-13-2006 , 16:39   Re: No Recoil (Universal)
Reply With Quote #3

I can imagine a better solution to this is as follows:

Code:
/* AMXx No Recoil (Universal) *   This is a No recoil plugin, based heavily on Knekter's Adv No recoil, but it contains no CS functionalilty. */ #include <amxmodx> #include <fakemeta> #if !defined IVecFVec     #define IVecFVec fm_IVecFVec #endif // Engine's button define :O #define IN_ATTACK (1<<0) new szPlugin[] = "AMXx No Recoil (Universal)", szVersion[] = "0.1.0", szAuthor[] = "Charr"; new Float:VecSet[33][3], gAttack[33]; new gRecoilFlag = ADMIN_IMMUNITY, gNoRecoil; public plugin_init() {     register_plugin(szPlugin,szVersion,szAuthor);     register_concmd("amx_norecoil","admin_norecoil",ADMIN_IMMUNITY,": < 0 (DISABLED) | 1 (ENABLED) | 2 (ADMIN ONLY) >");     register_concmd("amx_norecoil_level","admin_norecoil_level",ADMIN_IMMUNITY,": < FLAG >");     register_forward(FM_PlayerPreThink,"FakeMeta_PreThink");     register_forward(FM_TraceLine,"FakeMeta_PostTraceLine",1); } // Command to enable/disable no recoil public admin_norecoil(id,level) {     if(get_user_flags(id) & level)     {         new szArg[32];         read_argv(1,szArg,31);         new Arg = str_to_num(szArg);         if( 0 <= Arg <= 2)         {             gNoRecoil = Arg;         }         else         {             console_print(id,"amx_norecoil: < 0 (DISABLED) | 1 (ENABLED) | 2 (ADMIN ONLY) >");         }     }     else     {         console_print(id,"Unknown command: amx_norecoil");     }     return PLUGIN_HANDLED; } // Command for changing the level for admin no recoil public admin_norecoil_level(id,level) {     if(get_user_flags(id) & level)     {         new szArg[32];         read_argv(1,szArg,31);         gRecoilFlag = read_flags(szArg);     }     else     {         console_print(id,"Unknown command: amx_norecoil_level");     }     return PLUGIN_HANDLED; } // Calculating the player's view based on when they hit the attack button public FakeMeta_PreThink(id) {     if(gNoRecoil)     {         new buttons = pev(id,pev_button);             if(!gAttack[id] && buttons & IN_ATTACK)         {             gAttack[id] = 1;                 set_pev(id,pev_punchangle,{0.0 , 0.0 , 0.0});                 new Origin[3];                         get_user_origin(id,Origin,3);             IVecFVec(Origin,VecSet[id]);         }             if(gAttack[id] && buttons & ~IN_ATTACK)         {             gAttack[id] = 0;         }     } } // Setting the player's view public FakeMeta_PostTraceLine(Float:Vec1[3],Float:Vec2[3],noMonsters,id) {     switch(gNoRecoil)     {         case 1: set_tr(TR_vecEndPos,VecSet[id]);         case 2: if(get_user_flags(id) & gRecoilFlag) { set_tr(TR_vecEndPos,VecSet[id]); }     } } // Clears the Global vars so that other players that join do not experiance problems public client_connect(id) {     for(new i = 0; i < 3; i++)     {         VecSet[id][i] = 0.0;     }     gAttack[id] = 0; } // VEN's FVecIVec directly from FM Util stock fm_FVecIVec(const Float:FVec[3], IVec[3]) {     IVec[0] = floatround(FVec[0])     IVec[1] = floatround(FVec[1])     IVec[2] = floatround(FVec[2])     return 1 }

But 2 things:
1) VEN did not write this, I would not give him credit if I were you
2) It should function even if you include engine, and if you do it will use the engine function instead.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
VEN
Veteran Member
Join Date: Jan 2005
Old 09-14-2006 , 02:58   Re: No Recoil (Universal)
Reply With Quote #4

IVecFVec and FVecIVec functions is messed here.
The plugin uses IVecFVec but the stock is for FVecIVec if some of you did not noticed.
VEN is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 09-14-2006 , 17:20   Re: No Recoil (Universal)
Reply With Quote #5

Quote:
Originally Posted by VEN View Post
IVecFVec and FVecIVec functions is messed here.
The plugin uses IVecFVec but the stock is for FVecIVec if some of you did not noticed.
Didn't notice that 0_o

I wonder why it compiled without problems.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
VEN
Veteran Member
Join Date: Jan 2005
Old 09-16-2006 , 12:09   Re: No Recoil (Universal)
Reply With Quote #6

Quote:
I wonder why it compiled without problems.
I had the compiler error for both the original and modified plugin. Maybe you overlooked it or something...
VEN is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 09-16-2006 , 12:30   Re: No Recoil (Universal)
Reply With Quote #7

This should do it:

Code:
/* AMXx No Recoil (Universal)
*   This is a No recoil plugin, based heavily on Knekter's Adv No recoil, but it contains no CS functionalilty.
*/

#include <amxmodx>
#include <fakemeta>

#if !defined IVecFVec
    #define IVecFVec fm_IVecFVec
#endif

// Engine's button define :O
#define IN_ATTACK (1<<0)

new szPlugin[] = "AMXx No Recoil (Universal)",
szVersion[] = "0.1.0",
szAuthor[] = "Charr";

new Float:VecSet[33][3],
gAttack[33];

new gRecoilFlag = ADMIN_IMMUNITY,
gNoRecoil;

public plugin_init()
{
    register_plugin(szPlugin,szVersion,szAuthor);

    register_concmd("amx_norecoil","admin_norecoil",ADMIN_IMMUNITY,": < 0 (DISABLED) | 1 (ENABLED) | 2 (ADMIN ONLY) >");
    register_concmd("amx_norecoil_level","admin_norecoil_level",ADMIN_IMMUNITY,": < FLAG >");

    register_forward(FM_PlayerPreThink,"FakeMeta_PreThink");
    register_forward(FM_TraceLine,"FakeMeta_PostTraceLine",1);
}

// Command to enable/disable no recoil
public admin_norecoil(id,level)
{
    if(get_user_flags(id) & level)
    {
        new szArg[32];
        read_argv(1,szArg,31);

        new Arg = str_to_num(szArg);

        if( 0 <= Arg <= 2)
        {
            gNoRecoil = Arg;
        }

        else
        {
            console_print(id,"amx_norecoil: < 0 (DISABLED) | 1 (ENABLED) | 2 (ADMIN ONLY) >");
        }
    }

    else
    {
        console_print(id,"Unknown command: amx_norecoil");
    }

    return PLUGIN_HANDLED;
}

// Command for changing the level for admin no recoil
public admin_norecoil_level(id,level)
{
    if(get_user_flags(id) & level)
    {
        new szArg[32];
        read_argv(1,szArg,31);

        gRecoilFlag = read_flags(szArg);
    }

    else
    {
        console_print(id,"Unknown command: amx_norecoil_level");
    }

    return PLUGIN_HANDLED;
}

// Calculating the player's view based on when they hit the attack button
public FakeMeta_PreThink(id)
{
    if(gNoRecoil)
    {
        new buttons = pev(id,pev_button);
    
        if(!gAttack[id] && buttons & IN_ATTACK)
        {
            gAttack[id] = 1;
    
            set_pev(id,pev_punchangle,{0.0 , 0.0 , 0.0});
    
            new Origin[3];
            
            get_user_origin(id,Origin,3);
            IVecFVec(Origin,VecSet[id]);
        }
    
        if(gAttack[id] && buttons & ~IN_ATTACK)
        {
            gAttack[id] = 0;
        }
    }
}

// Setting the player's view
public FakeMeta_PostTraceLine(Float:Vec1[3],Float:Vec2[3],noMonsters,id)
{
    switch(gNoRecoil)
    {
        case 1: set_tr(TR_vecEndPos,VecSet[id]);
        case 2: if(get_user_flags(id) & gRecoilFlag) { set_tr(TR_vecEndPos,VecSet[id]); }
    }
}

// Clears the Global vars so that other players that join do not experiance problems
public client_connect(id)
{
    for(new i = 0; i < 3; i++)
    {
        VecSet[id][i] = 0.0;
    }

    gAttack[id] = 0;
}

stock fm_IVecFVec(const IVec[3], Float:FVec[3])
{
    for(new Count;Count < 3;Count++)
        FVec[Count] = float(IVec[Count])

    return 1
}
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 12-12-2006 , 13:18   Re: No Recoil (Universal)
Reply With Quote #8

Author hasn't responded to any replys/suggestions for changes.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 01-04-2023 , 07:30   Re: No Recoil (Universal)
Reply With Quote #9

Even with Hawk552, AMX Mod X Moderator, suggestions 9000 errors were logged in seconds. Avoid testing unattended with low disk space! ;)
__________________
DJEarthQuake is offline
Reply


Thread Tools
Display Modes

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 05:06.


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