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

no recoil - no damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 03-03-2022 , 15:58   no recoil - no damage
Reply With Quote #1

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <xs>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <basebuilder>

new const SHOP_TITLE[]="Base Builder Shop^n"
new const ITEMS_LEFT[]="Items Left\w:"
const MAXIM_INCERCARI 2
const HP_SHOP_HM 100
const HP_SHOP_ZM 1000
const HP_SHOP_ZM2 2000
const SPEED_SHOP 320
const UC_LIMIT 20
new incercari[33]

new 
Ham:Ham_Player_ResetMaxSpeed Ham_Item_PreFrame;

#define nume_plg_frost "frostnades.amxx"
#define public_frost "buy_frostnade"

new meniu,callback

enum datas_ 
{
    
str[35],
    
cant,
    
cost
};

new const 
data_meniuHM[][datas_] = {  
    
// nume                // cantitate    // cost
    
"#hh HP",            HP_SHOP_HM,    8000},
    { 
"Frost Nade",            -1,        2000},
    { 
"No Recoil",            -1,        7000},
    { 
"Unlimited Clip(#u sec)",    -1,        5500},
    { 
"#s Maximum Speed",        SPEED_SHOP,    3500}
};

new const 
data_meniuZM[][datas_] = {  
    
// nume                // cantitate    // cost
    
"#hz HP",            HP_SHOP_ZM,    8000},
    { 
"2000 HP",            HP_SHOP_ZM2,    10000},
    { 
"#s Maximum Speed",        SPEED_SHOP,    3500}
};

new 
bool:viteza[33]

// weapons offsets
#define OFFSET_CLIPAMMO        51
#define OFFSET_LINUX_WEAPONS    4
#define fm_cs_set_weapon_ammo(%1,%2)    set_pdata_int(%1, OFFSET_CLIPAMMO, %2, OFFSET_LINUX_WEAPONS)
// players offsets
#define m_pActiveItem 373
const NOCLIP_WPN_BS    = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))
new const 
g_MaxClipAmmo[] = {
    
0,
    
13//CSW_P228
    
0,
    
10//CSW_SCOUT
    
0,  //CSW_HEGRENADE
    
7,  //CSW_XM1014
    
0,  //CSW_C4
    
30,//CSW_MAC10
    
30//CSW_AUG
    
0,  //CSW_SMOKEGRENADE
    
15,//CSW_ELITE
    
20,//CSW_FIVESEVEN
    
25,//CSW_UMP45
    
30//CSW_SG550
    
35//CSW_GALIL
    
25//CSW_FAMAS
    
12,//CSW_USP
    
20,//CSW_GLOCK18
    
10//CSW_AWP
    
30,//CSW_MP5NAVY
    
100,//CSW_M249
    
8,  //CSW_M3
    
30//CSW_M4A1
    
30,//CSW_TMP
    
20//CSW_G3SG1
    
0,  //CSW_FLASHBANG
    
7,  //CSW_DEAGLE
    
30//CSW_SG552
    
30//CSW_AK47
    
0,  //CSW_KNIFE
    
50//CSW_P90
}
new 
bool:uc[33]

#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
new bool:hnr[33]

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() {
    
RegisterHam(Ham_Player_ResetMaxSpeed"player""fw_ResetMaxSpeedPost"true);
    
    
register_event("HLTV""event_newround""a""1=0""2=0");
    
register_event("CurWeapon" "Event_CurWeapon" "be" "1=1" );
    
    
register_clcmd("say /shop","BBS")
    
register_clcmd("say_team /shop","BBS")
    
    
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)
    
    
register_plugin("[BB] Shop Manager""1.0""unknown")
}

public 
fw_ResetMaxSpeedPost(id)
{
    if(
is_user_alive(id)&&viteza[id])
    {
        
engfunc(EngFunc_SetClientMaxspeedidfloat(SPEED_SHOP));
        
set_pev(idpev_maxspeedfloat(SPEED_SHOP));
    }
    return 
HAM_IGNORED;
}

public 
fwPlaybackEvent(flagsinvokereventid) {
    if (!(
g_guns_eventids_bitsum & (1<<eventid)) || !(<= invoker <= g_max_clients)||!hnr[invoker])    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_monstersidpentru) {
    if (!(
<= id <= g_max_clients)||!hnr[id])    return FMRES_IGNORED
    
    
if (!g_normal_trace[id]) {
        
g_normal_trace[id] = pentru
        
return FMRES_HANDLED
    
}
    
    static 
dummy
    
if (pentru == g_normal_trace[id] || ignore_monsters != DONT_IGNORE_MONSTERS || !is_user_alive(id) || get_user_weapon(iddummydummy) == CSW_KNIFE)    return FMRES_IGNORED
    fix_recoil_trace
(idstartpentru)
    return 
FMRES_SUPERCEDE
}

public 
Event_CurWeaponid )
{
    if(!
is_user_alive(id)||!uc[id]||bb_is_user_zombie(id))    return
    new 
iWeapon read_data(2)
    if( !( 
NOCLIP_WPN_BS & (1<<iWeapon) ) )    fm_cs_set_weapon_ammoget_pdata_cbase(idm_pActiveItem) , g_MaxClipAmmoiWeapon ] )
}

public 
client_putinserver(id)
{
    if(!
is_user_connected(id)||is_user_bot(id)||is_user_hltv(id))    return
    
viteza[id]=false
    incercari
[id]=MAXIM_INCERCARI
    uc
[id]=false
    hnr
[id]=false
    g_normal_trace
[id] = 0
}
public 
client_disconnect(id)
{
    
viteza[id]=false
    incercari
[id]=0
    uc
[id]=false
    hnr
[id]=false
    g_normal_trace
[id] = 0
}

public 
event_newround()
{
    
arrayset(incercari,MAXIM_INCERCARI,charsmax(incercari))
    
arrayset(viteza,false,charsmax(viteza))
    
arrayset(uc,false,charsmax(uc))
    
arrayset(hnr,false,charsmax(hnr))
}

public 
BBS(id)
{
    if(!
is_user_alive(id))    return
    
    switch(
bb_is_user_zombie(id))
    {
        case 
true:    ZMS(id)
            case 
false:    HMS(id)
        }
}
public 
ZMS(id)
{
    if(!
is_user_alive(id)||!bb_is_user_zombie(id))    return
    
    static 
text[128], tasta[2], str_to_rpl[5], i,title[120]
    
formatex(titlecharsmax(title), "%s%s\r %d",SHOP_TITLE,ITEMS_LEFTincercari[id]);
    
meniu menu_create(title"shop_handlerZ");
    
callback menu_makecallback("hook_shopZ");
    
    for(
0sizeof data_meniuZMi++)
    {
        
num_to_str(HP_SHOP_ZM,str_to_rpl,charsmax(str_to_rpl))
        
replace(data_meniuZM[i], charsmax(data_meniuZM[]), "#hz"str_to_rpl);
        
num_to_str(HP_SHOP_ZM2,str_to_rpl,charsmax(str_to_rpl))
        
replace(data_meniuZM[i], charsmax(data_meniuZM[]), "#kk#"str_to_rpl);
        
num_to_str(SPEED_SHOP,str_to_rpl,charsmax(str_to_rpl))
        
replace_all(data_meniuZM[i], charsmax(data_meniuZM[]), "#s"str_to_rpl);
        
        if(
data_meniuZM[i][cant] != -1)    formatex(textcharsmax(text), "%s -\r [\y%d $\r]"data_meniuZM[i][str], data_meniuZM[i][cost]);
        
        
tasta[0] = i;
        
tasta[1] = 0;
        
menu_additem(meniutexttasta_callback);
    }
    
menu_setprop(meniuMPROP_EXITMEXIT_ALL);
    
menu_display(idmeniu);
}
public 
hook_shopZ(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    if(!
is_user_alive(id))    return ITEM_DISABLED;
    if(!
bb_is_user_zombie(id))    return ITEM_DISABLED;
    if(
incercari[id]<=0)    return ITEM_DISABLED;
    if(
cs_get_user_money(id) < data_meniuZM[item][cost])    return ITEM_DISABLED;
    
    return 
ITEM_ENABLED;
}
public 
shop_handlerZ(idmenuitem)
{
    if(
item == MENU_EXIT||item<0)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    switch(
item)
    {
        case 
0:    set_user_health(id,get_user_health(id)+HP_SHOP_ZM)
            case 
1:    set_user_health(id,get_user_health(id)+HP_SHOP_ZM2)
            case 
2:
        {
            if(
viteza[id])    return PLUGIN_HANDLED
            set_user_maxspeed
(id,float(SPEED_SHOP))
            
viteza[id]=true
        
}
    }
    
    
cs_set_user_money(id,cs_get_user_money(id)-data_meniuZM[item][cost],1)
    
incercari[id]--
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
HMS(id)
{
    if(!
is_user_alive(id)||bb_is_user_zombie(id))    return
    
    static 
text[128], tasta[2], i,title[120],str_to_rpl[5]
    
formatex(titlecharsmax(title), "%s%s\r %d",SHOP_TITLE,ITEMS_LEFTincercari[id]);
    
meniu menu_create(title"shop_handlerH");
    
callback menu_makecallback("hook_shopH");
    
    for(
0sizeof data_meniuHMi++)
    {
        
num_to_str(HP_SHOP_HM,str_to_rpl,charsmax(str_to_rpl))
        
replace_all(data_meniuHM[i][str], charsmax(data_meniuHM[]), "#hh"str_to_rpl)
        
num_to_str(UC_LIMIT,str_to_rpl,charsmax(str_to_rpl))
        
replace_all(data_meniuHM[i][str], charsmax(data_meniuHM[]), "#u"str_to_rpl);
        
num_to_str(SPEED_SHOP,str_to_rpl,charsmax(str_to_rpl))
        
replace_all(data_meniuHM[i][str], charsmax(data_meniuHM[]), "#s"str_to_rpl);
        
        if(
data_meniuHM[i][cant] != -1)    formatex(textcharsmax(text), "%s -\r [\y%d $\r]"data_meniuHM[i][str], data_meniuHM[i][cost]);
        else    
formatex(textcharsmax(text), "%s -\r [\y%d $\r]"data_meniuHM[i][str], data_meniuHM[i][cost]);
        
        
tasta[0] = i;
        
tasta[1] = 0;
        
menu_additem(meniutexttasta_callback);
    }
    
menu_setprop(meniuMPROP_EXITMEXIT_ALL);
    
menu_display(idmeniu);
}
public 
hook_shopH(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    if(!
is_user_alive(id))    return ITEM_DISABLED;
    if(
bb_is_user_zombie(id))    return ITEM_DISABLED;
    if(
incercari[id]<=0)    return ITEM_DISABLED;
    if(
cs_get_user_money(id) < data_meniuHM[item][cost])    return ITEM_DISABLED;
    
    return 
ITEM_ENABLED;
}
public 
shop_handlerH(idmenuitem)
{
    if(
item == MENU_EXIT||item<0)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    switch(
item)
    {
        case 
0:    set_user_health(id,get_user_health(id)+HP_SHOP_HM)
            case 
1:    evo_callfunc(id,public_frost,nume_plg_frost)
            case 
2:
        {
            if(
hnr[id])    return PLUGIN_HANDLED;
            
hnr[id]=true
        
}
        case 
3:
        {
            if(
uc[id])    return PLUGIN_HANDLED;
            
uc[id]=true
            set_task
(float(UC_LIMIT),"UCR",id)
        }
        case 
4:
        {
            if(
viteza[id])    return PLUGIN_HANDLED
            set_user_maxspeed
(id,float(SPEED_SHOP))
            
viteza[id]=true
        
}
    }
    
    
cs_set_user_money(id,cs_get_user_money(id)-data_meniuHM[item][cost],1)
    
incercari[id]--
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
UCR(id)
{
    
uc[id]=false
}

stock evo_callfuncid, function[], plugin[] )
{
    if( 
callfunc_begin( function, plugin ) == )
    {
        
callfunc_push_intid );
        
callfunc_end( );
    }
}

fix_recoil_trace(id, const Float:start[], pentru) {
    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_MONSTERSidpentru)


soo, i got this plugin (its old, may be old coded), but when i buy no recoil, it works, i got no recoil but it does not do any damage, can anyone help me to fix this? thank you!
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-04-2022 , 14:23   Re: no recoil - no damage
Reply With Quote #2

fwTraceLine() -> there's FMRES_SUPERCEDE in the end of the function which I'm pretty sure should be FMRES_IGNORED.

The code looks to be complicating things for no reason. This can be done much simpler.
__________________

Last edited by OciXCrom; 03-04-2022 at 14:24.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 03-09-2022 , 12:44   Re: no recoil - no damage
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
fwTraceLine() -> there's FMRES_SUPERCEDE in the end of the function which I'm pretty sure should be FMRES_IGNORED.

The code looks to be complicating things for no reason. This can be done much simpler.
thanks, it works!
yeah i know, but i can't do that on my own and i asked for help, and that i got
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
WDS UNITED
BANNED
Join Date: Mar 2022
Location: [ MATRIX ]
Old 03-15-2022 , 20:57   Re: no recoil - no damage
Reply With Quote #4

Keep in mind that you are using the VEN no-recoil system:
  • Lots of useless code supposed to make it hard to understand, some was the basis of another plugin, like 'events.sc'.
  • Will only work on AMXX <= v1.8.2
  • It will make flashbangs have no effect.
  • Your shotguns will be as accurate as rifles (non-realistic).
  • fwTraceLine is in effect almost all the time instead of just when players fire, wasting cpu.

PHP Code:
set_pev(idpev_punchangleFloat:{0.00.00.0}) // Visual recoil control, not physical-visual. 
Translation: The code above is for visual recoil, it does not change the trajectory of the projectiles.
It will just give you more concentration by removing the on-screen jolt.

The OT plugin's recoil control can remove physical-visual recoil, this allows you to slightly improve the accuracy of the shots.
But the OT plugin also has some futile codes.



In fact, to remove visual recoil just for yourself it's not really necessary to use plugins.

You can do this by simply editing the "delta.lst" file to remove the visual recoil:


Delete the following two lines in the "delta.lst" file:

PHP Code:
DEFINE_DELTApunchangle[0], DT_SIGNED DT_FLOAT268192.0 ), // vertical recoil
DEFINE_DELTApunchangle[1], DT_SIGNED DT_FLOAT268192.0 ), // horizontal recoil 
We recommend you use our Aim Realism plugin for this purpose.

But note that it does not have a purchase system like you are doing.
WDS UNITED 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 06:42.


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