First of all, this code was taken from an SHero&Edited from that to ESF, and will not be redistributed, just for personal use.
Code:
#include <amxmodx>
#include <Vexd_Utilities>
#include <fun>
new g_armorPts, g_spriteSmoke, g_spriteTrailY, g_spriteTrailB, g_spriteTrailR
new g_spriteExplosionY, g_spriteExplosionB, g_spriteExplosionR, g_spritePowerUp
new g_powerNum[32]
new g_powerID[32]
new g_maxRadius[32]
new g_maxDamage[32]
static const g_burnDecal[3] = {28, 29, 30}
static const g_burnDecalBig[3] = {46, 47, 48}
public plugin_precache()
{
g_spriteTrailY = precache_model("sprites/shmod/esf_trail_yellow.spr")
g_spriteTrailB = precache_model("sprites/shmod/esf_trail_blue.spr")
g_spriteTrailR = precache_model("sprites/shmod/esf_trail_red.spr")
g_spriteExplosionY = precache_model("sprites/shmod/esf_exp_yellow.spr")
g_spriteExplosionB = precache_model("sprites/shmod/esf_exp_blue.spr")
g_spriteExplosionR = precache_model("sprites/shmod/esf_exp_red.spr")
g_spritePowerUp = precache_model("sprites/shmod/esf_powerup.spr")
g_spriteSmoke = precache_model("sprites/explosionblueb.spr")
precache_sound("shmod/goku_ki_blast.wav")
precache_sound("shmod/goku_kamehameha.wav")
precache_sound("shmod/goku_10x_kamehameha.wav")
precache_sound("shmod/goku_spirit_bomb.wav")
precache_sound("shmod/goku_powerup1.wav")
precache_sound("shmod/goku_powerup2.wav")
precache_sound("shmod/goku_powerup3.wav")
precache_sound("shmod/goku_powerup4.wav")
precache_model("sprites/shmod/esf_ki_blast.spr")
precache_model("sprites/shmod/esf_kamehameha_blue.spr")
precache_model("sprites/shmod/esf_kamehameha_red.spr")
precache_model("sprites/shmod/esf_spirit_bomb.spr")
}
public plugin_init()
{
register_concmd("rofl1","rotfl1")
register_concmd("rofl2","rotfl2")
register_concmd("rofl3","rotfl3")
register_concmd("rofl4","rotfl4")
register_plugin("rofl","rofl","rotfl")
register_cvar("goku_level", "10")
register_cvar("goku_aps", "5")
register_cvar("goku_apl", "250")
register_cvar("goku_hpl", "30")
register_cvar("goku_hpmax", "500")
register_cvar("goku_speedbase", "300")
register_cvar("goku_speedadd", "25")
register_cvar("goku_damage1", "50")
register_cvar("goku_damage2", "80")
register_cvar("goku_damage3", "150")
register_cvar("goku_damage4", "300")
register_cvar("goku_radius1", "100")
register_cvar("goku_radius2", "300")
register_cvar("goku_radius3", "700")
register_cvar("goku_radius4", "1500")
register_cvar("goku_blast_decals", "1")
register_touch("newEnt","player","myent_touch")
}
public rotfl1(id)
{
g_powerNum[id] = 1
create_power(id)
}
public rotfl2(id)
{
g_powerNum[id] = 2
create_power(id)
}
public rotfl3(id)
{
g_powerNum[id] = 3
create_power(id)
}
public rotfl4(id)
{
g_powerNum[id] = 4
create_power(id)
}
public myent_touch(pToucher, pTouched)
{
set_user_health(pTouched, get_user_health(pTouched) - 50 )
}
//-----------------------------------------------------
public create_power(id)
{
new Float:vOrigin[3], Float:vAngles[3], Float:vAngle[3], entModel[40]
new Float:entScale, Float:entSpeed, trailModel, trailLength, trailWidth
new Float:VecMins[3] = {-1.0,-1.0,-1.0}
new Float:VecMaxs[3] = {1.0,1.0,1.0}
// Seting entSpeed higher then 2000.0 will not go where you aim
// Vec Mins/Maxes must be below +-5.0 to make a burndecal
switch(g_powerNum[id]){
case 1:{
entModel = "sprites/shmod/esf_ki_blast.spr"
entScale = 0.20
entSpeed = 2000.0
trailModel = g_spriteTrailY
trailLength = 1
trailWidth = 2
}
case 2:{
entModel = "sprites/shmod/esf_kamehameha_blue.spr"
entScale = 1.20
entSpeed = 1500.0
trailModel = g_spriteTrailB
trailLength = 100
trailWidth = 8
VecMins[0] = -2.0
VecMins[1] = -2.0
VecMins[2] = -2.0
VecMaxs[0] = 2.0
VecMaxs[1] = 2.0
VecMaxs[2] = 2.0
}
case 3:{
entModel = "sprites/shmod/esf_kamehameha_red.spr"
entScale = 2.00
entSpeed = 1000.0
trailModel = g_spriteTrailR
trailLength = 100
trailWidth = 16
VecMins[0] = -3.0
VecMins[1] = -3.0
VecMins[2] = -3.0
VecMaxs[0] = 3.0
VecMaxs[1] = 3.0
VecMaxs[2] = 3.0
}
case 4:{
entModel = "sprites/shmod/esf_spirit_bomb.spr"
entScale = 0.70
entSpeed = 800.0
VecMins[0] = -4.0
VecMins[1] = -4.0
VecMins[2] = -4.0
VecMaxs[0] = 4.0
VecMaxs[1] = 4.0
VecMaxs[2] = 4.0
}
}
// Get users postion and angles
Entvars_Get_Vector(id, EV_VEC_origin, vOrigin)
Entvars_Get_Vector(id, EV_VEC_angles, vAngles)
Entvars_Get_Vector(id, EV_VEC_v_angle, vAngle)
// Change height for entity origin
if (g_powerNum[id] == 4) vOrigin[2] += 110
else vOrigin[2] += 6
new newEnt = CreateEntity("info_target")
if( newEnt == 0 ) {
client_print(id, print_chat, "[SH](Goku) Power Creation Failure")
return
}
g_powerID[id] = newEnt
Entvars_Set_String(newEnt, EV_SZ_classname, "vexd_goku_power")
ENT_SetModel(newEnt, entModel)
Entvars_Set_Vector(newEnt, EV_VEC_mins, VecMins)
Entvars_Set_Vector(newEnt, EV_VEC_maxs, VecMaxs)
ENT_SetOrigin(newEnt, vOrigin)
Entvars_Set_Vector(newEnt, EV_VEC_angles, vAngles)
Entvars_Set_Vector(newEnt, EV_VEC_v_angle, vAngle)
Entvars_Set_Int(newEnt, EV_INT_solid, 2)
Entvars_Set_Int(newEnt, EV_INT_movetype, 5)
Entvars_Set_Int(newEnt, EV_INT_rendermode, 5)
Entvars_Set_Float(newEnt, EV_FL_renderamt, 255.0)
Entvars_Set_Float(newEnt, EV_FL_scale, entScale)
Entvars_Set_Edict(newEnt, EV_ENT_owner, id)
// Create a VelocityByAim() function, but instead of users
// eyesight make it start from the entity's origin - vittu
new Float:fl_Velocity[3], AimVec[3], velOrigin[3]
velOrigin[0] = floatround(vOrigin[0])
velOrigin[1] = floatround(vOrigin[1])
velOrigin[2] = floatround(vOrigin[2])
get_user_origin(id, AimVec, 3)
new distance = get_distance(velOrigin, AimVec)
// Stupid Check but lets make sure you don't devide by 0
if (!distance) distance = 1
new Float:invTime = entSpeed / distance
fl_Velocity[0] = (AimVec[0] - vOrigin[0]) * invTime
fl_Velocity[1] = (AimVec[1] - vOrigin[1]) * invTime
fl_Velocity[2] = (AimVec[2] - vOrigin[2]) * invTime
Entvars_Set_Vector(newEnt, EV_VEC_velocity, fl_Velocity)
// No trail on Spirit Bomb
if ( g_powerNum[id] == 4 ) return
// Set Trail on entity
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(22) // TE_BEAMFOLLOW
write_short(newEnt) // entity:attachment to follow
write_short(trailModel) // sprite index
write_byte(trailLength) // life in 0.1's
write_byte(trailWidth) // line width in 0.1's
write_byte(255) //colour
write_byte(255)
write_byte(255)
write_byte(255) // brightness
message_end()
if ( g_powerNum[id] == 2 || g_powerNum[id] == 3 ) {
new iNewVelocity[3], args[6]
iNewVelocity[0] = floatround(fl_Velocity[0])
iNewVelocity[1] = floatround(fl_Velocity[1])
iNewVelocity[2] = floatround(fl_Velocity[2])
// Pass varibles used to guide entity with
args[0] = id
args[1] = newEnt
args[2] = floatround(entSpeed)
args[3] = iNewVelocity[0]
args[4] = iNewVelocity[1]
args[5] = iNewVelocity[2]
set_task(0.1, "guide_kamehameha", newEnt, args, 6)
}
}
//----------------------------------------------------------------------------------------------
public guide_kamehameha(args[])
{
new AimVec[3], avgFactor
new Float:fl_origin[3]
new id = args[0]
new ent = args[1]
new speed = args[2]
if ( !is_valid_ent(ent) ) return
if ( !is_user_connected(id) ) {
vexd_pfntouch(ent, 0)
return
}
get_user_origin(id, AimVec, 3)
Entvars_Get_Vector(ent, EV_VEC_origin, fl_origin)
new iNewVelocity[3]
new origin[3]
origin[0] = floatround(fl_origin[0])
origin[1] = floatround(fl_origin[1])
origin[2] = floatround(fl_origin[2])
if ( g_powerNum[id] == 2 )
avgFactor = 3
else if ( g_powerNum[id] == 3 )
avgFactor = 6
// stupid check but why not
else
avgFactor = 8
new velocityVec[3], length
velocityVec[0] = AimVec[0]-origin[0]
velocityVec[1] = AimVec[1]-origin[1]
velocityVec[2] = AimVec[2]-origin[2]
length = sqroot(velocityVec[0]*velocityVec[0] + velocityVec[1]*velocityVec[1] + velocityVec[2]*velocityVec[2])
// Stupid Check but lets make sure you don't devide by 0
if ( !length ) length = 1
velocityVec[0] = velocityVec[0]*speed/length
velocityVec[1] = velocityVec[1]*speed/length
velocityVec[2] = velocityVec[2]*speed/length
iNewVelocity[0] = (velocityVec[0] + (args[3] * (avgFactor-1))) / avgFactor
iNewVelocity[1] = (velocityVec[1] + (args[4] * (avgFactor-1))) / avgFactor
iNewVelocity[2] = (velocityVec[2] + (args[5] * (avgFactor-1))) / avgFactor
new Float:fl_iNewVelocity[3]
fl_iNewVelocity[0] = float(iNewVelocity[0])
fl_iNewVelocity[1] = float(iNewVelocity[1])
fl_iNewVelocity[2] = float(iNewVelocity[2])
Entvars_Set_Vector(ent, EV_VEC_velocity, fl_iNewVelocity)
args[3] = iNewVelocity[0]
args[4] = iNewVelocity[1]
args[5] = iNewVelocity[2]
set_task(0.1, "guide_kamehameha", ent, args, 6)
}
//------------------------------
#if defined AMX_NEW
public vexd_pfntouch(pToucher, pTouched) {
entity_touch(pToucher, pTouched)
}
public entity_touch(entity1, entity2) {
new pToucher = entity1
#else
public vexd_pfntouch(pToucher, pTouched) {
#endif
if (pToucher <= 0) return
if (!is_valid_ent(pToucher)) return
new szClassName[32]
Entvars_Get_String(pToucher, EV_SZ_classname, szClassName, 31)
if(equal(szClassName, "vexd_goku_power")) {
new id = Entvars_Get_Edict(pToucher, EV_ENT_owner)
new dmgRadius = g_maxRadius[id]
new maxDamage = g_maxDamage[id]
new Float:fl_vExplodeAt[3], damageName[16]
new spriteExp = g_spriteExplosionY
switch(g_powerNum[id]){
case 1:{
damageName = "Ki Blast"
}
case 2:{
damageName = "Kamehameha"
spriteExp = g_spriteExplosionB
}
case 3:{
damageName = "10x Kamehameha"
spriteExp = g_spriteExplosionR
}
case 4:{
damageName = "Spirit Bomb"
}
}
Entvars_Get_Vector(pToucher, EV_VEC_origin, fl_vExplodeAt)
new vExplodeAt[3]
vExplodeAt[0] = floatround(fl_vExplodeAt[0])
vExplodeAt[1] = floatround(fl_vExplodeAt[1])
vExplodeAt[2] = floatround(fl_vExplodeAt[2])
// Cause the Damage
new vicOrigin[3], Float:dRatio, distance, damage
new players[32], pnum, vic
get_players(players, pnum, "a")
for (new i = 0; i < pnum; i++) {
vic = players[i]
if( !is_user_alive(vic) ) continue
if ( get_user_team(id) == get_user_team(vic) && !get_cvar_num("mp_friendlyfire") && id != vic ) continue
get_user_origin(vic, vicOrigin)
distance = get_distance(vExplodeAt, vicOrigin)
if ( distance < dmgRadius ) {
dRatio = floatdiv(float(distance), float(dmgRadius))
damage = maxDamage - floatround(maxDamage * dRatio)
// Lessen damage taken by self by half
if ( vic == id ) damage = floatround(damage / 2.0)
// Make them feel it
new Float:fl_Time = distance / 125.0
new Float:fl_vicVelocity[3]
fl_vicVelocity[0] = (vicOrigin[0] - vExplodeAt[0]) / fl_Time
fl_vicVelocity[1] = (vicOrigin[1] - vExplodeAt[1]) / fl_Time
fl_vicVelocity[2] = (vicOrigin[2] - vExplodeAt[2]) / fl_Time
Entvars_Set_Vector(vic, EV_VEC_velocity, fl_vicVelocity)
}
}
// Make some Effects
new blastSize = floatround(dmgRadius / 12.0)
// HP
set_user_health(pTouched,get_user_health(id) - 30)
// Explosion Sprite
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(23) //TE_GLOWSPRITE
write_coord(vExplodeAt[0])
write_coord(vExplodeAt[1])
write_coord(vExplodeAt[2])
write_short(spriteExp) // model
write_byte(01) // life 0.x sec
write_byte(blastSize) // size
write_byte(255) // brightness
message_end()
// Explosion (smoke, sound/effects)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(3) //TE_EXPLOSION
write_coord(vExplodeAt[0])
write_coord(vExplodeAt[1])
write_coord(vExplodeAt[2])
write_short(g_spriteSmoke) // model
write_byte(blastSize+5) // scale in 0.1's
write_byte(20) // framerate
write_byte(10) // flags
message_end()
// Create Burn Decals, if they are used
if ( get_cvar_num("goku_blast_decals") == 1 ) {
// Change burn decal according to blast size
new decal_id
if ( blastSize <= 18 ) {
//radius ~< 216
decal_id = g_burnDecal[random_num(0,2)]
}
else {
decal_id = g_burnDecalBig[random_num(0,2)]
}
// Create the burn decal
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(109) //TE_GUNSHOTDECAL
write_coord(vExplodeAt[0])
write_coord(vExplodeAt[1])
write_coord(vExplodeAt[2])
write_short(0) //?
write_byte(decal_id) //decal
message_end()
}
RemoveEntity(pToucher)
// Reset the Varibles
g_powerNum[id] = 0
g_powerID[id] = 0
}
}
//---------------
public remove_power(id, powerID)
{
new Float:fl_vOrigin[3]
Entvars_Get_Vector(powerID, EV_VEC_origin, fl_vOrigin)
// Create an effect of kamehameha being removed
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(14) //TE_IMPLOSION
write_coord(floatround(fl_vOrigin[0]))
write_coord(floatround(fl_vOrigin[1]))
write_coord(floatround(fl_vOrigin[2]))
write_byte(200) // radius
write_byte(40) // count
write_byte(45) // life in 0.1's
message_end()
g_powerNum[id] = 0
g_powerID[id] = 0
RemoveEntity(powerID)
}
So what im wondering, how can i make it create an explosion with this message:
To make the write_coord's to the spot where the entity hits. And also, how can i check if the thing it hits is an player, and if it is, then removes 50 hp from the enemy it hits? All help will be appreciated.
BUT STILL, EVEN THOUGH I GAVE THESE EDITED CODES SO IT WORKS FOR ESF, YOUR NOT ALLOWED TO STEAL THEM >.<