Raised This Month: $ Target: $400
 0% 

Solved Dynamic Array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
soumyadip77
Senior Member
Join Date: Jul 2017
Location: INDIA,KOLKATA
Old 08-15-2018 , 22:33   Re: Dynamic Array
Reply With Quote #1

here i tried 1 more time and still error some one help
PHP Code:
/* Sublime AMXX Editor v2.2 */

#include <amxmodx>
#include <amxmisc>


#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

#define CONFIG_FILE "song.ini"

new Array: ready_sound;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd("say /t1""play")
}

public 
plugin_precache()
{
    
ready_sound ArrayCreate(641)

    new 
ibuffer[128], temp_string[256]

    for(
0ArraySize(ready_sound); i++)
    {
        
ArrayGetString(ready_sounditemp_stringsizeof(temp_string))

        
format(buffercharsmax(buffer), "sound/%s"temp_string)
        
precache_generic(buffer)

    }
}

public 
load_config_file()
{
    
// Build customization file path
    
new path[64]
    
get_configsdir(pathcharsmax(path))
    
format(pathcharsmax(path), "%s/%s"pathCONFIG_FILE)

    
// File not present
    
if (!file_exists(path))
    {
        return;
    }

    
// Set up some vars to hold parsing info
    
new linedata[1024], key[64], value[960]
    
// Open customization file for reading
    
new file fopen(path"rt")

    while (
file && !feof(file))
    {
        
// Read one line at a time
        
fgets(filelinedatacharsmax(linedata))

        
// Blank line or comment
        
if (!linedata[0] || linedata[0] == ';') continue;

        
// Get key and value(s)
        
strtok(linedatakeycharsmax(key), valuecharsmax(value), '=')

        
// Trim spaces
        
trim(key)
        
trim(value)


        if (
equal(key"START"))
        {
            
// Parse weapons
            
while (value[0] != && strtok(valuekeycharsmax(key), valuecharsmax(value), ','))
            {
            
// Trim spaces
                
trim(key)
                
trim(value)

                
// Add to weapons array
                
ArrayPushString(ready_soundkey)
            }
        }
    }
}

public 
play()
{
    static 
temp_string[128]
    
ArrayGetString(ready_soundArraySize(ready_sound), temp_stringsizeof(temp_string))

    
client_print(0print_chat"song path %s"temp_string)

    
client_cmd(0"mp3 play ^"sound/%s^""temp_string)
}

public 
plugin_end()
{
    
ArrayDestroy(ready_sound);

PHP Code:
L 08/16/2018 08:02:32Start of error session.
L 08/16/2018 08:02:32Info (map "de_dust2") (file "addons/amxmodx/logs/error_20180816.log")
L 08/16/2018 08:02:32Invalid index 0 (count0)
L 08/16/2018 08:02:32: [AMXXDisplaying debug trace (plugin "test_array.amxx"version "1.0")
L 08/16/2018 08:02:32: [AMXXRun time error 10native error (native "ArrayGetString")
L 08/16/2018 08:02:32: [AMXX]    [0test_array.sma::play (line 91
soumyadip77 is offline
Send a message via Skype™ to soumyadip77
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 12:13.


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