AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to get function from module, not plugin ?? (https://forums.alliedmods.net/showthread.php?t=100969)

maslyak 08-19-2009 14:27

how to get function from module, not plugin ??
 
Hi, i am created th function

Code:

public SQL_ReadResult_assoc(Handle:query,  field[], {Float,_}:...)
{
        new status = callfunc_begin("SQL_ReadResult")
        log_amx("SQL_ReadResult returns %d", status)
        callfunc_push_int(getarg(0)) // hack, i don't know how to convert to int query :(
        param_convert(2)
        callfunc_push_str(field)
        if(numargs() == 3)
        {
                callfunc_push_float(float(getarg(2)))
        }
        else if(numargs() == 4)
        {
                static buildString[128];
                param_convert(3)
               
                new j = 0;
                while(getarg(2,j))
                {
                        buildString[j] = getarg(2,j);
                        j++;
                }
                buildString[j] = 0; // finish string
               
                callfunc_push_str(buildString)
                callfunc_push_int(getarg(3))
        }
        return callfunc_end()
}


but it can't find the function in callfunc_begin("SQL_ReadResult"). I know that there is not SQL_ReadResult in any plugin, its in a module :)
By the way i want to read results in SQL accosiated with names and think that only way is to write a C++ module. Is it right that in amxx you can't execute the module function with variable arguments ?

maslyak 08-19-2009 16:33

Re: how to get function from module, not plugin ??
 
or why this doens't work ?
Code:

public SQL_ReadResult_assoc(Handle:query,  field[], {Float,_}:...)
{
        if(numargs() == 2)
                return SQL_ReadResult(query,  SQL_FieldNameToNum(query, field))
        else if(numargs() == 3)
        {
                return SQL_ReadResult(query, SQL_FieldNameToNum(query, field), getarg(2))
        }
       
        return SQL_ReadResult(query, SQL_FieldNameToNum(query, field), getarg(2), getarg(3))
}

the problem is in getarg()


All times are GMT -4. The time now is 15:10.

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