Raised This Month: $ Target: $400
 0% 

Ent[33] Don't work -> Need Array help, or someting like that.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 05-17-2010 , 14:47   Ent[33] Don't work -> Need Array help, or someting like that.
Reply With Quote #1

So:

I tryed with: Ent[ent] = 1
But: Wrecked_ said: [33] is only for Players.

So can somoene make an example or say how I need make it then?
With Array:ent or something he said, I dunno.


Thanks!
__________________
Retired.
Xalus is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-17-2010 , 14:51   Re: Ent[33] Don't work -> Need Array help, or someting like that.
Reply With Quote #2

You want an array that uses entities to index it?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 05-17-2010 , 14:52   Re: Ent[33] Don't work -> Need Array help, or someting like that.
Reply With Quote #3

ye I think xD

Ent = ArrayCreate()

Wrecked said something like that
__________________
Retired.
Xalus is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-17-2010 , 14:55   Re: Ent[33] Don't work -> Need Array help, or someting like that.
Reply With Quote #4

It's not smart to have an array to be indexed by entities, since entity indexes can range to 2000 or more.

It would be better to use special entity values, like pev_[i|f|v|e]user[1|2|3|4].
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 05-17-2010 , 14:56   Re: Ent[33] Don't work -> Need Array help, or someting like that.
Reply With Quote #5

ye but I need set the Target of the button to 1
so: ent[target] 1

That don't work with pevs?
__________________
Retired.
Xalus is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-17-2010 , 15:00   Re: Ent[33] Don't work -> Need Array help, or someting like that.
Reply With Quote #6

Describe what you are trying to do in the plugin instead of this simple array so we can discuss solutions from better understanding the situation.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 05-17-2010 , 15:04   Re: Ent[33] Don't work -> Need Array help, or someting like that.
Reply With Quote #7

Quote:
Originally Posted by Xalus View Post
But: Wrecked_ said: [33] is only for Players.
wrong
__________________
I am out of order!
grimvh2 is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 05-17-2010 , 15:47   Re: Ent[33] Don't work -> Need Array help, or someting like that.
Reply With Quote #8

I tested it with 33,

First buttons worked, en the rest not
__________________
Retired.
Xalus is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 05-17-2010 , 17:22   Re: Ent[33] Don't work -> Need Array help, or someting like that.
Reply With Quote #9

Quote:
Originally Posted by Xalus View Post
ye I think xD

Ent = ArrayCreate()

Wrecked said something like that
Check cellarray.inc in your scripting/include folder.

Or you can use something like this:
PHP Code:
#define MAX_BUTTONS 30

new g_list[MAX_BUTTONS]
new 
g_list_num
new g_target[MAX_BUTTONS]

public 
set_button_target(ent_idtarget_id){
    for(new 
i=0i<g_list_numi++){
        if(
g_list[i] != ent_id)
            continue
        
g_target[i] = target_id
        
return
    }
    if(
g_list_num>=MAX_BUTTONS)
        return
    
g_targetg_list_num ] = target_id
    g_list
g_list_num++ ] = ent_id
}


public 
del_button(ent_id){
    if(
g_list_num<=0)
        return
    for(new 
i=0i<g_list_numi++){
        if(
g_list[i] != ent_id)
            continue
        
g_target[i] = g_target[ --g_list_num ]
        
g_list[i] = g_listg_list_num ]
        return
    }
}


public 
get_button_target(ent_id){
    if(
g_list_num<=0)
        return -
1
    
for(new i=0i<g_list_numi++){
        if(
g_list[i] != ent_id)
            continue
        return 
g_target[i]
    }
    return -
1

__________________
Impossible is Nothing
Sylwester is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-17-2010 , 17:59   Re: Ent[33] Don't work -> Need Array help, or someting like that.
Reply With Quote #10

@Sylwester
There is no reason for something like that.
Like I said, the pev values would be best for this situation.

Code:
#include < engine > const buttonval_target = EV_INT_iuser1; const buttonval_button = EV_INT_iuser2; set_button_target( iButton, iTarget ) {     new iOldTarget = entity_get_int( iButton, buttonval_target );         if( iOldTarget     &&  is_valid_ent( iOldTarget )     &&  entity_get_int( iOldTarget, buttonval_button ) == iButton )     {         entity_set_int( iOldTarget, buttonval_button, 0 );     }         entity_set_int( iButton, buttonval_target, iTarget );     entity_set_int( iTarget, buttonval_button, iButton ); } del_button( iButton ) {     new iTarget = entity_get_int( iButton, buttonval_target );         if( iTarget )     {         if( is_valid_ent( iTarget )         &&  entity_get_int( iTarget, buttonval_button ) == iButton )         {             entity_set_int( iTarget, buttonval_button, 0 );         }                 entity_set_int( iButton, buttonval_target, 0 );     } } get_button_target( iButton ) {     return entity_get_int( iButton, buttonval_target ); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 03:34.


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