Raised This Month: $32 Target: $400
 8% 

[CS:S] Entity Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Razmo51
Senior Member
Join Date: Aug 2011
Location: Event "player_death
Old 10-05-2012 , 12:43   [CS:S] Entity Problem
Reply With Quote #1

Hello

I'm trying to make an array who's referencing all button in a map, and at each round apply an action of each button;

I know that Entity index changes in some map (like deathrun map), so how can I reference button dynamicly ?

I tried at each start of the round
Code:
FindEntityByClassname(entindex, "func_button")
but it is lagguy (because I apply some of code of each button

I tried with
Code:
EntRefToEntIndex
and
Code:
EntIndexToEntRef
but the Ref of the same button changes at each round too ;(

Can I have more explanation of the 2 function just above (Ref) ? or is there an other solution ?

OS: Linux
Game: CS:S

Thanks
__________________
Sorry for my bad English, I'm Belgian
Razmo51 is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 10-05-2012 , 12:51   Re: [CS:S] Entity Problem
Reply With Quote #2

FindEntityByClassname is the best way.
__________________
FaTony is offline
Razmo51
Senior Member
Join Date: Aug 2011
Location: Event "player_death
Old 10-05-2012 , 17:32   Re: [CS:S] Entity Problem
Reply With Quote #3

shit ;(

thanks for answer
__________________
Sorry for my bad English, I'm Belgian
Razmo51 is offline
DaFox
Senior Member
Join Date: Mar 2005
Old 10-06-2012 , 12:03   Re: [CS:S] Entity Problem
Reply With Quote #4

The problem is, in CS:S (and other games). After the round ends, all entities are deleted and recreated. That's why you lose your References. You will need to apply the code at the start of each round anyway.
__________________
Quote:
Originally Posted by Peoples Army
your from Finland? what country is that in?
DaFox is offline
delachambre
AlliedModders Donor
Join Date: Jan 2011
Location: France
Old 10-07-2012 , 03:33   Re: [CS:S] Entity Problem
Reply With Quote #5

Trying to make an area and you check if the door is in the area, because normally the coordinates of the area never changes.
__________________
♥ 𝕊ℙ𝕒𝕨𝕟 𝔻𝕖𝕧𝕖𝕝𝕠𝕡𝕖𝕣 [ℂ𝕊:𝕊] ♥

Clan-Nemesis

Last edited by delachambre; 10-07-2012 at 03:33.
delachambre is offline
_Steven_
Member
Join Date: Mar 2012
Old 10-07-2012 , 04:54   Re: [CS:S] Entity Problem
Reply With Quote #6

Quote:
Originally Posted by delachambre View Post
Trying to make an area and you check if the door is in the area, because normally the coordinates of the area never changes.
Please, read again the first post.

He's not looking for that.
He never talk about any door

Quote:
I'm trying to make an array who's referencing all button in a map, and at each round apply an action of each button;

I know that Entity index changes in some map (like deathrun map), so how can I reference button dynamicly ?
By the way problem solved.

Last edited by _Steven_; 10-07-2012 at 06:19.
_Steven_ is offline
Razmo51
Senior Member
Join Date: Aug 2011
Location: Event "player_death
Old 10-07-2012 , 06:22   Re: [CS:S] Entity Problem
Reply With Quote #7

yeah, solved using

Code:
HookEntityOutput("func_button","OnIn",OnIn);
__________________
Sorry for my bad English, I'm Belgian
Razmo51 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-07-2012 , 06:37   Re: [CS:S] Entity Problem
Reply With Quote #8

...if button have own "targetname"
PHP Code:
GetEntPropString(entProp_Data"m_iName"clsnamesizeof(clsname)); 
Bacardi is offline
Razmo51
Senior Member
Join Date: Aug 2011
Location: Event "player_death
Old 10-07-2012 , 06:55   Re: [CS:S] Entity Problem
Reply With Quote #9

Quote:
Originally Posted by Bacardi View Post
...if button have own "targetname"
PHP Code:
GetEntPropString(entProp_Data"m_iName"clsnamesizeof(clsname)); 
that's not the prob, with this funct I need too do a while referencing all the func_button, with the code above, Its perfect, I do my things after using the button.
__________________
Sorry for my bad English, I'm Belgian
Razmo51 is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 10-07-2012 , 09:20   Re: [CS:S] Entity Problem
Reply With Quote #10

Quote:
Originally Posted by Bacardi View Post
...if button have own "targetname"
PHP Code:
GetEntPropString(entProp_Data"m_iName"clsnamesizeof(clsname)); 
Or use smlib which have this and lots of other useful stocks.
__________________
FaTony is offline
Reply


Thread Tools
Display Modes

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 06:02.


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