Tag mismatch issue -
paulomu300 - 17.01.2016
Hi,
This is my following code:
Код:
enum E_FIRE_TYPES
{
FIRE_TINY_NO_SMOKE,
FIRE_SMALL_NO_SMOKE,
FIRE_SMALL_BLACK_SMOKE,
FIRE_MEDIUM_GRAY_SMOKE,
FIRE_BIG_BLACK_SMOKE
}
new const g_FireModels[E_FIRE_TYPES] = {18688, 18692, 18689, 18691, 18690};
new const Float: g_FireDefaultHealth[E_FIRE_TYPES] = {200.0, 300.0, 370.0, 500.0, 1000.0};
If I type
g_FireModels[FIRE_TINY_NO_SMOKE], it gives me
18688, which is the first element of the list.
If I type
g_FireDefaultHealth[FIRE_TINY_NO_SMOKE], it gives me
200.0, which is also the first element of the list.
As you can see everything is working nice, but when I compile my gamemode, I get the tag mismatch warning on the highlighted line. I've tried the following changes:
Код:
new const g_FireDefaultHealth[E_FIRE_TYPES] = {200.0, 300.0, 370.0, 500.0, 1000.0};
new const _: g_FireDefaultHealth[E_FIRE_TYPES] = {200.0, 300.0, 370.0, 500.0, 1000.0};
I've also tried to attach the
Float: tag to the enum and its 'items', but still get the warning.
Still getting the warning. Any ideas? :/
Re: Tag mismatch issue -
Eth - 17.01.2016
try to change this
pawn Код:
new const Float: g_FireDefaultHealth[E_FIRE_TYPES] = {200.0, 300.0, 370.0, 500.0, 1000.0};
to
pawn Код:
const Float:g_FireDefaultHealth[E_FIRE_TYPES] = {200.0, 300.0, 370.0, 500.0, 1000.0};
Re: Tag mismatch issue -
paulomu300 - 17.01.2016
Quote:
Originally Posted by Eth
try to change this
pawn Код:
new const Float: g_FireDefaultHealth[E_FIRE_TYPES] = {200.0, 300.0, 370.0, 500.0, 1000.0};
to
pawn Код:
const Float:g_FireDefaultHealth[E_FIRE_TYPES] = {200.0, 300.0, 370.0, 500.0, 1000.0};
|
If I remove the
new tag, the compiler gives me an error on that line that says: expected token: "=", but found "[". It seems to understand g_FireDefaultHealth as an variable, and not an array.
EDIT: I've found two workarounds.
1)
Код:
new const g_FireDefaultHealth[E_FIRE_TYPES] = {200, 300, 370, 500, 1000};
// Whenever I need to access the value:
float(g_FireDefaultHealth[FIRE_TYPE])
2)
Код:
new const Float: g_FireDefaultHealth[E_FIRE_TYPES][1] = {{200.0}, {300.0}, {370.0}, {500.0}, {1000.0}};
// Whenever I need to access the value:
g_FireDefaultHealth[FIRE_TYPE][0]
It works, but really annoys me because I should be able to work with the initial code...