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

PLZ help a stupid newbie! (COMPILING ERROR)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bloodypizza
BANNED
Join Date: Nov 2005
Location: Slöinge,FALKENBG,SWE
Old 09-13-2006 , 19:34   PLZ help a stupid newbie! (COMPILING ERROR)
Reply With Quote #1

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") }
bloodypizza is offline
Send a message via MSN to bloodypizza
TheNewt
Donor
Join Date: Jun 2006
Location: Where I live.
Old 09-13-2006 , 20:45   Re: PLZ help a stupid newbie! (COMPILING ERROR)
Reply With Quote #2

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"
__________________
Quote:
toe3_ left the chat room. (G-lined (AUTO Excessive connections from a single host.))
TheNewt is offline
bloodypizza
BANNED
Join Date: Nov 2005
Location: Slöinge,FALKENBG,SWE
Old 09-14-2006 , 12:51   Re: PLZ help a stupid newbie! (COMPILING ERROR)
Reply With Quote #3

Quote:
Originally Posted by MysticDeath View Post
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.
bloodypizza is offline
Send a message via MSN to bloodypizza
Silencer123
Veteran Member
Join Date: Jul 2006
Old 09-14-2006 , 16:52   Re: PLZ help a stupid newbie! (COMPILING ERROR)
Reply With Quote #4

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
__________________
EAT YOUR VEGGIES

Last edited by Silencer123; 09-14-2006 at 16:54.
Silencer123 is offline
TheNewt
Donor
Join Date: Jun 2006
Location: Where I live.
Old 09-14-2006 , 21:36   Re: PLZ help a stupid newbie! (COMPILING ERROR)
Reply With Quote #5

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"
__________________
Quote:
toe3_ left the chat room. (G-lined (AUTO Excessive connections from a single host.))
TheNewt is offline
bloodypizza
BANNED
Join Date: Nov 2005
Location: Slöinge,FALKENBG,SWE
Old 09-15-2006 , 12:31   Re: PLZ help a stupid newbie! (COMPILING ERROR)
Reply With Quote #6

Quote:
Originally Posted by Silencer123 View Post
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)
bloodypizza is offline
Send a message via MSN to bloodypizza
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 08:11.


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