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

SetTrieArray() not accepting any parameter for argument 3


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
teigrgwyn
Junior Member
Join Date: Jan 2016
Location: California
Old 03-23-2017 , 13:09   SetTrieArray() not accepting any parameter for argument 3
Reply With Quote #1

It doesn't matter if I replace sizeof() with an int such as 2. It's constantly giving me "argument type mismatch (argument 3)". I tried a singular array and checked to make sure it required int, and it still returns same error.
PHP Code:
public Action Command_RestrictConvar(int i_Arguments)
{
    if (
i_Arguments != 3) {
        return 
Plugin_Handled;
    }

    
char c_RestrictedConvar[3][8];

    
// add the convar parameters to an array
    
GetCmdArg(2c_RestrictedConvar[0], sizeof(c_RestrictedConvar[][]));
    
GetCmdArg(3c_RestrictedConvar[1], sizeof(c_RestrictedConvar[][]));

    
SetTrieArray(h_RestrictedConvarsc_RestrictedConvar[0][0], sizeof(c_RestrictedConvar[][]));

    return 
Plugin_Handled;

teigrgwyn is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 03-23-2017 , 13:17   Re: SetTrieArray() not accepting any parameter for argument 3
Reply With Quote #2

I think you are thinking of using something else, SetTrieArray is to put arrays under a stringmap.
https://sm.alliedmods.net/new-api/adt_trie/SetTrieArray
The 3rd element is an array, not an int.
Mitchell is offline
teigrgwyn
Junior Member
Join Date: Jan 2016
Location: California
Old 03-23-2017 , 16:51   Re: SetTrieArray() not accepting any parameter for argument 3
Reply With Quote #3

No, I just consistently overlooked the key parameter.

I'm just adding a min and max float value to a small array that will fall under a key that I can then search for later.
Seeing that I need to loop it, it looks like I'll have to use a dynamic array.

It's telling me on PushArrayArray() that the arrays don't match... error 048. I've added [] and [0] to the end and tried a few different things, but can't figure out why. :\
Using a non-multidimensional array, it tells me that the storage types differ and that it can't coerce char[] to any[].

PHP Code:
Handle h_RestrictedConvars;

public 
void OnPluginStart()
{
    
RegServerCmd("sm_test"Command_RestrictConvar);
    
h_RestrictedConvars CreateArray(3);
}

public 
Action Command_RestrictConvar(int i_Arguments)
{
    if (
i_Arguments != 3) {
        return 
Plugin_Handled;
    }

    
char c_RestrictedConvar[4][64];

    
// add the convar parameters to an array
    
GetCmdArg(1c_RestrictedConvar[0], sizeof(c_RestrictedConvar[]));
    
GetCmdArg(2c_RestrictedConvar[1], sizeof(c_RestrictedConvar[]));
    
GetCmdArg(3c_RestrictedConvar[2], sizeof(c_RestrictedConvar[]));

    
PushArrayArray(h_RestrictedConvarsc_RestrictedConvar);

    return 
Plugin_Handled;


Last edited by teigrgwyn; 03-23-2017 at 17:22.
teigrgwyn is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 03-24-2017 , 07:49   Re: SetTrieArray() not accepting any parameter for argument 3
Reply With Quote #4

As you seem to have already realized, in neither example were you passing a 1D array (even ignoring missing the key for SetTrieArray). In your second, passing c_RestrictedConvar[x] would have worked, except it's a string.

If you're specifically using strings (or char[] in the newer syntax), you need to use PushArrayString.
Fyren 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:40.


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