Re: More recoil to weapons..
k, got something like this
Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>
#define PLUGIN "Weapon Inacuraccy"
#define VERSION "0.1"
#define AUTHOR "VoivoD"
new wiEnabled
#define RECOIL_LOW -4.0
#define RECOIL_HIGH 4.0
#define RECOIL2_LOW -8.0
#define RECOIL2_HIGH 8.0
#define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched
#define FL_ONGROUND (1<<9) // At rest / on the ground
new velocityI[3]
//new gmsgShake
//new taskid[32]
new g_rusza[33]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_PlayerPreThink,"fw_playerprethink");
wiEnabled = register_cvar("amx_inaccuracy","1");
public fw_playerprethink(id)
{
if(!get_pcvar_num(wiEnabled))
return FMRES_IGNORED;
static dummy, weapon;
weapon = get_user_weapon(id,dummy,dummy);
if(weapon != CSW_M4A1 && weapon != CSW_AK47 && weapon != CSW_AUG && weapon != CSW_SG550 && weapon != CSW_M249 && weapon != CSW_MP5NAVY)
return FMRES_IGNORED;
static flags
flags = entity_get_int(id, EV_INT_flags)
// if (!(flags & FL_ONGROUND)) //if in the air, unscope
// {
// client_cmd(id,"lastinv;lastinv")
// unscope_func(id)
// return PLUGIN_CONTINUE
// }
if((pev(id,pev_button) & IN_ATTACK) && !(pev(id,pev_oldbuttons) & IN_ATTACK))
{
{
if(weapon != CSW_M4A1 && weapon != CSW_AK47 && weapon != CSW_AUG && weapon != CSW_SG550 && weapon != CSW_M249)
//if ducking shake less
{
if(flags & FL_DUCKING)
{
return FMRES_HANDLED
}
else
{
new Float:fVec2[3];
fVec2[0] = random_float(RECOIL_LOW , RECOIL_HIGH);
fVec2[1] = random_float(RECOIL_LOW , RECOIL_HIGH);
fVec2[2] = random_float(RECOIL_LOW , RECOIL_HIGH);
entity_set_vector(id , EV_VEC_punchangle , fVec2);
}
if(weapon != CSW_MP5NAVY)
{
if(flags & FL_DUCKING)
{
return FMRES_HANDLED
}
else
{
new Float:fVec2[3];
fVec2[0] = random_float(RECOIL2_LOW , RECOIL2_HIGH);
fVec2[1] = random_float(RECOIL2_LOW , RECOIL2_HIGH);
fVec2[2] = random_float(RECOIL2_LOW , RECOIL2_HIGH);
entity_set_vector(id , EV_VEC_punchangle , fVec2);
}
}
}
}
}
return FMRES_HANDLED
}
public check_movement2(id)
{
// static id
// id = playerid[0]
switch ( is_user_bot ( id ) )
{
case 1:
return PLUGIN_CONTINUE
}
static Float:vector[3]
entity_get_vector(id, EV_VEC_velocity, vector)
FVecIVec(vector, velocityI)
if (velocityI[0] != 0 || velocityI[1] != 0 || velocityI[2] != 0) //check movement, if moving shake
{
g_rusza[id] = 1
}
else
{
g_rusza[id] = 0
}
return FMRES_HANDLED
}
but its only punching view when player has pressed the button, when it holds it doesnt work... any ideas ?
also set_task wont work couse the lowest value can be something between 0.2-0.4 and so the menagement cannot be done with this
|