Raised This Month: $51 Target: $400
 12% 

Entity Name ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alex30555
Member
Join Date: Sep 2011
Location: Paris
Old 05-21-2013 , 05:47   Entity Name ?
Reply With Quote #1

Hello

I post for my code

I want to recup the targetname of entity

So my code doesn't wok :

PHP Code:
public OnStartTouch(entclient)
{    
    
AcceptEntityInput(ent"Kill");
    
EmitSoundToClient(clientSOUND);

    
decl String:ent_name[32];
    
GetEntPropString(entProp_Data"m_iName"ent_namesizeof(ent_name));
    
    
CPrintToChat(client"===> %d"ent_name);

Ideas ?

Thanks for Help.
Alex30555 is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 05-21-2013 , 06:36   Re: Entity Name ?
Reply With Quote #2

GetEdictClassname(ent, ent_name, sizeof(ent_name));

and your code need
PHP Code:
public OnStartTouch(entclient)
{
    
decl String:ent_name[32];
    
GetEdictClassname(entent_namesizeof(ent_name));

    
AcceptEntityInput(ent"Kill");
    
EmitSoundToClient(clientSOUND);

    
// %d is an integer, not string
    
CPrintToChat(client"===> %s"ent_name);

__________________
sorry, for my poor english.

Last edited by mcpan313; 05-21-2013 at 06:40.
mcpan313 is offline
Send a message via MSN to mcpan313
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 05-21-2013 , 13:20   Re: Entity Name ?
Reply With Quote #3

If you want the entity's targetname, just get m_iName as you did before, but as mcpan said, use %s, not %d, as it's a string.
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
Alex30555
Member
Join Date: Sep 2011
Location: Paris
Old 05-22-2013 , 09:55   Re: Entity Name ?
Reply With Quote #4

Yep Thanks

I ve mad %s because my first code :

PHP Code:
public OnStartTouch(entclient)
{
    
entity[client] = GetEdictClassname(entent_namesizeof(ent_name));
    
CPrintToChat(client"===> %d"entity[client]);

So it's work now Thanks

Last edited by Alex30555; 05-22-2013 at 09:55.
Alex30555 is offline
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:52.


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