25.10.2011, 22:44
Hello. I am trying to create a company system for my server but I get this error message:
The way I scripted is was:
I am not so good in scripting when it comes to file-reading and saving, so I'd really appreciate some help, and I'll give rep+ for someone who helps.
Код:
C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(110) : warning 219: local variable "Companies" shadows a variable at a preceding level C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(112) : warning 219: local variable "Companies" shadows a variable at a preceding level C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(113) : warning 213: tag mismatch C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(112) : warning 204: symbol is assigned a value that is never used: "Companies" C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(110) : warning 203: symbol is never used: "Companies" C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(129) : warning 213: tag mismatch C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(131) : error 032: array index out of bounds (variable "CompanyInfo") C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(132) : error 032: array index out of bounds (variable "CompanyInfo") C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(133) : error 032: array index out of bounds (variable "CompanyInfo") C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(134) : error 032: array index out of bounds (variable "CompanyInfo") C:\Users\Chuck Norris\Desktop\samp\gamemodes\Scratch.pwn(135) : error 032: array index out of bounds (variable "CompanyInfo") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors.
pawn Код:
#define COMPANYPATH "/Companies/%s.ini"
pawn Код:
enum Companies
{
Company1,
Company2,
Company3,
Company4,
Company5,
Company6,
Company7,
Company8,
Company9,
Company10,
Company11,
Company12,
Company13,
Company14,
Company15
}
pawn Код:
new CompanyInfo[Companies][cInfo];
pawn Код:
stock CompanyPath(Companies)
{
new string[128],Companies[15];
format(string,sizeof(string),COMPANYPATH,Companies);
return string;
}
pawn Код:
public OnGameModeInit()
{
new INI:File = INI_Open(CompanyPath(Companies));
INI_SetTag(File,"data");
INI_WriteInt(File,"Company ID",CompanyInfo[Companies][cID]);
INI_WriteInt(File,"Company Name",CompanyInfo[Companies][cName]);
INI_WriteInt(File,"Company Bank",CompanyInfo[Companies][cCash]);
INI_WriteInt(File,"Company Payrate",CompanyInfo[Companies][cPayrate]);
INI_WriteInt(File,"Company Owner",CompanyInfo[Companies][cOwner]);
INI_Close(File);
SetGameModeText("Remaking server");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}