I get errors with enum
#1

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
Reply
#2

Do you have these things in your script?

pawn Код:
#if
#else
#endif
Reply
#3

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Do you have these things in your script?

pawn Код:
#if
#else
#endif
Yes I have this:
pawn Код:
#if defined FILTERSCRIPT
#endif
But what does it has to do with my issue? /:
Reply
#4

Out-of-bounds error. Index starts at 0, not 1.
Reply
#5

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.
Reply
#6

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
Reply
#7

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.
Reply
#8

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" }
Reply
#9

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)