I get errors with enum -
nuriel8833 - 28.04.2011
Hello everyone
I am trying to make a bus filterscript and all I have done so far is this:
pawn Код:
//Global
enum BusStationsInfo
{
Float: objx,
Float: objy,
Float: objz,
Float: objrx,
Float: objry,
Float: objrz,
Float: cpx,
Float: cpy,
Float: cpz,
location[24],
linesinfo[256]
};
//Also Global (I will add more stations soon,so don't think this is the reason)
new BusStations[][BusStationsInfo] =
{
{ -1984.613281,147.813629,27.966692,0.0,0.0,0.0,9,8,7,"Cranberry Station","Line: 1" }
};
//On OnFilterScriptInit
CreateObject(1257,BusStations[1][objx],BusStations[1][objy],BusStations[1][objz],BusStations[1][objrx],BusStations[1][objry],BusStations[1][objrz]); // Cranberry Station
And after changing the CreateObject parameters I get those errors:
pawn Код:
error 017: undefined symbol "BusStations"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
Could someone help me? I don't know what I am doing wrong /=
Thanks
Re: I get errors with enum -
MadeMan - 28.04.2011
Do you have these things in your script?
Re: I get errors with enum -
nuriel8833 - 28.04.2011
Quote:
Originally Posted by MadeMan
Do you have these things in your script?
|
Yes I have this:
pawn Код:
#if defined FILTERSCRIPT
#endif
But what does it has to do with my issue? /:
Re: I get errors with enum -
Vince - 28.04.2011
Out-of-bounds error. Index starts at 0, not 1.
Re: I get errors with enum -
alpha500delta - 28.04.2011
Quote:
Originally Posted by Montserrat
Yes I have this:
pawn Код:
#if defined FILTERSCRIPT #endif
But what does it has to do with my issue? /:
|
Well that code between those #if defined FILTERSCRIPT and #endif only work when you've defined FILTERSCRIPT.
Re: I get errors with enum -
nuriel8833 - 28.04.2011
Quote:
Originally Posted by Vince
Out-of-bounds error. Index starts at 0, not 1.
|
I didn't notice,thanks.
But unfortunatly I still get those errors
Quote:
Originally Posted by alpha500delta
Well that code between those #if defined FILTERSCRIPT and #endif only work when you've defined FILTERSCRIPT.
|
I know that,thats why I mentioned it is on OnFilterScriptInit
Re: I get errors with enum -
Jeffry - 28.04.2011
pawn Код:
//Global
enum BusStationsInfo
{
Float: objx,
Float: objy,
Float: objz,
Float: objrx,
Float: objry,
Float: objrz,
Float: cpx,
Float: cpy,
Float: cpz,
location[24],
linesinfo[256]
};
new BusStations[][BusStationsInfo] =
{
{ -1984.613281,147.813629,27.966692,0.0,0.0,0.0,9.0,8.0,7.0,"Cranberry Station","Line: 1" }
};
public OnFilterScriptInit()
{
//On OnFilterScriptInit
CreateObject(1257,BusStations[0][objx],BusStations[0][objy],BusStations[0][objz],BusStations[0][objrx],BusStations[0][objry],BusStations[0][objrz]); // Cranberry Station
return 1;
}
The array starts with ID 0. (0,1,2,3,...)
If you use Float:, you have to use floats too. Else you get warnings.
Re: I get errors with enum -
nuriel8833 - 28.04.2011
Quote:
Originally Posted by Jeffry
pawn Код:
//Global enum BusStationsInfo { Float: objx, Float: objy, Float: objz, Float: objrx, Float: objry, Float: objrz, Float: cpx, Float: cpy, Float: cpz, location[24], linesinfo[256] };
new BusStations[][BusStationsInfo] = { { -1984.613281,147.813629,27.966692,0.0,0.0,0.0,9.0,8.0,7.0,"Cranberry Station","Line: 1" } };
public OnFilterScriptInit() { //On OnFilterScriptInit CreateObject(1257,BusStations[0][objx],BusStations[0][objy],BusStations[0][objz],BusStations[0][objrx],BusStations[0][objry],BusStations[0][objrz]); // Cranberry Station return 1; }
The array starts with ID 0. (0,1,2,3,...)
If you use Float:, you have to use floats too. Else you get warnings.
|
New warnings:
pawn Код:
warning 213: tag mismatch
warning 213: tag mismatch
warning 213: tag mismatch
All for this line:
pawn Код:
{ -1984.613281,147.813629,27.966692,0.0,0.0,0.0,9.0,8.0,7.0,"Cranberry Station","Line: 1" }
Re: I get errors with enum -
Jeffry - 28.04.2011
Is cpx,cpy,cpz a Float or not? If it is not a Float, then remove the .0 at 9.0, 8.0,7.0
Re: I get errors with enum -
nuriel8833 - 28.04.2011
Quote:
Originally Posted by Jeffry
Is cpx,cpy,cpz a Float or not? If it is not a Float, then remove the .0 at 9.0, 8.0,7.0
|
Yes it is a float
It is the locations of the checkpoint on the station.