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

Add to array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dataviruset
AlliedModders Donor
Join Date: Feb 2009
Location: Hong Kong
Old 10-26-2009 , 13:34   Add to array
Reply With Quote #1

Is it impossible to do such a thing?
Like...
PHP Code:
if (GetConVarInt(sm_hosties_knife_enable))
    
LRsenabledsizeof(LRsenabled) ] = 0;
if (
GetConVarInt(sm_hosties_s4s_enable))
    
LRsenabledsizeof(LRsenabled) ] = 1;
if (
GetConVarInt(sm_hosties_guntoss_enable))
    
LRsenabledsizeof(LRsenabled) ] = 2;
if (
GetConVarInt(sm_hosties_chickenfight_enable))
    
LRsenabledsizeof(LRsenabled) ] = 3
In PHP it was possible to do this...
PHP Code:
if (GetConVarInt(sm_hosties_knife_enable))
    
LRsenabled[] = 0;
if (
GetConVarInt(sm_hosties_s4s_enable))
    
LRsenabled[] = 1;
if (
GetConVarInt(sm_hosties_guntoss_enable))
    
LRsenabled[] = 2;
if (
GetConVarInt(sm_hosties_chickenfight_enable))
    
LRsenabled[] = 3
dataviruset is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 10-26-2009 , 13:38   Re: Add to array
Reply With Quote #2

Use Adt arrays for this.
CreateArray
PushArrayCell
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
dataviruset
AlliedModders Donor
Join Date: Feb 2009
Location: Hong Kong
Old 10-26-2009 , 13:42   Re: Add to array
Reply With Quote #3

Argh. Me not like.
Err. Last time I tried out adt_arrays I failed, how do I do?

EDIT: Okay, I found some info here, thanks for the help

Last edited by dataviruset; 10-26-2009 at 14:25.
dataviruset is offline
dataviruset
AlliedModders Donor
Join Date: Feb 2009
Location: Hong Kong
Old 10-26-2009 , 14:54   Re: Add to array
Reply With Quote #4

Is it PushArrayCell I'm going to use when I should add some value at the "bottom" of the array? I can't get this to work -.-

PHP Code:
new Handle:LRsenabled;

public 
OnPluginStart()
{
    
LRsenabled CreateArray(2);
    if (
GetConVarInt(sm_hosties_knife_enable))
        
PushArrayCell(LRsenabled0);
    if (
GetConVarInt(sm_hosties_s4s_enable))
        
PushArrayCell(LRsenabled1);
    if (
GetConVarInt(sm_hosties_guntoss_enable))
        
PushArrayCell(LRsenabled2);
    if (
GetConVarInt(sm_hosties_chickenfight_enable))
        
PushArrayCell(LRsenabled3);
}

public 
Action:Command_LastRequest(clientargs)
{
    
// ...  GetArrayCell(LRsenabled, 0);

EDIT: Am I doing some obvious mistake? There's something wrong when I get the data back out from the array like the commented out line. It doesn't work :/
EDIT 2: I've found out that the problem hasn't got to do with this. Thanks for the help I got ;D

Last edited by dataviruset; 10-27-2009 at 18:29.
dataviruset 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:03.


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