AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [REQUEST] Recoil stocks in to a plugin? (https://forums.alliedmods.net/showthread.php?t=64863)

|OnEHiTwOnDeR| 12-26-2007 11:15

[REQUEST] Recoil stocks in to a plugin?
 
how would i make this into a no recoil plugin ?

PHP Code:

// Created by potatis_invalido
stock create_recoilidFloat:recoil ) {
    new 
Float:angles[3];
    
pev(idpev_v_angleangles);
     
    
angles[0] -= random_float(recoil 1.2recoil 0.8);
    if(
angles[0] < -88.994750)
    {
        
angles[0] = -88.994750;
    }
    else if(
angles[0] > 88.994750)
    {
        
angles[0] = 88.994750;
    }
     
    
angles[1] += random_float(recoil 0.35recoil * -0.35);
    if(
angles[1] > 180.0)
    {
        
angles[1] -= 360.0;
    }
    else if(
angles[1] < -180.0)
    {
        
angles[1] += 360.0;
    }
    
set_pev(idpev_anglesangles);
    
set_pev(idpev_fixangle1); 

}

M249-M4A1 12-27-2007 04:33

Re: [REQUEST] Recoil stocks in to a plugin?
 
Looks a lot easier if you do what's in this plugin:
http://forums.alliedmods.net/showthread.php?p=423721

ConnorMcLeod 12-27-2007 04:44

Re: [REQUEST] Recoil stocks in to a plugin?
 
I can't find the post, but here is VEN's method :

PHP Code:

/* AMX Mod X
*   Fix Recoil
*
* (c) Copyright 2007 by VEN
*
* This file is provided as is (no warranties)
*/

// plugin's main information
#define PLUGIN_NAME "Fix Recoil"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "VEN"

#include <amxmodx>
#include <fakemeta>
#include <xs>

#define MAX_CLIENTS 32
new g_normal_trace[MAX_CLIENTS 1]
new 
bool:g_fix_punchangle[MAX_CLIENTS 1]

new 
g_fwid
new g_max_clients

new const g_guns_events[][] = {
    
"events/awp.sc",
    
"events/g3sg1.sc",
    
"events/ak47.sc",
    
"events/scout.sc",
    
"events/m249.sc",
    
"events/m4a1.sc",
    
"events/sg552.sc",
    
"events/aug.sc",
    
"events/sg550.sc",
    
"events/m3.sc",
    
"events/xm1014.sc",
    
"events/usp.sc",
    
"events/mac10.sc",
    
"events/ump45.sc",
    
"events/fiveseven.sc",
    
"events/p90.sc",
    
"events/deagle.sc",
    
"events/p228.sc",
    
"events/glock18.sc",
    
"events/mp5n.sc",
    
"events/tmp.sc",
    
"events/elite_left.sc",
    
"events/elite_right.sc",
    
"events/galil.sc",
    
"events/famas.sc"
}

new 
g_guns_eventids_bitsum

public plugin_precache() {
    
g_fwid register_forward(FM_PrecacheEvent"fwPrecacheEvent"1)
}

public 
fwPrecacheEvent(type, const name[]) {
    for (new 
0sizeof g_guns_events; ++i) {
        if (
equal(g_guns_events[i], name)) {
            
g_guns_eventids_bitsum |= (1<<get_orig_retval())
            return 
FMRES_HANDLED
        
}
    }

    return 
FMRES_IGNORED
}

public 
plugin_init() {
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)

    
unregister_forward(FM_PrecacheEventg_fwid1)

    
register_forward(FM_PlaybackEvent"fwPlaybackEvent")
    
register_forward(FM_PlayerPostThink"fwPlayerPostThink"1)
    
register_forward(FM_TraceLine"fwTraceLine")

    
g_max_clients global_get(glb_maxClients)
}

public 
fwPlaybackEvent(flagsinvokereventid) {
    if (!(
g_guns_eventids_bitsum & (1<<eventid)) || !(<= invoker <= g_max_clients))
        return 
FMRES_IGNORED

    g_fix_punchangle
[invoker] = true

    
return FMRES_HANDLED
}

public 
fwPlayerPostThink(id) {
    if (
g_fix_punchangle[id]) {
        
g_fix_punchangle[id] = false
        set_pev
(idpev_punchangleFloat:{0.00.00.0})
        return 
FMRES_HANDLED
    
}

    return 
FMRES_IGNORED
}

public 
fwTraceLine(const Float:start[3], const Float:dest[3], ignore_monstersidptr) {
    if (!(
<= id <= g_max_clients))
        return 
FMRES_IGNORED

    
if (!g_normal_trace[id]) {
        
g_normal_trace[id] = ptr
        
return FMRES_HANDLED
    
}

    if (
ptr == g_normal_trace[id] || ignore_monsters != DONT_IGNORE_MONSTERS || !is_user_alive(id))
        return 
FMRES_IGNORED

    fix_recoil_trace
(idstartptr)

    return 
FMRES_SUPERCEDE
}

public 
client_connect(id) {
    
g_normal_trace[id] = 0
}

fix_recoil_trace(id, const Float:start[], ptr) {
    static 
Float:dest[3]
    
pev(idpev_v_angledest)
    
engfunc(EngFunc_MakeVectorsdest)
    
global_get(glb_v_forwarddest)
    
xs_vec_mul_scalar(dest9999.0dest)
    
xs_vec_add(startdestdest)
    
engfunc(EngFunc_TraceLinestartdestDONT_IGNORE_MONSTERSidptr)



|OnEHiTwOnDeR| 12-27-2007 17:29

Re: [REQUEST] Recoil stocks in to a plugin?
 
but see thats the problem this isnt for the cs mod its for dod and the guns are different and veryoe of the plugins i tired on here dont work.

Alka 12-28-2007 05:18

Re: [REQUEST] Recoil stocks in to a plugin?
 
That plugin from connorr is not CS mod specific. Should work for DOD too. :/

ConnorMcLeod 12-28-2007 11:26

Re: [REQUEST] Recoil stocks in to a plugin?
 
But it needs to change events according to DOD weapons.
Should have a look in dod(?)/events/ folder for weapons events.

Wilson [29th ID] 12-28-2007 11:44

Re: [REQUEST] Recoil stocks in to a plugin?
 
Quote:

Originally Posted by Alka (Post 567621)
That plugin from connorr is not CS mod specific. Should work for DOD too. :/

It may not be CS specific, but it's specifically not for DOD.

CS uses punchangle to create recoil. DOD changes the v_angles. Look at the code in the original post here and you will see how recoil works in DOD.

I started making it before but lost the desire. I'm sure it will come back soon enough and I'll finish it.


All times are GMT -4. The time now is 11:04.

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