Veteran Member
|
05-17-2014
, 16:05
Animation Change Possible?
|
#1
|
I use a couple rips of golden ak code, but i use dual weapons as models, and the p_model position is wrong... is there a way i could switch the weapon's animation from ak's to dual pistols in the code so it will show the weapons corectly ?
Code:
/*
[ZP] Extra Item: Skull 4
Team: Humans
Description: This plugin adds a new weapon for Human Teams.
Weapon Cost: 33
Features:
- This weapon do more damage
- This weapon has zoom
- Launch Lasers
- This weapon has unlimited bullets
Credits:
KaOs - For his Dual MP5 mod
Cvars:
- zp_skull4_dmg_multiplier <5> - Damage Multiplier
- zp_skull4_gold_bullets <1|0> - Golden bullets effect ?
- zp_skull4_custom_model <1|0> - Custom Model
- zp_skull4_unlimited_clip <1|0> - Unlimited Clip
- zp_skull4_kb_power <> - Knockback
*/
#include <amxmodx>
#include <engine> // Added by Shidla
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <zombieplague>
#include <engine>
#include <zmvip>
#define is_valid_player(%1) (1 <= %1 <= 32)
#define ENG_NULLENT -1 // Added by Shidla
#define EV_INT_WEAPONKEY EV_INT_impulse // Added by Shidla
#define GUMP_WEAPONKEY 666 // Added by Shidla
new const g_GUMPEnt[] = "weapon_ump45"
new UMP_V_MODEL[64] = "models/weapons/v_skull41.mdl"
new UMP_P_MODEL[64] = "models/weapons/p_skull41.mdl"
new UMP_W_MODEL[64] = "models/weapons/w_skull41.mdl" // Added by Shidla
/* Pcvars */
new cvar_dmgmultiplier, cvar_goldbullets, cvar_custommodel, cvar_uclip, cvar_kb
// Item ID
new g_itemid
new bool:g_Hasump[33]
new g_hasZoom[ 33 ]
new bullets[ 33 ]
// Sprite
new m_spriteTexture
const Wep_ump45 = ((1<<CSW_UMP45))
public plugin_init()
{
/* CVARS */
cvar_dmgmultiplier = register_cvar("zp_skull4_dmg_multiplier", "1.5")
cvar_custommodel = register_cvar("zp_skull4_custom_model", "1")
cvar_goldbullets = register_cvar("zp_skull4_gold_bullets", "1")
cvar_uclip = register_cvar("zp_skull4_unlimited_clip", "0")
cvar_kb = register_cvar("zp_skull4_kb_power", "12.0")
// Register The Plugin
register_plugin("[ZP] Extra: SKULL 4", "1.1", "AlejandroSk / Shidla")
register_cvar("Shidla", "[ZP] SKULL 4 [w_ model added]", FCVAR_SERVER|FCVAR_SPONLY)
// Register Zombie Plague extra item
g_itemid = zv_register_extra_item("Dual Skull", "Best Weapon For Sale", 35, ZV_TEAM_HUMAN)
// Death Msg
register_event("DeathMsg", "Death", "a")
// Weapon Pick Up
register_event("WeapPickup","checkModel","b","1=19")
// Current Weapon Event
register_event("CurWeapon","checkWeapon","be","1=1")
register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
// Ham TakeDamage
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_forward( FM_CmdStart, "fw_CmdStart" )
RegisterHam(Ham_Item_AddToPlayer, g_GUMPEnt, "fw_GUMPAddToPlayer") // Added by Shidla
register_forward(FM_SetModel, "fw_SetModel") // Added by Shidla
}
public client_connect(id)
{
g_Hasump[id] = false
}
public client_disconnect(id)
{
g_Hasump[id] = false
}
public Death()
{
g_Hasump[read_data(2)] = false
}
public plugin_precache()
{
precache_model(UMP_V_MODEL)
precache_model(UMP_P_MODEL)
precache_model(UMP_W_MODEL) // Added by Shidla
m_spriteTexture = precache_model("sprites/dot.spr")
precache_sound("weapons/zoom.wav")
}
public zp_user_infected_post(id)
{
if (zp_get_user_zombie(id))
{
g_Hasump[id] = false
}
}
public checkModel(id)
{
if ( zp_get_user_zombie(id) )
return PLUGIN_HANDLED
new szWeapID = read_data(2)
if ( szWeapID == CSW_UMP45 && g_Hasump[id] == true && get_pcvar_num(cvar_custommodel) )
{
set_pev(id, pev_viewmodel2, UMP_V_MODEL)
set_pev(id, pev_weaponmodel2, UMP_P_MODEL)
}
return PLUGIN_HANDLED
}
public checkWeapon(id)
{
new plrClip, plrAmmo, plrWeap[32]
new plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if (plrWeapId == CSW_UMP45 && g_Hasump[id])
{
checkModel(id)
}
else
{
return PLUGIN_CONTINUE
}
if (plrClip == 0 && get_pcvar_num(cvar_uclip))
{
// If the user is out of ammo..
get_weaponname(plrWeapId, plrWeap, 31)
// Get the name of their weapon
give_item(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
}
return PLUGIN_HANDLED
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_UMP45 && g_Hasump[attacker] )
{
SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
new Float:vec[3]
new Float:oldvelo[3]
get_user_velocity(victim, oldvelo)
create_velocity_vector(victim , attacker , vec)
vec[0] += oldvelo[0]
vec[1] += oldvelo[1]
set_user_velocity(victim , vec)
}
}
public fw_CmdStart( id, uc_handle, seed )
{
if( !is_user_alive( id ) )
return PLUGIN_HANDLED
if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
{
new szClip, szAmmo
new szWeapID = get_user_weapon( id, szClip, szAmmo )
if( szWeapID == CSW_UMP45 && g_Hasump[id] == true && !g_hasZoom[id] == true)
{
g_hasZoom[id] = true
cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
}
else if ( szWeapID == CSW_UMP45 && g_Hasump[id] == true && g_hasZoom[id])
{
g_hasZoom[ id ] = false
cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
}
}
return PLUGIN_HANDLED
}
public make_tracer(id)
{
if (get_pcvar_num(cvar_goldbullets))
{
new clip,ammo
new wpnid = get_user_weapon(id,clip,ammo)
new pteam[16]
get_user_team(id, pteam, 15)
if ((bullets[id] > clip) && (wpnid == CSW_P90) && g_Hasump[id])
{
new vec1[3], vec2[3]
get_user_origin(id, vec1, 1) // origin; your camera point.
get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
//BEAMENTPOINTS
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte (0) //TE_BEAMENTPOINTS 0
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_coord(vec2[0])
write_coord(vec2[1])
write_coord(vec2[2])
write_short( m_spriteTexture )
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(10) // width
write_byte(0) // noise
write_byte( 255 ) // r, g, b
write_byte( 100 ) // r, g, b
write_byte( 0 ) // r, g, b
write_byte(225) // brightness
write_byte(175) // speed
message_end()
}
bullets[id] = clip
}
}
public zv_extra_item_selected(player, itemid)
{
if ( itemid == g_itemid )
{
if ( user_has_weapon(player, CSW_UMP45) )
{
drop_prim(player)
}
give_item(player, "weapon_ump45")
cs_set_user_bpammo(player, CSW_UMP45, 100)
client_print(player, print_chat, "[ZP] You Bought Dual Skull")
g_Hasump[player] = true;
}
}
// Added by Shidla
public fw_SetModel(entity, model[])
{
// Entity is not valid
if(!is_valid_ent(entity))
return FMRES_IGNORED;
// Entity model is not w_p90
if(!equal(model, "models/w_ump45.mdl"))
return FMRES_IGNORED;
// Get classname
static szClassName[33]
entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
// Not a Weapon box
if(!equal(szClassName, "weaponbox"))
return FMRES_IGNORED
// Some vars
static iOwner, iStoredGalilID
// Get owner
iOwner = entity_get_edict(entity, EV_ENT_owner)
// Get drop weapon index (galil) to use in fw_Galil_AddToPlayer forward
iStoredGalilID = find_ent_by_owner(ENG_NULLENT, "weapon_ump45", entity)
// Entity classname is weaponbox, and galil has founded
if(g_Hasump[iOwner] && is_valid_ent(iStoredGalilID))
{
// Setting weapon options
entity_set_int(iStoredGalilID, EV_INT_WEAPONKEY, GUMP_WEAPONKEY)
// Reset user vars
g_Hasump[iOwner] = false
// Set weaponbox new model
entity_set_model(entity, UMP_W_MODEL)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
// Added by Shidla
public fw_GUMPAddToPlayer (GUMP, id)
{
// Make sure that this is M79
if( is_valid_ent(GUMP) && is_user_connected(id) && entity_get_int(GUMP, EV_INT_WEAPONKEY) == GUMP_WEAPONKEY)
{
// Update
g_Hasump[id] = true
// Reset weapon options
entity_set_int(GUMP, EV_INT_WEAPONKEY, 0)
return HAM_HANDLED
}
return HAM_IGNORED
}
stock drop_prim(id)
{
new weapons[32], num
get_user_weapons(id, weapons, num)
for (new i = 0; i < num; i++) {
if (Wep_ump45 & (1<<weapons[i]))
{
static wname[32]
get_weaponname(weapons[i], wname, sizeof wname - 1)
engclient_cmd(id, "drop", wname)
}
}
}
stock create_velocity_vector(victim,attacker,Float:velocity[3])
{
if(!is_user_alive(victim) || !is_user_alive(attacker))
return 0
new Float:vicorigin[3]
new Float:attorigin[3]
entity_get_vector(victim , EV_VEC_origin , vicorigin)
entity_get_vector(attacker , EV_VEC_origin , attorigin)
new Float:origin2[3]
origin2[0] = vicorigin[0] - attorigin[0]
origin2[1] = vicorigin[1] - attorigin[1]
new Float:largestnum = 0.0
if(floatabs(origin2[0])>largestnum) largestnum = floatabs(origin2[0])
if(floatabs(origin2[1])>largestnum) largestnum = floatabs(origin2[1])
origin2[0] /= largestnum
origin2[1] /= largestnum
velocity[0] = ( origin2[0]*(get_pcvar_float(cvar_kb) * 3000)) / get_entity_distance(victim , attacker)
velocity[1] = ( origin2[1]*(get_pcvar_float(cvar_kb) * 3000)) / get_entity_distance(victim , attacker)
if(velocity[0] <= 20.0 || velocity[1] <= 20.0)
velocity[2] = random_float(200.0 , 275.0)
return 1
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
|
|