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

ARRAY


Post New Thread Reply   
 
Thread Tools Display Modes
soumyadip77
Senior Member
Join Date: Jul 2017
Location: INDIA,KOLKATA
Old 06-12-2018 , 02:21   Re: ARRY
Reply With Quote #11

yup me searching this thing from last 1 month but failed
soumyadip77 is offline
Send a message via Skype™ to soumyadip77
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 06-12-2018 , 03:09   Re: ARRY
Reply With Quote #12

https://forums.alliedmods.net/showthread.php?t=294300

Maybe this can help you.
__________________
CrAzY MaN is offline
soumyadip77
Senior Member
Join Date: Jul 2017
Location: INDIA,KOLKATA
Old 06-12-2018 , 05:04   Re: ARRY
Reply With Quote #13

already saw :/
soumyadip77 is offline
Send a message via Skype™ to soumyadip77
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 06-12-2018 , 05:54   Re: ARRY
Reply With Quote #14

What are you trying to do?
Give more description
__________________
CrAzY MaN is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-12-2018 , 07:15   Re: ARRY
Reply With Quote #15

Quote:
Originally Posted by soumyadip77 View Post
OciXCrom's plugins dont have this type of thing
0% of my plugins have a thing called "arry".
90% of my plugins have a thing called "array".
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
soumyadip77
Senior Member
Join Date: Jul 2017
Location: INDIA,KOLKATA
Old 06-12-2018 , 10:23   Re: ARRY
Reply With Quote #16

ya ik my mistake me edited but main topic is not changing
soumyadip77 is offline
Send a message via Skype™ to soumyadip77
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-12-2018 , 10:40   Re: ARRY
Reply With Quote #17

I have edited the plugin, it shoud be solve the problem

Code:
/*

files.ini at amxmodx/configs folder

"Files"
{
	"0"	"sound/test/test0.mp3"
	"1"	"sound/test/test1.mp3"
	"2"	"sound/test/test2.mp3"
	"3"	"sound/test/test3.mp3"
	"4"	"sound/test/test4.mp3"
	"5"	"sound/test/test5.mp3"
	"6"	"sound/test/test6.mp3"
}
 */

#include <amxmodx>
#include <amxmisc>

#define MAX_FILES 32

new g_Count;
new g_Files[MAX_FILES][32];

public plugin_init()
{
	register_plugin("Small Precache","0.2","SmileY");
}

public plugin_precache()
{
	for(new i;i <= g_Count;i++)
	{
		precache_generic(g_Files[i]);
	}
}

public plugin_cfg()
{
	new Dir[32];
	get_configsdir(Dir,charsmax(Dir));
	
	new Path[64];
	format(Path,charsmax(Path),"%s/files.ini",Dir);
	
	if(file_exists(Path))
	{
		new SMCParser:Handle = SMC_CreateParser();
		
		if(Handle != Invalid_SMCParser)
		{
			SMC_SetReaders(Handle,"OnKeyValue");
			SMC_ParseFile(Handle,Path);
		}
		
		SMC_DestroyParser(Handle);
	}
}

public SMCResult:OnKeyValue(SMCParser:handle,const key[],const value[],any:data)
{
	if(key[0] && value[0])
	{
		copy(g_Files[str_to_num(key)],sizeof(g_Files[]),value);
		g_Count++;
	}

	return SMCParse_Continue;
}
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 06-12-2018 , 11:46   Re: ARRY
Reply With Quote #18

Quote:
Originally Posted by soumyadip77 View Post
ya ik my mistake me edited but main topic is not changing
You can change your title by editing the post>>Advanced Edit
__________________
CrAzY MaN is offline
soumyadip77
Senior Member
Join Date: Jul 2017
Location: INDIA,KOLKATA
Old 06-12-2018 , 12:19   Re: ARRY
Reply With Quote #19

me tried to make....from ze . But it is not working :/ ... here is the code

PHP Code:
/* Sublime AMXX Editor v2.2 */

#include <amxmodx>
#include <amxmisc>
// #include <cstrike>
// #include <engine>
// #include <fakemeta>
// #include <hamsandwich>
// #include <fun>
// #include <xs>
// #include <sqlx>

#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))
    
        if(
equal(temp_string[strlen(temp_string) - 4], ".mp3"))
        {
            
format(buffercharsmax(buffer), "sound/%s"temp_string)
            
precache_generic(buffer)
        } else {
            
precache_sound(temp_string)
        }
    }
}

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))
    {
        new 
error[100]
        
formatex(errorcharsmax(error), "error")
        
set_fail_state(error)
        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))
        
        
// Replace newlines with a null character to prevent headaches
        
replace(linedatacharsmax(linedata), "^n""")
        
        
// 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_soundrandom_num(0ArraySize(ready_sound) - 1), temp_stringsizeof(temp_string))

    
PlaySound(0temp_string)
}

stock PlaySound(id, const sound[])
{
    if(
id == 0)
    {
        if (
equal(sound[strlen(sound)-4], ".mp3"))
            
client_cmd(0"mp3 play ^"sound/%s^""sound)
        else
            
client_cmd(0"spk ^"%s^""sound)
        } else {
        if(
is_user_connected(id)&& is_user_alive(id))
        {
            if (
equal(sound[strlen(sound)-4], ".mp3"))
                
client_cmd(id"mp3 play ^"sound/%s^""sound)
            else
                
client_cmd(id"spk ^"%s^""sound)            
        }
    }

file
PHP Code:
START sound/enf_misc2/enf_knife_4.mp3 
soumyadip77 is offline
Send a message via Skype™ to soumyadip77
soumyadip77
Senior Member
Join Date: Jul 2017
Location: INDIA,KOLKATA
Old 06-12-2018 , 12:21   Re: ARRY
Reply With Quote #20

Quote:
Originally Posted by ^SmileY View Post
I have edited the plugin, it shoud be solve the problem

Code:
/*

files.ini at amxmodx/configs folder

"Files"
{
	"0"	"sound/test/test0.mp3"
	"1"	"sound/test/test1.mp3"
	"2"	"sound/test/test2.mp3"
	"3"	"sound/test/test3.mp3"
	"4"	"sound/test/test4.mp3"
	"5"	"sound/test/test5.mp3"
	"6"	"sound/test/test6.mp3"
}
 */

#include <amxmodx>
#include <amxmisc>

#define MAX_FILES 32

new g_Count;
new g_Files[MAX_FILES][32];

public plugin_init()
{
	register_plugin("Small Precache","0.2","SmileY");
}

public plugin_precache()
{
	for(new i;i <= g_Count;i++)
	{
		precache_generic(g_Files[i]);
	}
}

public plugin_cfg()
{
	new Dir[32];
	get_configsdir(Dir,charsmax(Dir));
	
	new Path[64];
	format(Path,charsmax(Path),"%s/files.ini",Dir);
	
	if(file_exists(Path))
	{
		new SMCParser:Handle = SMC_CreateParser();
		
		if(Handle != Invalid_SMCParser)
		{
			SMC_SetReaders(Handle,"OnKeyValue");
			SMC_ParseFile(Handle,Path);
		}
		
		SMC_DestroyParser(Handle);
	}
}

public SMCResult:OnKeyValue(SMCParser:handle,const key[],const value[],any:data)
{
	if(key[0] && value[0])
	{
		copy(g_Files[str_to_num(key)],sizeof(g_Files[]),value);
		g_Count++;
	}

	return SMCParse_Continue;
}

i will try it later me trying to use Array which one i gave ...
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 05:24.


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