Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › Help › Scripting Help › non-player-entity can see player-entity
12 posts, 2 people · 1,687 views Thread Rating: ★★★★★
closednon-player-entity can see player-entity
Started by ghzero on 04-06-2009, 01:14 PM
ghzero
started this thread
Posts: 160
Threads: 42
Joined: Sep 2007
04-06-2009, 01:14 PM #1

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..

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
04-06-2009, 03:41 PM #2

see?? do you mean like bounce off they collide or?

ghzero
started this thread
Posts: 160
Threads: 42
Joined: Sep 2007
04-07-2009, 04:52 AM #3

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..)

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
04-09-2009, 09:31 AM #4

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...

ghzero
started this thread
Posts: 160
Threads: 42
Joined: Sep 2007
04-09-2009, 12:59 PM #5

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..

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
04-09-2009, 01:50 PM #6

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 rendering

ghzero
started this thread
Posts: 160
Threads: 42
Joined: Sep 2007
04-10-2009, 09:59 AM #7

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..rnrnrnrn

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
04-10-2009, 11:55 AM #8

nice drawings lol, forget what i sayed wont help ya.... i dont get why you want anything like that....rnrn

ghzero
started this thread
Posts: 160
Threads: 42
Joined: Sep 2007
04-10-2009, 02:43 PM #9

:-)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() ! :(

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
04-10-2009, 03:54 PM #10

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.....rnrnrn
stock 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:rn
if( fm_is_ent_classname(inflictor, "THE_CLASSNAME") .....
rnrnalso i would think this would be the way to get rid of the bazooka bug aswell....

ghzero
started this thread
Posts: 160
Threads: 42
Joined: Sep 2007
04-11-2009, 06:25 AM #11

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.

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
04-14-2009, 12:38 PM #12

Then try engine:rnrn

//SDK function - checks if an entity is visible to an entityrnrnnative is_visible(entity, target);
Archive › Old Forum Threads › Help › Scripting Help › non-player-entity can see player-entity
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC