📄 nospread.txt
字号:
Since I'm bored I decided to write a tutorial on how to add snipitys new nospread
BY: the NightMare Creator elbek
the source I'm gonna use in this tutorial will be original felony x
ok ready?
first off open playeritems.cpp
add this at the bottom
Code:
Code:
//=====================================================
int PlayerItems::GetCurWeaponindex(void)
{
int index;
if (currentSlot == -1)
return -1;
if (currentSlot == 0)
index = slot1Index;
else if (currentSlot == 1)
index = slot2Index;
else
return -1;
return index;
}
//=====================================================
int PlayerItems::CurrentID(void)
{
int index;
index = GetCurWeaponindex();
if (index == -1)
return -1;
return weaponList[index].iId;
}
now open playeritems.h.. under
Code:
Code:
public:
void msgWeaponList(int iSize, void *pbuf );
void msgCurWeapon (int iStat, int iId, int iClip );
void clearWeaponSlots(){slot1Index=-1; slot2Index=-1;}
char* getNamebyId(int id);
bool canSwitch();
add this
Code:
Code:
int GetCurWeaponindex(void);
int CurrentID(void);
open attack.h.. just above
Code:
Code:
class BurstInfo
add this
Code:
enum
{
WEAPONLIST_P228=1,
WEAPONLIST_UNKNOWN1=2,
WEAPONLIST_SCOUT=3,
WEAPONLIST_HEGRENADE=4,
WEAPONLIST_XM1014=5,
WEAPONLIST_C4=6,
WEAPONLIST_MAC10=7,
WEAPONLIST_AUG=8,
WEAPONLIST_SMOKEGRENADE=9,
WEAPONLIST_ELITE=10,
WEAPONLIST_FIVESEVEN=11,
WEAPONLIST_UMP45=12,
WEAPONLIST_SG550=13,
WEAPONLIST_UNKNOWN2=14,
WEAPONLIST_UNKNOWN3=15,
WEAPONLIST_USP=16,
WEAPONLIST_GLOCK18=17,
WEAPONLIST_AWP=18,
WEAPONLIST_MP5=19,
WEAPONLIST_M249=20,
WEAPONLIST_M3=21,
WEAPONLIST_M4A1=22,
WEAPONLIST_TMP=23,
WEAPONLIST_G3SG1=24,
WEAPONLIST_FLASHBANG=25,
WEAPONLIST_DEAGLE=26,
WEAPONLIST_SG552=27,
WEAPONLIST_AK47=28,
WEAPONLIST_KNIFE=29,
WEAPONLIST_P90=30
};
now open client.h... above local_player_info structure add this
Code:
#define USP_SILENCER (1 << 0)
#define GLOCK18_BURST (1 << 1)
#define M4A1_SILENCER (1 << 2)
struct spread_info
{
unsigned int random_seed;
int recoil;
float gtime;
float prevtime;
float brokentime; // This is only supposed to be set to zero when you buy the sg550 or the g3sg1
// not when you reload, switch weapons or pick up a weapon, this is do to the
// cs bugs for these guns (valve fix your code please)
float spreadvar;
float recoiltime;
bool firing;
int WeaponState;
int prcflags;
};
inside of local_player_info add this
Code:
struct spread_info spread;
next you should paste all of this somewhere above cl_createmove or right ontop of old nospread code..
Code:
static unsigned int glSeed = 0;
unsigned int seed_table[ 256 ] =
{
28985, 27138, 26457, 9451, 17764, 10909, 28790, 8716, 6361, 4853, 17798, 21977, 19643, 20662, 10834, 20103,
27067, 28634, 18623, 25849, 8576, 26234, 23887, 18228, 32587, 4836, 3306, 1811, 3035, 24559, 18399, 315,
26766, 907, 24102, 12370, 9674, 2972, 10472, 16492, 22683, 11529, 27968, 30406, 13213, 2319, 23620, 16823,
10013, 23772, 21567, 1251, 19579, 20313, 18241, 30130, 8402, 20807, 27354, 7169, 21211, 17293, 5410, 19223,
10255, 22480, 27388, 9946, 15628, 24389, 17308, 2370, 9530, 31683, 25927, 23567, 11694, 26397, 32602, 15031,
18255, 17582, 1422, 28835, 23607, 12597, 20602, 10138, 5212, 1252, 10074, 23166, 19823, 31667, 5902, 24630,
18948, 14330, 14950, 8939, 23540, 21311, 22428, 22391, 3583, 29004, 30498, 18714, 4278, 2437, 22430, 3439,
28313, 23161, 25396, 13471, 19324, 15287, 2563, 18901, 13103, 16867, 9714, 14322, 15197, 26889, 19372, 26241,
31925, 14640, 11497, 8941, 10056, 6451, 28656, 10737, 13874, 17356, 8281, 25937, 1661, 4850, 7448, 12744,
21826, 5477, 10167, 16705, 26897, 8839, 30947, 27978, 27283, 24685, 32298, 3525, 12398, 28726, 9475, 10208,
617, 13467, 22287, 2376, 6097, 26312, 2974, 9114, 21787, 28010, 4725, 15387, 3274, 10762, 31695, 17320,
18324, 12441, 16801, 27376, 22464, 7500, 5666, 18144, 15314, 31914, 31627, 6495, 5226, 31203, 2331, 4668,
12650, 18275, 351, 7268, 31319, 30119, 7600, 2905, 13826, 11343, 13053, 15583, 30055, 31093, 5067, 761,
9685, 11070, 21369, 27155, 3663, 26542, 20169, 12161, 15411, 30401, 7580, 31784, 8985, 29367, 20989, 14203,
29694, 21167, 10337, 1706, 28578, 887, 3373, 19477, 14382, 675, 7033, 15111, 26138, 12252, 30996, 21409,
25678, 18555, 13256, 23316, 22407, 16727, 991, 9236, 5373, 29402, 6117, 15241, 27715, 19291, 19888, 19847
};
//===================================================================================
unsigned int U_Random( void )
{
glSeed *= 69069;
glSeed += seed_table[ glSeed & 0xff ];
return ( ++glSeed & 0x0fffffff );
}
//===================================================================================
void U_Srand( unsigned int seed )
{
glSeed = seed_table[ seed & 0xff ];
}
//===================================================================================
int UTIL_SharedRandomLong( unsigned int seed, int low, int high )
{
unsigned int range;
U_Srand( (int)seed + low + high );
range = high - low + 1;
if ( !(range - 1) )
{
return low;
}
else
{
int offset;
int rnum;
rnum = U_Random();
offset = rnum % range;
return (low + offset);
}
}
//===================================================================================
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high )
{
unsigned int range;
U_Srand( (int)seed + *(int *)&low + *(int *)&high );
U_Random();
U_Random();
range = (unsigned int)(high - low);
if ( !range )
{
return low;
}
else
{
int tensixrand;
float offset;
tensixrand = U_Random() & 65535;
offset = (float)tensixrand / 65536.0f;
return (low + offset * range );
}
}
//===================================================================================
void AngleVectors(const float *angles, float *forward, float *right, float *up)
{
float angle;
float sr, sp, sy, cr, cp, cy;
angle = angles[1] * (PI*2 / 360);
sy = sin(angle);
cy = cos(angle);
angle = angles[0] * (PI*2 / 360);
sp = sin(angle);
cp = cos(angle);
angle = angles[2] * (PI*2 / 360);
sr = sin(angle);
cr = cos(angle);
if (forward)
{
forward[0] = cp*cy;
forward[1] = cp*sy;
forward[2] = -sp;
}
if (right)
{
right[0] = (-1*sr*sp*cy+-1*cr*-sy);
right[1] = (-1*sr*sp*sy+-1*cr*cy);
right[2] = -1*sr*cp;
}
if (up)
{
up[0] = (cr*sp*cy+-sr*-sy);
up[1] = (cr*sp*sy+-sr*cy);
up[2] = cr*cp;
}
}
//===================================================================================
float GetVecSpread(float speed)
{
int id;
float spread;
id = playerItems.CurrentID();
switch (id)
{
case WEAPONLIST_DEAGLE:
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed)
spread = 0.25 * (1.0f - me.spread.spreadvar);
else if (me.spread.prcflags & FL_DUCKING)
spread = 0.115 * (1.0f - me.spread.spreadvar);
else
spread = 0.13 * (1.0f - me.spread.spreadvar);
}
else
spread = 1.5 * (1.0f - me.spread.spreadvar);
break;
case WEAPONLIST_ELITE:
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed)
spread = 0.175 * (1.0f - me.spread.spreadvar);
else if (me.spread.prcflags & FL_DUCKING)
spread = 0.08 * (1.0f - me.spread.spreadvar);
else
spread = 0.1 * (1.0f - me.spread.spreadvar);
}
else
spread = 1.3 * (1.0f - me.spread.spreadvar);
break;
case WEAPONLIST_FIVESEVEN:
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed)
spread = 0.255 * (1.0f - me.spread.spreadvar);
else if (me.spread.prcflags & FL_DUCKING)
spread = 0.075 * (1.0f - me.spread.spreadvar);
else
spread = 0.15 * (1.0f - me.spread.spreadvar);
}
else
spread = 1.5 * (1.0f - me.spread.spreadvar);
break;
case WEAPONLIST_GLOCK18:
if (!(me.spread.WeaponState & GLOCK18_BURST))
{
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed)
spread = 0.165 * (1.0f - me.spread.spreadvar);
else if (me.spread.prcflags & FL_DUCKING)
spread = 0.075 * (1.0f - me.spread.spreadvar);
else
spread = 0.1 * (1.0f - me.spread.spreadvar);
}
else
spread = 1.0f - me.spread.spreadvar;
}
else
{
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed)
spread = 0.185 * (1.0f - me.spread.spreadvar);
else if (me.spread.prcflags & FL_DUCKING)
spread = 0.095 * (1.0f - me.spread.spreadvar);
else
spread = 0.3 * (1.0f - me.spread.spreadvar);
}
else
spread = 1.2 * (1.0f - me.spread.spreadvar);
}
break;
case WEAPONLIST_P228:
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed)
spread = 0.255 * (1.0f - me.spread.spreadvar);
else if (me.spread.prcflags & FL_DUCKING)
spread = 0.075 * (1.0f - me.spread.spreadvar);
else
spread = 0.15 * (1.0f - me.spread.spreadvar);
}
else
spread = 1.5 * (1.0f - me.spread.spreadvar);
break;
case WEAPONLIST_G3SG1:
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed)
spread = 0.15f;
else if (me.spread.prcflags & FL_DUCKING)
spread = 0.035 * (1.0f - me.spread.spreadvar);
else
spread = 0.055 * (1.0f - me.spread.spreadvar);
}
else
spread = 0.45 * (1.0f - me.spread.spreadvar);
if (!(me.iFOV < 90.0f))
spread += 0.025f;
break;
case WEAPONLIST_SG550:
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed)
spread = 0.15f;
else if (me.spread.prcflags & FL_DUCKING)
spread = 0.04 * (1.0f - me.spread.spreadvar);
else
spread = 0.05 * (1.0f - me.spread.spreadvar);
}
else
spread = 0.45 * (1.0f - me.spread.spreadvar);
if (!(me.iFOV < 90.0f))
spread += 0.025f;
break;
case WEAPONLIST_USP:
if (!(me.spread.WeaponState & USP_SILENCER))
{
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed)
spread = 0.225 * (1.0f - me.spread.spreadvar);
else if (me.spread.prcflags & FL_DUCKING)
spread = 0.08 * (1.0f - me.spread.spreadvar);
else
spread = 0.1 * (1.0f - me.spread.spreadvar);
}
else
spread = 1.2 * (1.0f - me.spread.spreadvar);
}
else
{
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed)
spread = 0.25 * (1.0f - me.spread.spreadvar);
else if (me.spread.prcflags & FL_DUCKING)
spread = 0.125 * (1.0f - me.spread.spreadvar);
else
spread = 0.15 * (1.0f - me.spread.spreadvar);
}
else
spread = 1.3 * (1.0f - me.spread.spreadvar);
}
break;
case WEAPONLIST_AK47:
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed > 140.0f)
spread = me.spread.spreadvar * 0.07 + 0.04;
else
spread = me.spread.spreadvar * 0.0275;
}
else
spread = me.spread.spreadvar * 0.4 + .04;
break;
case WEAPONLIST_SG552:
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed > 140.0f)
spread = me.spread.spreadvar * 0.07 + 0.035;
else
spread = me.spread.spreadvar * 0.02;
}
else
spread = me.spread.spreadvar * 0.4 + .035;
break;
case WEAPONLIST_AUG:
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed > 140.0f)
spread = me.spread.spreadvar * 0.07 + 0.035;
else
spread = me.spread.spreadvar * 0.02;
}
else
spread = me.spread.spreadvar * 0.4 + .035;
break;
case WEAPONLIST_M249:
if (me.spread.prcflags & FL_ONGROUND)
{
if (speed > 140.0f)
spread = me.spread.spreadvar * 0.095 + 0.045;
else
spread = me.spread.spreadvar * 0.03;
}
else
spread = me.spread.spreadvar * 0.5 + .045;
break;
case WEAPONLIST_M4A1:
if (me.spread.prcflags & FL_ONGROUND)
{
if (!(me.spread.WeaponState & M4A1_SILENCER))
{
if (speed > 140.0f)
spread = me.spread.spreadvar * 0.07 + 0.035;
else
spread = me.spread.spreadvar * 0.02;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -