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

Solved arraygetstringhandle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 06-22-2017 , 19:02   arraygetstringhandle
Reply With Quote #1

solved
__________________

Last edited by Ayman Khaled; 06-23-2017 at 08:16.
Ayman Khaled is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 06-22-2017 , 19:10   Re: arraygetstringhandle
Reply With Quote #2

Did you created the array ? If so, where? plugin_init()? If so, transfer it to plugin_precache(), 'cuz it runs first than plugin_init().
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 06-22-2017 at 19:13.
EFFx is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 06-23-2017 , 04:58   Re: arraygetstringhandle
Reply With Quote #3

Error in debug :
L 04/12/2017 - 23:402: Invalid array handle provided (0)
L 04/12/2017 - 23:402: [AMXX] Displaying debug trace (plugin "round_sounds.amxx")
L 04/12/2017 - 23:402: [AMXX] Run time error 10: native error (native "ArrayGetStringHandle")
L 04/12/2017 - 23:402: [AMXX] [0] round_sounds.sma::Event_Start_Round

full code
PHP Code:
    #include <amxmodx>
    #include <amxmisc>

    #define PLUGIN "test"
    #define VERSION "1.0"
    #define AUTHOR "Ayman Khaled"
    #define MAX_PLAYERS 32
    
    
new
       Array:
g_pStart,
       
bool:g_bStart false,
       
g_StartSize 0,
       
bool:g_bSound[MAX_PLAYERS 1],
       
g_maxPlayers 0;
       
    new const 
g_Cmd[] = "/test"


    
public plugin_init() 
    {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say"      ,   "Say")
    
register_clcmd("say_team",   "Say")
    
register_logevent("Event_Start_Round" ,  2  "1=Round_Start"  );

    
g_maxPlayers get_maxplayers();
    
    
PluginPrecache();
    }

    
PluginPrecache() 
    {
        
g_pStart ArrayCreate(128);
    
        
__Load();
    
        
g_StartSize ArraySize(g_pStart);
    
    new 
Iterator 0;
    new 
Sound[128];

    if (
g_bStart)
    {
        for (
Iterator 0Iterator ArraySize(g_pStart); Iterator++)
            
ArrayGetString(g_pStartIteratorSoundcharsmax(Sound)), precache_sound(Sound);
    }
    }
    
    
__Load()
    {
        new 
File[256];
    
get_configsdir(Filecharsmax(File));
    
add(Filecharsmax(File), "/roundsounds.ini");

    new 
pFile fopen(File"r");
    if (!
pFile)
        return;

    new 
Line[512], Key[64], Value[256];

    while (!
feof(pFile))
    {
        
fgets(pFileLinecharsmax(Line));

        
trim(Line);

        if (
Line[0] == EOS || Line[0] == ';' || Line[0] == '#' || (Line[0] == '/' && Line[1] == '/'))
            continue;

        
strtok(LineKeycharsmax(Key), Valuecharsmax(Value), '=');

        
trim(Key);
        
trim(Value);
        
        if (
equali(Key"ROUNDSTART SOUNDS"))
        {
            while (
Value[0] != EOS && strtok(ValueKeycharsmax(Key), Valuecharsmax(Value), ','))
            {
                
trim(Key), trim(Value);
                
ArrayPushString(g_pStartKey);
            }
        }
    }
    }
    
    public 
Say(id)
    {    
        static 
sMsg[64];
        
read_argv1sMsgcharsmaxsMsg ) );

        if( 
equalisMsgg_Cmd) )
        {
        
            
g_bSound[id] = g_bSound[id] ? false true;
        
            return 
PLUGIN_HANDLED;
        }
    
        return 
PLUGIN_CONTINUE;
    }
    
    public 
Event_Start_Round()
    {    
        
ars_client_cmd(0"SPK ^"%a^""ArrayGetStringHandle(g_pStartrandom_num(0g_StartSize 1)))
    }  
    
    
ars_client_cmd(TargetRules[], any:...)
    {
        static 
Buffer[256], Player;
        
vformat(Buffercharsmax(Buffer), Rules3);

        if (
Target && !g_bSound[Target])
            
client_cmd(TargetBuffer);

        else if (
Target 1)
        {
            for (
Player 1Player <= g_maxPlayersPlayer++)
            {
                if (!
g_bSound[Player])
                    
client_cmd(PlayerBuffer);
            }
        }
    } 
__________________

Last edited by Ayman Khaled; 06-23-2017 at 09:56.
Ayman Khaled is offline
Old 06-23-2017, 06:19
HamletEagle
This message has been deleted by HamletEagle.
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-23-2017 , 08:33   Re: arraygetstringhandle
Reply With Quote #4

Why did you turn your topic in garbage? Don't be selfish, other people may have the same problem. And why did you post this here? Don't you see the "scripting help" section?!
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 06-23-2017 , 09:49   Re: arraygetstringhandle
Reply With Quote #5

i'm not selfish, but problem was in my plugin in debug
L 04/12/2017 - 23:402: Invalid array handle provided (0)
L 04/12/2017 - 23:402: [AMXX] Displaying debug trace (plugin "round_sounds.amxx")
L 04/12/2017 - 23:402: [AMXX] Run time error 10: native error (native "ArrayGetStringHandle")
L 04/12/2017 - 23:402: [AMXX] [0] round_sounds.sma::Event_Start_Round
i just posted an example but i tried it again and it works so i do that
in my plugin i forget to create g_pBtdct4 array and i made 4 arrays in same size ( mistake )
i mean
g_Btdct1 = ArraySize(g_pBtdct1);
g_Btdct2 = ArraySize(g_pBtdct1);
g_Btdct3 = ArraySize(g_pBtdct1);
g_Btdct4 = ArraySize(g_pBtdct1);
and if you didn't see i posted full code ...
and sorry i forget to post in scripting help.
__________________

Last edited by Ayman Khaled; 06-23-2017 at 10:00.
Ayman Khaled 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 02:21.


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