| closednon-player-entity can see player-entity |
| Started by ghzero on 04-06-2009, 01:14 PM |
Threads: 42
Joined: Sep 2007
hello,rnrnhow to check if an entity (none player entity) can see an player ?!rnrnwith :rnif( ExecuteHam( Ham_FVisible, inflictor, id ) )rnrnit do not works by grenade-entity - it alltimes do not see the player..
Threads: 75
Joined: Nov 2007
see?? do you mean like bounce off they collide or?
Threads: 42
Joined: Sep 2007
no, it is just for checking in hamdamage-forward to cancel damages from grenades that the player can not see. (an simplyfied grenade-fix)rnrn(I'll try to use another origin based check from ham.. ..and will tell if that works..)
Threads: 75
Joined: Nov 2007
i would make sure that the grenade entity is visible when its made, so just use the grenade throw forward and set the rendering or what have to be done there...
Threads: 42
Joined: Sep 2007
okay, the logic is maybe: if grenade explode and do damage to player, the entity is still exists in HAM but the:rnif( ExecuteHam( Ham_FVisible, nadeid, playerid ) )rnrnwill even result false because the grenade is not really visible at this point (it is exploded!).rnrnthe solution : do that check alltimes after grenade_throw by tasks will do some stress to cpu/engine - that is I dont like. rnso the only clean way is to check the player to origin by HAM - I haven't test this yet but give it a try..
Threads: 75
Joined: Nov 2007
that wont stess the cpu. Bad codeing is the worst source for high cpu time. a plugin for setting the rendering as it should would be very simple. something like this:rnrn
#include <amxmodx>rn#include <fakemeta>rn#include <dodx>rnrnpublic plugin_init() rn{rn register_plugin(ivn, 1.0, Dr.G)rn}rnrnpublic grenade_throw( index, greindex, wId ) rn{rn set_pev(greindex, pev_rendermode, 1)rn}rnrni didnt test it tho, i dont know anything about the renderingThreads: 42
Joined: Sep 2007
hello,rnI do not understand!rnsetting rendering will solve that an grenadeentity is visible in HAM to check the player to entity visiblity ?rnrnwhat i wanna do is an plugin like the plugin nowalldamage (it check at damage the possible of visual contact betwen attacker and victim, if attacker can not see the victim the damage will not done)for grenades , so if the grenade can not ,,see,, you the damage will not done.rnrnlet me give pictures that shows you how it should works..rnrn
rnrn
Threads: 75
Joined: Nov 2007
nice drawings lol, forget what i sayed wont help ya.... i dont get why you want anything like that....rnrn
Threads: 42
Joined: Sep 2007
:-)rnrnreason is simple: a grenade that explode at an place from that the player is NOT visible should not damage the player. but the base of this plugin is an possible check for that situation!rnrnI tried the Ham_FVecVisible-function :rnnew Float:nadeorigin[3]rnpev(inflictor, pev_origin, nadeorigin)rnif( !ExecuteHam(Ham_FVecVisible, id, nadeorigin) )rn..rnrnBUT hl.exe hangs up by executeham() ! :(
Threads: 75
Joined: Nov 2007
if you do not use Ham right it will fuck up thats for sure... well it should be something like this then:rnrn
public plugin_init()rnRegisterHam( Ham_TakeDamage, "player", "fwd_takedamage" )rnrnrnpublic fwd_takedamage(victim, inflictor, iAttacker, Float:damage, damagebits)rn{ rn if(!(damagebits & DMG_BLAST))rn return HAM_IGNOREDrn rn if(ExecuteHam( Ham_FVisible, iAttacker, victim))rn return HAM_IGNOREDrn rn return HAM_SUPERCEDErn}rnrnrn[edit]rnDMG_BLAST might not be the best btw... check inflictor classname.....rnrnrnstock bool:fm_is_ent_classname(index, const classname[]) {rn if (!pev_valid(index))rn return false;rnrn new class[32];rn pev(index, pev_classname, class, sizeof class - 1);rn if (equal(class, classname))rn return true;rnrn return false;rn}rnrnthen just:rnif( fm_is_ent_classname(inflictor, "THE_CLASSNAME") .....rnrnalso i would think this would be the way to get rid of the bazooka bug aswell....Threads: 42
Joined: Sep 2007
yes, I know that, but the problem is that I need not an:rnrnif(ExecuteHam( Ham_FVisible, iAttacker, victim)) rnrninstead I need:rnif(ExecuteHam( Ham_FVisible, inflictor, victim)) rnrnBUT this Ham_FVisible-Check return allways false.
Threads: 75
Joined: Nov 2007
Then try engine:rnrn
//SDK function - checks if an entity is visible to an entityrnrnnative is_visible(entity, target);

