Raised This Month: $ Target: $400
 0% 

[REQUEST] Recoil stocks in to a plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
|OnEHiTwOnDeR|
Member
Join Date: Apr 2007
Location: Los Angeles
Old 12-26-2007 , 11:15   [REQUEST] Recoil stocks in to a plugin?
Reply With Quote #1

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); 
}
__________________
|OnEHiTwOnDeR| is offline
Send a message via AIM to |OnEHiTwOnDeR|
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 12-27-2007 , 04:33   Re: [REQUEST] Recoil stocks in to a plugin?
Reply With Quote #2

Looks a lot easier if you do what's in this plugin:
http://forums.alliedmods.net/showthread.php?p=423721
__________________
M249-M4A1 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-27-2007 , 04:44   Re: [REQUEST] Recoil stocks in to a plugin?
Reply With Quote #3

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)

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
|OnEHiTwOnDeR|
Member
Join Date: Apr 2007
Location: Los Angeles
Old 12-27-2007 , 17:29   Re: [REQUEST] Recoil stocks in to a plugin?
Reply With Quote #4

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.
__________________
|OnEHiTwOnDeR| is offline
Send a message via AIM to |OnEHiTwOnDeR|
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 12-28-2007 , 05:18   Re: [REQUEST] Recoil stocks in to a plugin?
Reply With Quote #5

That plugin from connorr is not CS mod specific. Should work for DOD too. :/
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-28-2007 , 11:26   Re: [REQUEST] Recoil stocks in to a plugin?
Reply With Quote #6

But it needs to change events according to DOD weapons.
Should have a look in dod(?)/events/ folder for weapons events.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 12-28-2007 , 11:44   Re: [REQUEST] Recoil stocks in to a plugin?
Reply With Quote #7

Quote:
Originally Posted by Alka View Post
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.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
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 11:04.


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