Raised This Month: $ Target: $400
 0% 

error 009: Invalid array size.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Humming Bird
Junior Member
Join Date: May 2007
Old 06-03-2007 , 16:50   error 009: Invalid array size.
Reply With Quote #1

Hello, I'm getting a compiler error when I compile my code.

(note, i use "register_forward(FM_AlertMessage, "alertmessage", 1)")
(note2, i declare g_touchmap with "new g_touchmap[4][32]")

I also have bolded the line I get the error on - error 009: Invalid array size (negative or zero)

So anyone know what I'm doing wrong?

My code is as follows:
Code:
public alertmessage(atype, message[]) {
    if(containi(message,"force_map_") > -1) {
        new sstart = containi(message,"force_map_") + 10
        new empty[32]
        new forcemapstring[76]
        g_touchmap[0] = empty
        for(new i = sstart; i < (strlen(message) -2); i++) {
            g_touchmap[0][i - sstart] = message[i]
        }
        format(forcemapstring, 75, "Forcing map change to: %s", g_touchmap)
        msc_hudprint_all("Forcing Map", forcemapstring)
        client_print(0, print_console, "Forcing map change to: %s", g_touchmap)
        g_Answer = "dochangelevel %s"
        g_execLen = format(g_Execute,255,g_Answer,g_touchmap) + 1
        set_task(2.0, "delayedExec", 451986, g_Execute, g_execLen)
        
        return PLUGIN_HANDLED
    }
}

Last edited by Humming Bird; 06-03-2007 at 17:37.
Humming Bird is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-03-2007 , 17:33   Re: error 009: Invalid array size.
Reply With Quote #2

Check the declaration of g_touchmap.
Can you paste whole code?
__________________
Impossible is Nothing
Sylwester is offline
Humming Bird
Junior Member
Join Date: May 2007
Old 06-03-2007 , 17:37   Re: error 009: Invalid array size.
Reply With Quote #3

new g_touchmap[4][32]

I also have that added to my first post...
Humming Bird is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-03-2007 , 18:58   Re: error 009: Invalid array size.
Reply With Quote #4

Code:
#include <amxmodx> #include <fakemeta> new g_touchmap[4][32] public plugin_init(){     register_plugin( "a", "a", "a" )     register_forward(FM_AlertMessage, "alertmessage", 1) } public alertmessage(atype, message[]) {     if(containi(message,"force_map_") > -1) {         new sstart = containi(message,"force_map_") + 10         new empty[32]         new forcemapstring[76]         g_touchmap[0] = empty         for(new i = sstart; i < (strlen(message) -2); i++) {             g_touchmap[0][i - sstart] = message[i]         }         format(forcemapstring, 75, "Forcing map change to: %s", g_touchmap) //        msc_hudprint_all("Forcing Map", forcemapstring) //        client_print(0, print_console, "Forcing map change to: %s", g_touchmap) //        g_Answer = "dochangelevel %s" //        g_execLen = format(g_Execute,255,g_Answer,g_touchmap) + 1 //        set_task(2.0, "delayedExec", 451986, g_Execute, g_execLen)                 return PLUGIN_HANDLED     } }
I tried this and it compiled without any errors. Paste whole plugin or find the error yourself.
__________________
Impossible is Nothing
Sylwester is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 06-03-2007 , 18:58   Re: error 009: Invalid array size.
Reply With Quote #5

This is a openSource community...why not posting your code!?
I don't think it is something too special that it should kept confidential...0o

greetz regalis
__________________
regalis 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 10:41.


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