Raised This Month: $ Target: $400
 0% 

[CS] Find entity if it is within the radius and apply damage


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Rirre
Veteran Member
Join Date: Nov 2006
Old 08-29-2013 , 17:56   Re: [CS] Find entity if it is within the radius and apply damage
Reply With Quote #7


Code:
public M203_Nade_Touch(nade, idOther) {     new walls[64], monster, Float:takedamage, Float:dist, Float:origin[3], Float:monsterAbsMax[3], Float:monsterAbsMin[3], Float:monsterOrigin[3], owner = entity_get_edict(nade, EV_ENT_owner), Float:dRatio, Float:damage, frag = 1, monmodel[31], maxdamage = get_cvar_num("amx_m203dmg"), dmgradius = get_cvar_num("amx_m203rad") // warning 213: tag mismatch     new wallsnum = find_sphere_class(nade, MONSTER_CLASS, dmgradius, walls, sizeof(walls))  // warning 213: tag mismatch (2x times)     entity_get_vector(nade, EV_VEC_origin, origin)     entity_get_string(monster, EV_SZ_model, monmodel, 30)     for(--wallsnum; wallsnum>=0; wallsnum--)     {         monster = walls[ wallsnum ]         if( IsEntMonster(monster, false) )         {             entity_get_float(monster, EV_FL_takedamage, takedamage) // error 088: number of arguments does not match definition             if( takedamage != DAMAGE_NO && pev(monster, pev_deadflag) != DEAD_DEAD)             {                 entity_get_vector(monster, EV_VEC_absmin, monsterAbsMin)                 entity_get_vector(monster, EV_VEC_absmax, monsterAbsMin)                 xs_vec_sub(monsterAbsMax, monsterAbsMin, monsterOrigin)                 dist = get_distance_f(origin, monsterOrigin)                 dRatio = dmgradius / dist                 damage = maxdamage - floatround( dRatio * maxdamage ) // this line                 // do damage                 set_pev(monster, pev_dmg_inflictor, owner) // to this line > warning 213: tag mismatch                 new Float:health                 pev(monster, pev_health, health)                 health -= damage                 set_pev(monster, pev_health, health)                 if(health <= 0.0)                 {                     ExecuteHamB(Ham_AddPoints, owner, frag, true)                 }             }         }     }     new players[32], pnum, id     find_sphere_class(nade, "player", dmgradius, players, sizeof(players)) // warning 213: tag mismatch     for(--pnum; pnum >= 0; pnum--)     {         id = players[pnum];         if( is_user_alive(id) && !get_user_godmode(id) )         {             dist = entity_range(nade, id)             // do damage, screenshake etc..             ScreenShake(id) // screen shakes for everyone             if(id == owner)             {                 do_damage(owner, damage) // warning 213: tag mismatch                 set_velocity_from_origin(owner, nade, get_cvar_float("amx_m203conc")*damage) // error 035: argument type mismatch (argument 2)             }         }     }     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)     write_byte(TE_EXPLOSION)     write_coord(origin[0]) // warning 213: tag mismatch     write_coord(origin[1]) // warning 213: tag mismatch     write_coord(origin[2] + 30) // warning 213: tag mismatch     write_short(g_sModelIndexFireball)     write_byte(30)     write_byte(15)     write_byte(TE_EXPLFLAG_NONE)     message_end()     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)     write_byte(TE_WORLDDECAL)     write_coord(origin[0]) // warning 213: tag mismatch     write_coord(origin[1]) // warning 213: tag mismatch     write_coord(origin[2]) // warning 213: tag mismatch     write_byte(g_iDecal)     message_end()     remove_entity(nade)     return PLUGIN_HANDLED } bool:IsEntMonster(ent, bool:bCheckClassName) {     if( bCheckClassName )     {         static class[]         entity_get_string(ent, EV_SZ_classname, class, charsmax(class)) // 4 errors, listed below         if( !equal(class, MONSTER_CLASS) )         {             return false         }     }     return !!(entity_get_int(ent, EV_INT_flags) & FL_MONSTER) }
Code:
error 009: invalid array size (negative or zero)
error 017: undefined symbol "class"
error 072: "sizeof" operator is invalid on "function" symbols
fatal error 107: too many error messages on one line

Last edited by Rirre; 08-30-2013 at 18:56.
Rirre is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode