Raised This Month: $ Target: $400
 0% 

help with noob bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MC-Olivenoel
Member
Join Date: Oct 2004
Old 10-19-2004 , 10:44   help with noob bug
Reply With Quote #1

hi

simpel thing... but im noob and cant find the error

combiller say array out of bount

if i cange the array it says array mismasch .. *ARG*

Code:
    new varmenu0[2]     if (read_argc() == 0) {     //noargument ...     console_print(id,"- no argument")     varmenu0[2] = "00"     }else{     read_argv(1,varmenu0[0],2)     }     if (varmenu0[0] == '00'){     //blablabla


help please....
MC-Olivenoel is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 10-19-2004 , 13:05  
Reply With Quote #2

Please explain what you are trying to do
__________________
hello, i am pm
PM is offline
MC-Olivenoel
Member
Join Date: Oct 2004
Old 10-19-2004 , 13:14  
Reply With Quote #3

ok

i make n command with argument ;)


so u can typ

amx_make
or
amx_make 00

and it will make the code behind 00

and if u say amx_make 11

then it will make the

code that stand under there in an secount if() with 11

and so on ;)

edit//
i want check if the arguments are true or not .... thats all

cucu
MC-Olivenoel is offline
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 10-19-2004 , 19:42  
Reply With Quote #4

yo this would officcally be the first person i helped so yay!

i think i see your problem. in
Code:
 new varmenu0[2]     if (read_argc() == 0) {     //noargument ...     console_print(id,"- no argument")     varmenu0[2] = "00"     }else{     read_argv(1,varmenu0[0],2)     }     if (varmenu0[0] == '00'){     //blablabla

where it says
Code:
varmenu0[2] = "00"
, you cant declare a array with [2] and expect it to have data for [2]. an array of [2] will have data for varmenu0[0] and varmenu0[1]. if u use the array with a array[2] when there is no vector there, its like an outa bound array, thus your error.

///EDIT i think i tealized somethign else but its probably nothin.
Code:
 read_argv(1,varmenu0[0],2)
what does the 2 mean in the last read_argv argument? if it means assign to varmenu[2] then theres a problem, as i stated above.
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
MC-Olivenoel
Member
Join Date: Oct 2004
Old 10-20-2004 , 01:42  
Reply With Quote #5

hi

ok thx but i dont understand why to put n string "00" into n array

ok im coding cb c c++ but this this this SMALL

i want only do somthing like this

example but it dosent work ...

Code:
public func021(id,level,cid) { new var_menu0 // will be (00 - 99 and/or aa - zz) as STRING     if (read_argc() == 0) {     //noargument ...     console_print(id,"- no argument... set to 00")     var_menu0 = "00"     } else {     read_argv(1,var_menu0,2)     } if (var_menu0 == "00") { //make some nice things 1 return PLUGIN_HANDLED } if (var_menu0 == "01") { //make some nice things 2 return PLUGIN_HANDLED } if (var_menu0 == "03") { //make some nice things 3 return PLUGIN_HANDLED } //kill the PC LOL... user has wrong argument return PLUGIN_HANDLED }


i dont understand this SMALL language *ARG*

if someone can make this work .... i can see how it works ... (dont understand .. shiting arrays with strings

cucu
MC-Olivenoel is offline
MC-Olivenoel
Member
Join Date: Oct 2004
Old 10-20-2004 , 02:23  
Reply With Quote #6

hi

ok i read the tutorial with array 1000000 times

Code:
public func021(id,level,cid) { new var_menu0[1] // will be (00 - 99 and aa - zz) as STRING     if (read_argc() == 0) {     //noargument ...     console_print(id,"- no argument... set to 00")     copy(var_menu0, 2, "00")     } else {     read_argv(1,var_menu0,2)    //is this right ???     } if ((var_menu0[0] == "0") && (var_menu0[1] == "0")) { //make some nice things 1 return PLUGIN_HANDLED } if ((var_menu0[0] == "0") && (var_menu0[1] == "1")) { //make some nice things 2 return PLUGIN_HANDLED } if ((var_menu0[0] == "0") && (var_menu0[1] == "2")) { //make some nice things 3 return PLUGIN_HANDLED } //kill the PC LOL... user has wrong argument return PLUGIN_HANDLED }

whats wrong ??? *AGR* i copy and copy arrays like in tut but then .. its n other error LOL

Code:
(32): warning 217: loose indentation
(40): warning 217: loose indentation
(40): error 033: array must be indexed (variable "-unknown-")
(45): error 033: array must be indexed (variable "-unknown-")
(50): error 033: array must be indexed (variable "-unknown-")
whats this ***********ing 'loose indentation' line 32 ???

line 32
Code:
    if (read_argc() == 0) {
whats wrong
and line 40 45 50 why i say "var_menu0[1]" ists n array for string with 2 space in it ...


all time it works and now

HELP PLEASE
MC-Olivenoel is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 10-20-2004 , 11:13  
Reply With Quote #7

No, new var_menu0[1] creates an array with one variable: var_menu0[0] you need to declare var_menu0[2].
__________________
twistedeuphoria is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 10-20-2004 , 12:00  
Reply With Quote #8

Try using '(value)' instead of "(value)".
__________________
hello, i am pm
PM is offline
Da Bishop
Senior Member
Join Date: Aug 2004
Location: Chester County PA
Old 10-20-2004 , 14:56  
Reply With Quote #9

Quote:
whats this ***********ing 'loose indentation' line 32 ???

line 32
Code:

if (read_argc() == 0) {


whats wrong Crying or Very sad
loose indentations are nothing to worry about, pretty useless warning actually. To make them go away add this to the code

Code:
#pragma tabsize 0
Da Bishop is offline
Send a message via MSN to Da Bishop
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 10-20-2004 , 15:54  
Reply With Quote #10

Quote:
Originally Posted by Da Bishop
loose indentations are nothing to worry about, pretty useless warning actually.
I would make them errors actually! Just like tag mismatch! Ha!
__________________
hello, i am pm
PM 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 17:27.


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