Raised This Month: $ Target: $400
 0% 

Array sizes do not match.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 01-15-2007 , 17:18   Array sizes do not match.
Reply With Quote #1

I dunno what's wrong really... wont even compile.
The origin part is the problem.

Edit:It's not really important, I'm using separate arrays instead, I just wondered why it didn't work.
Code:
#include <amxmodx> enum info {     Float:origin[3],     str[10] } new array[1][info] public plugin_init() {     func(array[0][str], array[0][origin]) } stock func(str[], Float:origin[3]) {     }

Last edited by [ --<-@ ] Black Rose; 01-16-2007 at 03:36.
[ --<-@ ] Black Rose is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-15-2007 , 19:16   Re: Array sizes do not match.
Reply With Quote #2

Why do you create a multi-dimensional array, the first dimension having a size of 1? I'm suprised that it even lets you. You should just create a one-dimensional array.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 01-15-2007 , 20:05   Re: Array sizes do not match.
Reply With Quote #3

It was just an example.
[ --<-@ ] Black Rose is offline
Old 01-16-2007, 00:55
commonbullet
This message has been deleted by commonbullet. Reason: pointless
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 01-16-2007 , 02:02   Re: Array sizes do not match.
Reply With Quote #5

AMXX compiler doesn't always tell you the correct location of the problem every time. A size 1 array is just... a variable... I bet if you just changed the size 1 arrays to variables the problems would go away and it would compile, even if it is pointing to Origin.
__________________
Bad_Bud is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 01-16-2007 , 03:34   Re: Array sizes do not match.
Reply With Quote #6

It isn't pointing to origin. but if I would use this script it would work.
So the problem is really I can't use the origin in my func()
Code:
#include <amxmodx> enum info {     Float:origin[3],     str[10] } new array[1][info] public plugin_init() {     new Origin[3]     func(array[0][str], Origin) } stock func(str[], Float:origin[3]) {     }

Last edited by [ --<-@ ] Black Rose; 01-16-2007 at 03:36.
[ --<-@ ] Black Rose is offline
schnitzelmaker
Senior Member
Join Date: Apr 2006
Location: HERE
Old 01-16-2007 , 09:30   Re: Array sizes do not match.
Reply With Quote #7

A Way is using a Temp Variable,here an example
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Test" #define VERSION "1.0" #define AUTHOR "Administrator" enum info{     ORIGIN[3],     STR[31] } new array[1][info] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)    } public client_putinserver(id){     new TempOrigin[3]         get_user_name(id,array[0][STR],31)     get_user_origin(id,TempOrigin)         //copy all [3]     array[0][ORIGIN] = TempOrigin     //copy only [1]     array[0][ORIGIN][1] = 100         func(array[0][STR], array[0][ORIGIN]) } //recommend use [],not [3] stock func(str[], origin[]) {     console_print(0,"test:%s,%d,%d,%d",str,origin[0],origin[1],origin[2]) }
__________________
schnitzelmaker is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-16-2007 , 09:53   Re: Array sizes do not match.
Reply With Quote #8

shouldn't 'origin[]' in the stock func be a float ?
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 01-16-2007 , 09:54   Re: Array sizes do not match.
Reply With Quote #9

Quote:
Originally Posted by dutchmeat View Post
shouldn't 'origin[]' in the stock func be a float ?
no because he is using get_user_origin()
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 01-16-2007 , 11:18   Re: Array sizes do not match.
Reply With Quote #10

Black Rose, here is fixed version of your code:
Code:
#include <amxmodx> enum info {     Float:vecOrigin[3],     str[10] } new array[1][info] public plugin_init() {     func(array[0][str], array[0][vecOrigin]) } stock func(str[], Float:origin[3]) {     }

Remember, that enumeration items are visible in global scope.

I suggest to name items with struc name prefix, i.e. "info" in your case, like this:
Code:
enum info {     Float:info_vecOrigin[3],     info_str[10] }
Simon Logic is offline
Send a message via Skype™ to Simon Logic
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 22:22.


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