AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   No Recoil (Universal) (https://forums.alliedmods.net/showthread.php?t=43085)

Charr 08-12-2006 21:30

No Recoil (Universal)
 
1 Attachment(s)
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.

ziecore 09-13-2006 10:14

Re: No Recoil (Universal)
 
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?

Hawk552 09-13-2006 16:39

Re: No Recoil (Universal)
 
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.

VEN 09-14-2006 02:58

Re: No Recoil (Universal)
 
IVecFVec and FVecIVec functions is messed here.
The plugin uses IVecFVec but the stock is for FVecIVec if some of you did not noticed.

Hawk552 09-14-2006 17:20

Re: No Recoil (Universal)
 
Quote:

Originally Posted by VEN (Post 380888)
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.

VEN 09-16-2006 12:09

Re: No Recoil (Universal)
 
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...

Hawk552 09-16-2006 12:30

Re: No Recoil (Universal)
 
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
}


Xanimos 12-12-2006 13:18

Re: No Recoil (Universal)
 
Author hasn't responded to any replys/suggestions for changes.

DJEarthQuake 01-04-2023 07:30

Re: No Recoil (Universal)
 
Even with Hawk552, AMX Mod X Moderator, suggestions 9000 errors were logged in seconds. Avoid testing unattended with low disk space! ;)


All times are GMT -4. The time now is 12:08.

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