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

Pass an array to a function


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Drimacus
Member
Join Date: Jun 2011
Old 02-22-2024 , 14:05   Pass an array to a function
Reply With Quote #1

Hello!
How do you pass an array with other variables?
The code below does not work. This is my vision.
PHP Code:
public Action Test(clientargs)
{
    
MyFunc(MyArray"sound/hit/""kevlar"); // How do you pass an array with other variables?
}

void MyFunc(const array[], char sPathFiltr)
{
    new 
Handle:dir;

    if ((
dir OpenDirectory(sPath)))
    {
        
char name[128];
        
char path[PLATFORM_MAX_PATH];
        new 
FileType:type;

        while (
ReadDirEntry(dirname128type))
        {
            if (
type == FileType_File)
            {
                if (
StrEqual(name[strlen(name) - 4], ".wav"false) || (StrEqual(name[strlen(name) - 4], ".mp3"false)))
                {
                    if (
StrContains(nameFiltrfalse) != -1)
                    {
                        
FormatEx(pathsizeof(path), "%s/%s"sPathname);
                        array.
PushString(path);
                    }
                }
            }
        }
        
CloseHandle(dir);
    }
    else
        
LogError("Failed to open directory: %s"sPath);

Drimacus is offline
 



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 18:53.


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