PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "Female Char"
#define VERSION "In Dev"
#define AUTHOR "Gian_Yagami"
#define MAX_SOUNDS 3
new bool:g_bFemale[33]
// sound female
new const SOUND_F_BHIT[MAX_SOUNDS][] = {
"player/f_bhit_flesh-1.wav",
"player/f_bhit_flesh-2.wav",
"player/f_bhit_flesh-3.wav"
}
new const SOUND_F_DIE[MAX_SOUNDS][] = {
"player/f_die1.wav",
"player/f_die2.wav",
"player/f_die3.wav"
}
new const SOUND_F_HS[MAX_SOUNDS][] = {
"player/f_headshot1.wav",
"player/f_headshot2.wav",
"player/f_headshot3.wav"
}
new cvar_run
new g_wpn[33], g_silen[33][CSW_P90+1], g_attack[33], g_anim[33], g_glock[33], g_change[33]
const SILENT_BS = ((1<<CSW_USP)|(1<<CSW_M4A1))
const PISTOLS_BS = ((1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE))
const m_iId = 43
const m_fSilent = 74
enum
{
ANIM_IDLE = 1,
ANIM_DRAW,
ANIM_SHOOT,
ANIM_SHOOT2,
ANIM_SHOOT_EMPTY
}
new const V_KNIFE[2][] = {"models/v_knife.mdl", "models/v_knife_w.mdl"}
new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
"weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
"weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
"weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
"weapon_ak47", "weapon_knife", "weapon_p90" }
new g_fwWeaponDraw, g_fwDummyResult
const NOSHOOT2_BS = ((1<<CSW_KNIFE)|(1<<CSW_GLOCK18)|(1<<CSW_ELITE))
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", true)
register_forward(FM_EmitSound, "fw_EmitSound", false)
register_event("CurWeapon","checkWeapon", "a")
for (new i=1; i<=CSW_P90; i++)
{
if (strlen(WEAPONENTNAMES[i]))
{
RegisterHam(Ham_Weapon_SendWeaponAnim, WEAPONENTNAMES[i], "fw_Weapon_SendWeaponAnim")
RegisterHam(Ham_Weapon_PrimaryAttack, WEAPONENTNAMES[i], "fw_Weapon_PrimaryAttack")
RegisterHam(Ham_Item_PostFrame, WEAPONENTNAMES[i], "fw_Item_PostFrame")
}
}
register_event("DeathMsg", "Death", "a")
register_event("CurWeapon","checkWeapon","be","1=1")
register_forward(FM_CmdStart, "fw_CmdStart")
//register_concmd("qq", "qq")
cvar_run = register_cvar("wpn_hand", "1")
// Custom Forwards
g_fwWeaponDraw = CreateMultiForward("wpn_weapon_draw", ET_IGNORE, FP_CELL)
}
public plugin_precache()
{
for (new i = 0; i < MAX_SOUNDS; i++)
{
engfunc(EngFunc_PrecacheSound, SOUND_F_BHIT[i])
engfunc(EngFunc_PrecacheSound, SOUND_F_DIE[i])
engfunc(EngFunc_PrecacheSound, SOUND_F_HS[i])
engfunc(EngFunc_PrecacheModel, V_KNIFE[0])
engfunc(EngFunc_PrecacheModel, V_KNIFE[1])
}
}
public fw_PlayerSpawn_Post(id)
{
if (!is_user_alive(id))
return;
static model[32]
get_user_info(id, "model", model, charsmax(model))
if (equali(model, "gign"))g_bFemale[id] = true
else g_bFemale[id] = false
}
public fw_EmitSound(id, channel, const sample[], Float:volume, Float:attn, flags, pitch)
{
if (!is_user_connected(id) || !g_bFemale[id])
return FMRES_IGNORED
/* bhit_flesh */
if (sample[7] == 'b' && sample[8] == 'h' && sample[9] == 'i' && sample[10] == 't')
{
emit_sound(id, channel, SOUND_F_BHIT[random(MAX_SOUNDS)], volume, attn, flags, pitch)
return FMRES_SUPERCEDE
}
/* die/death */
if (sample[7] == 'd' && ((sample[8] == 'i' && sample[9] == 'e') || (sample[8] == 'e' && sample[9] == 'a')))
{
emit_sound(id, channel, SOUND_F_DIE[random(MAX_SOUNDS)], volume, attn, flags, pitch)
return FMRES_SUPERCEDE
}
/* headshot */
if (sample[7] == 'h' && sample[8] == 'e' && sample[9] == 'a' && sample[10] == 'd')
{
emit_sound(id, channel, SOUND_F_HS[random(MAX_SOUNDS)], volume, attn, flags, pitch)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
public Death()
{
new victim = read_data(2)
for (new i=1; i<=CSW_P90; i++)
{
g_silen[victim][i] = 0
}
}
public fw_Item_PostFrame(ent)
{
new id = pev(ent, pev_owner)
if (!is_user_connected(id)) return HAM_IGNORED
// check silent
static iId ; iId = get_pdata_int(ent, m_iId, 4)
if (SILENT_BS & (1<<iId))
{
if (get_pdata_int(ent, m_fSilent, 4)) g_silen[id][iId] = 1
else g_silen[id][iId] = 0
}
return HAM_IGNORED
}
public fw_Weapon_SendWeaponAnim(ent, iAnim, skiplocal, body)
{
new id = pev(ent, pev_owner)
if (!is_user_connected(id)) return HAM_IGNORED
// get idwpn
new classname[64]
pev(ent, pev_classname, classname, charsmax(classname))
new idwpn = cs_weapon_name_to_id(classname)
g_attack[id] = 0
// send anim
new anim_set
anim_set ==get_num_anim(id, idwpn, ANIM_IDLE)
playanim(id, anim_set)
// draw
if (iAnim == get_num_anim(id, idwpn, ANIM_DRAW) && g_wpn[id] == idwpn)
{
g_change[id] = 1
ExecuteForward(g_fwWeaponDraw, g_fwDummyResult, id)
//client_print(0, print_chat, "[%s][%s]", g_weapon_models[id][0], g_weapon_models[id][1])
return HAM_SUPERCEDE
}
// Fix Anim Glock18
if (idwpn == CSW_GLOCK18)
{
if (iAnim == 8 || iAnim == 11) g_anim[id] = iAnim
else if (iAnim == 0 || iAnim == 1 || iAnim == 2)
{
g_glock[id] = 1
g_anim[id] = iAnim
}
else g_anim[id] = 0
}
//client_print(0, print_chat, "[%i][%i][%i][%i]", id, iAnim, skiplocal, body)
return HAM_IGNORED
}
public fw_Weapon_PrimaryAttack(ent)
{
new id = pev(ent, pev_owner)
if (!is_user_connected(id)) return HAM_IGNORED
new plrClip, plrAmmo
get_user_weapon(id, plrClip , plrAmmo)
if (plrClip)
{
g_attack[id] = 1
}
return HAM_IGNORED
}
public checkWeapon(id)
{
new plrClip, plrAmmo, plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
// send anim shoot
if (g_attack[id])
{
new ani
if (!plrClip) ani = get_num_anim(id, plrWeapId, ANIM_SHOOT_EMPTY)
else if (!ani) ani = get_num_anim(id, plrWeapId, ANIM_SHOOT)
playanim(id, ani)
g_attack[id] = 0
}
// set v_model knife of girl
if (plrWeapId == CSW_KNIFE)
{
new model_v[64];
pev(id, pev_viewmodel2, model_v, charsmax(model_v))
if (equal(model_v, V_KNIFE[0]))
{
if (!g_bFemale[id]) return;
set_pev(id, pev_viewmodel2, V_KNIFE[1])
}
}
//client_print(id, print_chat, "2[%i]", plrClip)
}
public fw_CmdStart(id, uc_handle, seed)
{
//new num = pev(id, pev_weaponanim)
//client_print(id, print_chat, "AT[%i]", g_silen[id])
if (!is_user_alive(id)) return;
new plrClip, plrAmmo, plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if (g_wpn[id] != plrWeapId || g_change[id])
{
new anim = get_num_anim(id, plrWeapId, ANIM_DRAW)
if (plrWeapId == CSW_GLOCK18)
{
anim = max(anim, g_anim[id])
g_anim[id] = 0
}
playanim(id, anim)
g_wpn[id] = plrWeapId
g_attack[id] = 0
g_change[id] = 0
}
else if (!g_attack[id])
{
if (plrWeapId == CSW_GLOCK18 && g_glock[id])
{
playanim(id, g_anim[id])
g_glock[id] = 0
g_anim[id] = 0
}
}
}
public qq(id)
{
}
playanim(id, anim)
{
if (!is_user_alive(id) || !get_pcvar_num(cvar_run)) return;
//if (g_wpn[id] == CSW_ELITE && g_attack[id]) return;
//new hand
if (!g_bFemale[id]) return;
//if (!hand) return;
//set_pev(player, pev_weaponanim, anim)
message_begin(MSG_ONE, SVC_WEAPONANIM, {0, 0, 0}, id)
write_byte(anim)
write_byte(1)
message_end()
}
cs_weapon_name_to_id(const weapon[])
{
static i
for (i = 0; i < sizeof WEAPONENTNAMES; i++)
{
if (equal(weapon, WEAPONENTNAMES[i]))
return i;
}
return 0;
}
get_num_anim(id, wpn, type)
{
// type = 1 : draw - type = 2 : shoot
new draw, shoot, shoot_empty, idle
switch(wpn)
{
case CSW_AK47:
{
draw = 2
shoot = 3
}
case CSW_AUG:
{
draw = 2
shoot = 3
}
case CSW_AWP:
{
draw = 5
shoot = 1
}
case CSW_DEAGLE:
{
draw = 5
shoot = 1
shoot_empty = 3
}
case CSW_ELITE:
{
draw = 15
shoot = 6
shoot_empty = 7
}
case CSW_FAMAS:
{
draw = 2
shoot = 3
}
case CSW_FIVESEVEN:
{
draw = 5
shoot = 1
shoot_empty = 3
}
case CSW_G3SG1:
{
draw = 4
shoot = 1
}
case CSW_GALIL:
{
draw = 2
shoot = 3
}
case CSW_GLOCK18:
{
draw = 8
shoot = 5
shoot_empty = 6
}
case CSW_KNIFE:
{
draw = 3
shoot = 1
}
case CSW_M3:
{
draw = 6
shoot = 1
}
case CSW_M4A1:
{
idle = 7
draw = 12
shoot = 8
}
case CSW_M249:
{
draw = 4
shoot = 1
}
case CSW_MAC10:
{
draw = 2
shoot = 3
}
case CSW_MP5NAVY:
{
draw = 2
shoot = 3
}
case CSW_P90:
{
draw = 2
shoot = 3
}
case CSW_P228:
{
draw = 6
shoot = 1
shoot_empty = 4
}
case CSW_SCOUT:
{
draw = 4
shoot = 1
}
case CSW_SG550:
{
draw = 4
shoot = 1
}
case CSW_SG552:
{
draw = 2
shoot = 3
}
case CSW_TMP:
{
draw = 2
shoot = 3
}
case CSW_UMP45:
{
draw = 2
shoot = 3
}
case CSW_USP:
{
idle = 8
draw = 14
shoot = 9
shoot_empty = 12
}
case CSW_XM1014:
{
draw = 6
shoot = 1
}
case CSW_C4:
{
draw = 1
}
case CSW_HEGRENADE:
{
draw = 3
}
case CSW_FLASHBANG:
{
draw = 3
}
case CSW_SMOKEGRENADE:
{
draw = 3
}
}
// silen wpn
if (wpn == CSW_M4A1 && g_silen[id][CSW_M4A1])
{
idle -= 7
draw -= 7
shoot -= 7
shoot_empty -= 7
}
else if (wpn == CSW_USP && g_silen[id][CSW_USP])
{
idle -= 8
draw -= 8
shoot -= 8
shoot_empty -= 8
}
// random anim shoot2
if (!(NOSHOOT2_BS & (1<<wpn))) shoot += random_num(0, 1)
// return value
if (type == ANIM_IDLE) return idle
else if (type == ANIM_DRAW) return draw
else if (type == ANIM_SHOOT) return shoot
else if (type == ANIM_SHOOT_EMPTY) return shoot_empty
return 0
}