• How do I filter only player props in E2?
    8 replies, posted
Hey. I have an E2 for finding entity's that I want but I've been trying to figure out how to filter the search so I only get players and player owned entity's. I had an idea where I would get the names of all the players and then just findInclude in a loop but I cant seem to find the function to get player names. Help?
You want to save props to an array, then loop through, checking Array[I,entity]:owner(). If existant, push to a second array (Array2:pushEntity(Array[I,entity])
Doesn't that just check if each prop has a valid owner? And I would have to write a manual sort by distance.
owner():name() Return's the player's name as a string. However, in that aforementioned for loop you could just check if Prop:owner() = Player, assuming Player is a player entity.
ok so let me get this right. I have an index of entiys that I found already. Now what I believe should be done is: E = findResult(Index) if(E:owner():isPlayer()) {Name = E:name()} elseif(E:owner():isPlayer()) {Index=Index+1} EDIT: Put that in a loop. I forgot. while(E:owner():isPlayer()==0) { E = findResult(Index) if(E:owner():isPlayer()) {Name = E:name()} elseif(E:owner():isPlayer()) {Index=Index+1} }
Uh, in a timer, yes.
[QUOTE=Nikzilla;22006920]ok so let me get this right. I have an index of entiys that I found already. Now what I believe should be done is: E = findResult(Index) if(E:owner():isPlayer()) {Name = E:name()} elseif(E:owner():isPlayer()) {Index=Index+1} EDIT: Put that in a loop. I forgot. while(E:owner():isPlayer()==0) { E = findResult(Index) if(E:owner():isPlayer()) {Name = E:name()} elseif(E:owner():isPlayer()) {Index=Index+1} }[/QUOTE] I can't comprehend this without seeing it in E2. :v:
ok Ill show you the E2 (from memory) @inputs Hold Find @outputs Vec:vector if(Hold) {Lock=1} elseif(Find) {Lock=0} if(Lock==0) { findExcludePlayer(owner()) findExcludePlayerProps(owner()) Found = findInCone(entity():pos(), owner():aimPos(), 999999999999, 20) E = findClosest(entity():pos()) } elseif(Lock) { Vec = E:pos() } and I will include the new code: @inputs Hold Find @outputs Vec:vector Name:string if(Hold) {Lock=1} elseif(Find) {Lock=0} if(Lock==0) { findExcludePlayer(owner()) findExcludePlayerProps(owner()) Found = findInCone(entity():pos(), owner():aimPos(), 999999999999, 20) findSortByDistance(entity():pos()) if(Found>=) { Index=1 Is=0 while(E:owner():isPlayer()==0) { E = findResult(Index) Is = E:owner():isPlayer() if(Is) {Name = E:name()} elseif(Is==0)) {Index=Index+1} } } } elseif(Lock) { Vec = E:pos() }
ok I just added include phys_props and now its totaly fucked: @inputs Hold Find @outputs Vec:vector Name:string if(Hold) {Lock=1} elseif(Find) {Lock=0} if(Lock==0) { findExcludePlayer(owner()) findExcludePlayerProps(owner()) findIncludeClass("phys_props") Found = findInCone(entity():pos(), owner():aimPos(), 999999999999, 20) findSortByDistance(entity():pos()) if(Found>=) { Index=1 Is=0 while(E:owner():isPlayer()==0) { E = findResult(Index) Is = E:owner():isPlayer() if(Is) {Name = E:name()} elseif(Is==0)) {Index=Index+1} } } } elseif(Lock) { Vec = E:pos() }
Sorry, you need to Log In to post a reply to this thread.