AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   PLZ help a stupid newbie! (COMPILING ERROR) (https://forums.alliedmods.net/showthread.php?t=44798)

bloodypizza 09-13-2006 19:34

PLZ help a stupid newbie! (COMPILING ERROR)
 
Hi, i tryed to compile this plugin, but got the error: <Path to cs amxx\scripting-shit>\osk.sma(29) : error 033: array must be indexed (variable "argp")

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {  register_plugin("Nameless","1.0","Oskar")  register_concmd("amx_test", "cmdSkit", ADMIN_SLAY, "<name or #userid>") } public cmdSkit(id, level, cid) {  // Do I have the right adminflags?  if (!cmd_access(id, level, cid, 2))   return PLUGIN_HANDLED  // Arguments, amx_test <argo (player)> <argp (times)>  new argo[32]  new argp[4]  read_argv(1,argo,31)  read_argv(2,argp,3)  // Get the player id  new arg = cmd_target(id, argo, 2)  // Will be only be used in the FOR code  new arge = 1  // If I wrote the name of a non-existing player, then why would I want the plugin to continue?  if (!arg)   return PLUGIN_HANDLED  /////////////////  //Do the function ej(arg) 1 time. The next time the FOR loop will run the  //function cl(arg) instead.  /////////////////  for (new i = 0; i < argp*2; i++)  {  if( arge == 1 )  {   arge = 2   set_task(i*2.0,"ej",arg)  }    else if( arge == 2 )  {   arge = 1   set_task(i*2.0,"cl",arg)  }  }  return PLUGIN_HANDLED } public ej(arg) {  client_cmd(arg,"plugin_doesnt_compile_right_on") } public cl(arg) {  client_cmd(arg,"plugin_doesnt_compile_right_off") }

TheNewt 09-13-2006 20:45

Re: PLZ help a stupid newbie! (COMPILING ERROR)
 
Code:
for (new i = 0; i < argp*2; i++)
argp*2 isn't indexed... O.o index it
its saying argp isn't indexed on line 29, i went to line 29, what do you know argp is there without a index.
Kinda tells you how to fix it in the compiler
"[29] array must be indexed"

bloodypizza 09-14-2006 12:51

Re: PLZ help a stupid newbie! (COMPILING ERROR)
 
Quote:

Originally Posted by MysticDeath (Post 380770)
Code:
for (new i = 0; i < argp*2; i++)



argp*2 isn't indexed... O.o index it
its saying argp isn't indexed on line 29, i went to line 29, what do you know argp is there without a index.
Kinda tells you how to fix it in the compiler
"[29] array must be indexed"

And how do I index it? I don't get any errors with argo or arg.

Silencer123 09-14-2006 16:52

Re: PLZ help a stupid newbie! (COMPILING ERROR)
 
Code:
for (new i = 0; i < argp[3]*2; i++)
Note that 3 is max length. if u use 4 it will not work, although
you did new argp[4], not new argp[3]. The Reason is weird.
Just acceppt that ^^ if u want length to be 4, do
new argp[5]
and in for-loop use use [4]
argp is probably a number. u should not use argp, do:
new num_argp=str_to_num(argp)
after read_argv-ing it and replace argp with num_argp after there

TheNewt 09-14-2006 21:36

Re: PLZ help a stupid newbie! (COMPILING ERROR)
 
Quote:

I don't get any errors with argo or arg.
O.o
Quote:

<Path to cs amxx\scripting-shit>\osk.sma(29) : error 033: array must be indexed (variable "argp")
variable "argp"

bloodypizza 09-15-2006 12:31

Re: PLZ help a stupid newbie! (COMPILING ERROR)
 
Quote:

Originally Posted by Silencer123 (Post 381073)
Code:
</p><p>for (new i = 0; i < argp[3]*2; i++)</p><p>


Note that 3 is max length. if u use 4 it will not work, although
you did new argp[4], not new argp[3]. The Reason is weird.
Just acceppt that ^^ if u want length to be 4, do
new argp[5]
and in for-loop use use [4]
argp is probably a number. u should not use argp, do:
new num_argp=str_to_num(argp)
after read_argv-ing it and replace argp with num_argp after there


Thx works fine!
(+karma)


All times are GMT -4. The time now is 14:18.

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