Raised This Month: $ Target: $400
 0% 

find_ent_by_class doesn't find entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 04-28-2010 , 15:36   find_ent_by_class doesn't find entity
Reply With Quote #1

Im using this code:

PHP Code:
new ent = -1
while((ent find_ent_by_class(ent"soccerjam_teamball")))

Tryed setting a delay with set_task, still doesn't find it, the entity exists 100%. I can find it through pfn_keyvalue using this code:

PHP Code:
public pfn_keyvalue(ent) {

    new 
classname[32], key[32], value[32]
    
copy_keyvalue(classname31key31value31)

    if(
equali(classname"soccerjam_teamball"))
    { 
But I don't know how to loop through all entities the same way like in first example.
BeasT is offline
Send a message via Skype™ to BeasT
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 04-28-2010 , 15:44   Re: find_ent_by_class doesn't find entity
Reply With Quote #2

Quote:
Originally Posted by BeasT View Post
Im using this code:

PHP Code:
new ent = -1
while((ent find_ent_by_class(ent"soccerjam_teamball")))

are you sure that code is being called?
try a register_clcmd() (if you arent allready)
__________________
minimiller is offline
Send a message via MSN to minimiller
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 04-28-2010 , 16:08   Re: find_ent_by_class doesn't find entity
Reply With Quote #3

Yes I'm sure.
BeasT is offline
Send a message via Skype™ to BeasT
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 04-28-2010 , 17:22   Re: find_ent_by_class doesn't find entity
Reply With Quote #4

use something like this to make sure the classname is correct

PHP Code:
/*-----------------------------------------------------------------------------------------------------------------------*/
/* Script forged in the depths of the ocean by Stewie!                                                                   */
/*---------------------------------------------------------------------------------------------------------=[ Stewie! ]=-*/
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

new PLUG[] = "Ents";
new 
VERS[] = "1.0";
new 
AUTH[] = "Stewie!";

public 
plugin_init()
{
    
register_plugin(PLUGVERSAUTH);
    
    
register_clcmd("say /ents""cmdEnts");
}

public 
cmdEnts(id)
{
    new 
szClassname[33], szTarget[33], entbody;
    
    
get_user_aiming(identbody);
    
pev(entpev_classnameszClassname32);
    
client_print(idprint_chat"Classname: %s"szClassname);

__________________
minimiller is offline
Send a message via MSN to minimiller
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 04-29-2010 , 05:29   Re: find_ent_by_class doesn't find entity
Reply With Quote #5

I can't find it with similar tools, the ent is invisible. But I found through bsp viewer:
http://img571.**************/img571/2637/12621719.png
BUT I can't find it with shptools using listent or traceent commands. So I guess it doesn't exist in the game ( no other soccerjam_ent seen on bsp viewer too). And no, there is no plugin that removes it. Tryed with and without main soccerjam plugin. The only ent that appears running the map with soccerjam plugin is soccerjam_goalnet.

Last edited by BeasT; 04-29-2010 at 05:44.
BeasT is offline
Send a message via Skype™ to BeasT
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-29-2010 , 05:53   Re: find_ent_by_class doesn't find entity
Reply With Quote #6

You can't find invisible entities with traceent cmd.
listent should find it though.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-29-2010 , 06:11   Re: find_ent_by_class doesn't find entity
Reply With Quote #7

Entities with invalid classnames in map are being deleted by engine, but still passed trough pfn_keyvalue, you will have to recreate it (info_target for example and then changing pev_classname)
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-29-2010 , 06:20   Re: find_ent_by_class doesn't find entity
Reply With Quote #8

Then just create a info_target (or whatever existing class that is the closer from your entity) and use keyvalue classname to alter it (if you don't want to use a plugin).
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 04-29-2010 , 12:34   Re: find_ent_by_class doesn't find entity
Reply With Quote #9

Recreating the entity works great. Thanks guys.
BeasT is offline
Send a message via Skype™ to BeasT
Reply



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 11:37.


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