Errors with arrays and strings
#1

Hi, I have some errors, here is my code:

pawn Код:
#define MAX_BUSINESS 50

enum bInfo
{
  bID,
  bName,
  bOwner[MAX_PLAYER_NAME],
  bPrice,
  bInterior,
  bVirtualWorld,
  Float:bX,
  Float:bY,
  Float:bZ,
}

new BizInfo[MAX_BUSINESS][bInfo];
new BizCount = 0;

stock CreateBusiness(BizName[], BizPrice, Float:X, Float:Y, Float:Z, Interior = 0, VirtualWorld = 0)
{
  new string[51];

  BizInfo[bID] = BizCount; //The first error is here, I know that I can't do that, but how do I set the ID?
  BizCount++;
 
  new str[51];
  format(str, sizeof(str), "%s", BizName);
 
  BizInfo[bID][bName] = str; //This is the second error line
  BizInfo[bID][bPrice] = BizPrice;
  BizInfo[bID][bX] = X;
  BizInfo[bID][bY] = Y;
  BizInfo[bID][bZ] = Z;
  BizInfo[bID][bOwner] = "No Owner"; //And this is the third ! Why can't I set that array as a string?
  BizInfo[bID][bInterior] = Interior;
  BizInfo[bID][bVirtualWorld] = VirtualWorld;
 
  format(string,sizeof(string),"Businesses/Biz%d.biz.ini", BizInfo[bID]);
 
  INI_Open(string);
 
  INI_WriteString("Name", BizInfo[bID][bName]);
  INI_WriteInt("Price", BizInfo[bID][bPrice]);
  INI_WriteInt("Interior", BizInfo[bID][bInterior]);
  INI_WriteInt("VirtualWorld", BizInfo[bID][bVirtualWorld]);
  INI_WriteFloat("X", BizInfo[bID][bX]);
  INI_WriteFloat("Y", BizInfo[bID][bY]);
  INI_WriteFloat("Z", BizInfo[bID][bZ]);
  INI_WriteString("Owner", BizInfo[bID][bOwner]);
 
  INI_Save();
  INI_Close();
  return bID;
}

And I get this 3 errors, that I can't fix !
.
Код:
C:\Users\Salvastrazzullo\Desktop\sa-mp 0.3c Server\gamemodes\SLARP.pwn(3066) : error 033: array must be indexed (variable "BizInfo")
C:\Users\Salvastrazzullo\Desktop\sa-mp 0.3c Server\gamemodes\SLARP.pwn(3072) : error 006: must be assigned to an array
C:\Users\Salvastrazzullo\Desktop\sa-mp 0.3c Server\gamemodes\SLARP.pwn(3077) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
.
It seems that the compiler doesn't want string in that array!

Please, can someone help me with this errors??
Reply


Messages In This Thread
Errors with arrays and strings - by Sasino97 - 14.03.2011, 19:27
Re: Errors with arrays and strings - by Kwarde - 14.03.2011, 19:29
Re: Errors with arrays and strings - by Sasino97 - 14.03.2011, 19:36
Re: Errors with arrays and strings - by Sasino97 - 14.03.2011, 20:12
Re: Errors with arrays and strings - by Kwarde - 14.03.2011, 20:14
Re: Errors with arrays and strings - by Sasino97 - 14.03.2011, 20:19
Re: Errors with arrays and strings - by Kwarde - 14.03.2011, 20:34
Re: Errors with arrays and strings - by Sasino97 - 14.03.2011, 20:49
Re: Errors with arrays and strings - by Sasino97 - 15.03.2011, 19:01
Re: Errors with arrays and strings - by Sasino97 - 17.03.2011, 17:34

Forum Jump:


Users browsing this thread: 1 Guest(s)