PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
#define CLASS_FIREBALL "wow_fireball"
new const WOW_FIREBALL[][] =
{
"models/w_paintball.mdl"
}
new cvar_fdamage, cvar_fsdamage, cvar_fforce
new Float: g_LastFthrow[33]
public plugin_init()
{
cvar_fdamage = register_cvar("zswarm_fdamage", "100")
cvar_fsdamage = register_cvar("zswarm_fsdamage","1")
cvar_fforce = register_cvar("zswarm_fforce", "1500")
register_forward(FM_Touch, "fw_Touch")
register_forward(FM_Touch, "fw_Touch")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
}
public clcmd_throw(id)
{
static Float: Origin[3], Float: Velocity[3], Float: Angle[3], MinBox[3], MaxBox[3]
pev(id, pev_origin, Origin)
pev(id, pev_velocity, Velocity)
pev(id, pev_angles, Angle)
static Health, Float: damage
Health = get_user_health(id)
damage = get_pcvar_float(cvar_fsdamage)
if (Health > damage)
{
static ent ; ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
set_pev(ent, pev_classname, CLASS_FIREBALL)
engfunc(EngFunc_SetModel, ent, WOW_FIREBALL[random(sizeof WOW_FIREBALL)])
Angle[0] = random_float(1.0, 360.0)
Angle[1] = random_float(1.0, 360.0)
MinBox = { -1.0, -1.0, -1.0 }
MaxBox = { 1.0, 1.0, 1.0 }
set_pev(ent, pev_angles, Angle)
engfunc(EngFunc_SetSize, ent, MinBox, MaxBox)
engfunc(EngFunc_SetOrigin, ent, Origin)
set_pev(ent, pev_movetype, MOVETYPE_TOSS)
set_pev(ent, pev_solid, SOLID_TRIGGER)
set_pev(ent, pev_owner, id)
velocity_by_aim(id, get_pcvar_num(cvar_fforce), Velocity)
set_pev(ent, pev_velocity, Velocity)
set_pev(id, pev_health, Health - damage)
}
else
{
client_print(id, print_center, "%L", LANG_PLAYER, "FLESH_HEALTH")
}
}
public fw_PlayerPreThink(id)
{
if(!is_user_alive(id))
return FMRES_IGNORED
static Float: Time
static button
button = pev(id, pev_button)
Time = get_gametime()
if ( (button & IN_ATTACK) && (button & IN_ATTACK2))
{
if(Time - 1.1 > g_LastFthrow[id])
{
clcmd_throw(id)
g_LastFthrow[id] = Time
}
}
return FMRES_IGNORED
}
public fw_Touch(pToucher, pTouched)
{
if ( pev_valid(pToucher))
{
static className[32], className2[32]
pev(pToucher, pev_classname, className, 31)
if ( pev_valid(pTouched)) pev(pTouched, pev_classname, className2, 31)
if ( equal(className, CLASS_FIREBALL))
{
static attacker ; attacker = pev(pToucher, pev_owner)
if ( pev_valid(pTouched))
{
if ( equal(className2, "player") && is_user_connected(pTouched))
{
static origin[3], Float: damage
get_user_origin(pTouched, origin)
damage = get_pcvar_float(cvar_fdamage)
static CsTeams:team[2]
team[0] = cs_get_user_team(pTouched), team[1] = cs_get_user_team(attacker)
if (attacker == pTouched)
return FMRES_SUPERCEDE
if (!get_cvar_num("mp_friendlyfire") && team[0] == team[1])
return FMRES_SUPERCEDE
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BLOOD);
write_coord(origin[0]);
write_coord(origin[1]);
write_coord(origin[2] + 10);
write_coord(random_num(-360, 360));
write_coord(random_num(-360, 360));
write_coord(-10);
write_byte(70);
write_byte(random_num(15, 35));
message_end()
ExecuteHam(Ham_TakeDamage, pTouched, pToucher, attacker, damage, DMG_GENERIC)
}
else if ( equal(className2, "func_breakable")) dllfunc(DLLFunc_Use, pTouched, attacker)
else if ( equal(className2, CLASS_FIREBALL)) return FMRES_SUPERCEDE
}
engfunc(EngFunc_RemoveEntity, pToucher)
}
}
return FMRES_IGNORED
}
public plugin_precache()
{
precache_model("models/w_paintball.mdl")
}
you can make a instead model to .spr? i want to this shoot a fire or flame