Okay, I debugged pretty much everything, but there is still one thing that doesn't work, and that is the fact that nothing happens when my entity touches the wall!!!! I'm frusterated about this, and really really don't know how to fix this, someone please give me advice on what to do!!! Thank you. Here's a little piece of my code:
Code:
//------------------------------------------------------------------------------------
public plugin_init()
{
register_plugin("SUPERHERO Cell", "1.0", "Gorlag/Batman")
//THE CVARS
register_cvar("cell_level", "1")
register_cvar("cell_damage", "1000")
register_cvar("cell_radius", "50")
register_cvar("cell_cooldown", "50")
register_cvar("cell_diskspeed", "750")
register_cvar("cell_disklife", "50")
register_cvar("cell_blastdecal", "1")
//THIS LINE MAKES THE HERO SELECTABLE
shCreateHero(gHeroName, "Energy Disk", "Unleash an energy disk and take control of where it flies!", true, "cell_level")
//INITIAL ACTIONS
register_srvcmd("cell_init", "cell_init")
shRegHeroInit(gHeroName, "cell_init")
//KEY DOWN COMMAND
register_srvcmd("cell_kd", "cell_kd")
shRegKeyDown(gHeroName, "cell_kd")
//SPAWNING EVENT
register_event("ResetHUD", "newSpawn", "b")
//THIS EVENT IS TRIGGERED WHEN SOMEONE DIES
register_event("DeathMsg", "cell_kill", "a")
//SET THE LIFE OF THE DISK
set_task(0.1, "cell_disklife", 0, "", 0, "b")
//IF "*" is in there then it's a wildcard for any classname in pTouched[]
register_touch("disk", "*", "touch_event")
for(new id = 1; id <= SH_MAXSLOTS; id++)
diskTimer[id] = -1
}
//--------------------------------------------------------------------------------------
public fire_disk(id)
{
//Makes an array of origin in the (x,y,z) coordinate system.
new origin[3]
//Makes an array of velocity, specifically in the (x,y,z) coordinate system
new velocity[3]
get_user_origin(id, origin, 0)
new Float:fOrigin[3], Float:fVelocity[3]
new Float: minBound[3] = {-50.0, -50.0, 0.0}
new Float: maxBound[3] = {50.0, 50.0, 0.0}
origin[2] += 50 //This line is same as origin[2] = origin[2] + 50
IVecFVec(origin, fOrigin)
NewEnt = CreateEntity("info_target") //Makes an object
entity_set_string(NewEnt, EV_SZ_classname, "disk")
//This tells what the object will look like
ENT_SetModel(NewEnt, "models/shmod/friezadisc.mdl")
//This will set the origin of the entity
entity_set_vector(NewEnt, EV_VEC_origin, fOrigin)
//This will set the movetype of the entity
entity_set_int(NewEnt,EV_INT_movetype, MOVETYPE_NOCLIP)
entity_set_int(NewEnt, EV_INT_solid, SOLID_TRIGGER)
//This will set the velocity of the entity
velocity_by_aim(id, get_cvar_num("cell_diskspeed"), fVelocity)
FVecIVec(fVelocity, velocity)
entity_set_size(NewEnt, minBound, maxBound)
entity_set_edict(NewEnt, EV_ENT_owner, id)
//This will set the entity in motion
entity_set_vector(NewEnt, EV_VEC_velocity, fVelocity)
}
//--------------------------------------------------------------------------------------
public touch_event(pToucher, pTouched) //ptr is the toucher, and ptd is the touched!
{
//Checks to make sure that the entity is valid!
if(!is_valid_ent(pToucher) || !is_valid_ent(pTouched))
return PLUGIN_CONTINUE
//Now to deal the damage to the victim (touched) and remove the toucher (the disk)
new resulting_string[32] //Makes a new empty string that will store 31 characters.
//Allows you to retrieve the entity of the toucher, in this case the disk.
entity_get_string(pToucher, EV_SZ_classname, resulting_string, 31)
//Now because the data above is a string, the "==" would not work, when comparing.
//Instead use the equal method.
//Makes sure that the toucher entity is the disk.
if(equal(resulting_string, "disk")){
fake_touch(pToucher, pTouched)
new aimvec[3], Float:fAimvec[3] //This is the position where the disk collides
entity_get_vector(pTouched, EV_VEC_origin, fAimvec)
FVecIVec(fAimvec, aimvec)
special_effects(pToucher, pTouched, aimvec)
}
return PLUGIN_CONTINUE
}
//-----------------------------------------------------------------------------------------
public special_effects(pToucher, pTouched, aimvec[3])
{
new Float:fVelocity[3]
new velocity[3]
new damage
entity_get_vector(pToucher, EV_VEC_velocity, fVelocity)
FVecIVec(fVelocity, velocity)
//Got to know who's the one using the disk
//So that when the victim dies, he knows who's the killer
//That used the disk
new killer = entity_get_edict(pToucher, EV_ENT_owner)
if(is_user_connected(pTouched) && is_user_alive(pTouched)){
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(103) //BLOOD
write_coord(aimvec[0])
write_coord(aimvec[1])
write_coord(aimvec[2])
write_coord(velocity[0])
write_coord(velocity[1])
write_coord(velocity[2])
write_byte(248)
write_byte(100)
message_end()
damage = get_cvar_num("cell_damage")
new victim = pTouched
shExtraDamage(victim, killer, damage, "Frieza's Energy Disk")
}
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(9) //SPARKS
write_coord(aimvec[0])
write_coord(aimvec[1])
write_coord(aimvec[2])
message_end()
}
//-----------------------------------------------------------------------------------------