Invalid function or declaration -
DarkMythHunter - 16.12.2018
Код:
Utils/Zombies.pwn(87) : error 010: invalid function or declaration
Utils/Zombies.pwn(89) : error 010: invalid function or declaration
Utils/Zombies.pwn(91) : error 010: invalid function or declaration
Utils/Zombies.pwn(92) : error 010: invalid function or declaration
Utils/Zombies.pwn(93) : error 010: invalid function or declaration
Utils/Zombies.pwn(94) : error 010: invalid function or declaration
Utils/Zombies.pwn(95) : error 010: invalid function or declaration
Utils/Zombies.pwn(96) : error 010: invalid function or declaration
Utils/Zombies.pwn(97) : error 010: invalid function or declaration
Utils/Zombies.pwn(98) : error 010: invalid function or declaration
Utils/Zombies.pwn(99) : error 010: invalid function or declaration
Utils/Zombies.pwn(100) : error 010: invalid function or declaration
Utils/Zombies.pwn(101) : error 010: invalid function or declaration
Utils/Zombies.pwn(102) : error 010: invalid function or declaration
Utils/Zombies.pwn(103) : error 010: invalid function or declaration
Utils/Zombies.pwn(104) : error 010: invalid function or declaration
Utils/Zombies.pwn(105) : error 010: invalid function or declaration
Utils/Zombies.pwn(106) : error 010: invalid function or declaration
Utils/Zombies.pwn(107) : error 010: invalid function or declaration
Utils/Zombies.pwn(108) : error 010: invalid function or declaration
Utils/Zombies.pwn(109) : error 010: invalid function or declaration
Utils/Zombies.pwn(110) : error 010: invalid function or declaration
Utils/Zombies.pwn(111) : error 010: invalid function or declaration
Utils/Zombies.pwn(112) : error 010: invalid function or declaration
Utils/Zombies.pwn(113) : error 010: invalid function or declaration
Utils/Zombies.pwn(114) : error 010: invalid function or declaration
PHP код:
default :
{
switch(random(25))
{
case 0: zInfo[o][zItem] = ITEM_ID_CIVILIAN_SKIN;
case 1: zInfo[o][zItem] = ITEM_ID_KNIFE;
case 2: zInfo[o][zItem] = ITEM_ID_GOLF_CLUB;
case 3: zInfo[o][zItem] = ITEM_ID_GAS_CAN;
case 4: zInfo[o][zItem] = ITEM_ID_LIGHTER;
case 5: zInfo[o][zItem] = ITEM_ID_MATCHES;
case 6: zInfo[o][zItem] = ITEM_ID_WATCH;
case 7: zInfo[o][zItem] = ITEM_ID_ROPE;
case 8: zInfo[o][zItem] = ITEM_ID_FISHING_ROD;
case 9: zInfo[o][zItem] = ITEM_ID_GAS_MASK;
case 10: zInfo[o][zItem] = ITEM_ID_MOTOCROSS_HELMET;
case 11: zInfo[o][zItem] = ITEM_ID_CROWBAR;
case 12: zInfo[o][zItem] = Iter_Random(Item_Food);
case 13: zInfo[o][zItem] = ITEM_ID_WOOD;
case 14: zInfo[o][zItem] = ITEM_ID_CLOTH;
case 15: zInfo[o][zItem] = ITEM_ID_RUBBER;
case 16: zInfo[o][zItem] = ITEM_ID_EMPTY_WATER_BOTTLE;
case 17: zInfo[o][zItem] = ITEM_ID_EMPTY_JERRY_CAN;
case 18: zInfo[o][zItem] = ITEM_ID_DRYBAG;
case 19: zInfo[o][zItem] = ITEM_ID_ALICE_BACKPACK;
case 20: zInfo[o][zItem] = ITEM_ID_SUICEPACK;
case 21: zInfo[o][zItem] = ITEM_ID_BAIT;
case 22: zInfo[o][zItem] = ITEM_ID_CIGARETTE;
case 23: zInfo[o][zItem] = ITEM_ID_PACKCIGARRETES;
case 24: zInfo[o][zItem] = ITEM_ID_DIRTY_WATER_BOTTLE;
}
}
Anyone knows what is the problem? Is it because of the "default"? Because the other one uses "case <skin id> : " and it works fine, it is just this part of the script which uses "default".
Re: Invalid function or declaration -
Kaliber - 16.12.2018
Can you show, how you declared these things?
Re: Invalid function or declaration -
DarkMythHunter - 16.12.2018
Quote:
Originally Posted by Kaliber
Can you show, how you declared these things?
|
Is this what you mean?
Re: Invalid function or declaration -
Threshold - 16.12.2018
We need to see where you define zInfo and preferably the enumerator you use in it.
Re: Invalid function or declaration -
DarkMythHunter - 16.12.2018
PHP код:
new str[14], _rand = random(sizeof(ZombiesSpawnCords)), _thenpc;
for(new o; o<MAX_ZOMBIES; o++)
{
_rand = random(sizeof(ZombiesSpawnCords));
format(str, sizeof(str), "Zombie_%d", _thenpc);
_thenpc = FCNPC_Create(str);
FCNPC_Spawn(_thenpc, random(311), ZombiesSpawnCords[_rand][0], ZombiesSpawnCords[_rand][1], ZombiesSpawnCords[_rand][2] + 1.0);
zInfo[o][zLabel] = CreateDynamic3DTextLabel(""COL_RED"Roamer Zombie\n"COL_WHITE"Health: 100", -1, 0.0, 0.0, 0.2, 20.0, .attachedplayer = _thenpc, .testlos = 1);
zInfo[o][zID] = _thenpc;
zInfo[o][zType] = ZOMBIE_TYPE_ROAMER;
Re: Invalid function or declaration -
Threshold - 16.12.2018
We need to see 'new zInfo[...' and the 'enum' that is used in zInfo..
Re: Invalid function or declaration -
DarkMythHunter - 16.12.2018
PHP код:
GetZombieName(zombieid)
{
new _outPut[14];
switch(zInfo[zombieid][zType])
{
case ZOMBIE_TYPE_ROAMER : strcpy(_outPut, "Roamer Zombie", sizeof(_outPut));
case ZOMBIE_TYPE_BITER : strcpy(_outPut, "Biter Zombie", sizeof(_outPut));
case ZOMBIE_TYPE_TANK : strcpy(_outPut, "Tank Zombie", sizeof(_outPut));
case ZOMBIE_TYPE_BOSS : strcpy(_outPut, "Boss Zombie", sizeof(_outPut));
}
return _outPut;
}
I think it's this. If not, then there's nothing. I also somehow fixed the problem, since it doesn't appear in errors now. But this appears now:
Код:
Utils/Zombies.pwn(24) : warning 219: local variable "o" shadows a variable at a preceding level
Utils/Zombies.pwn(31) : error 029: invalid expression, assumed zero
Utils/Zombies.pwn(31) : warning 215: expression has no effect
Utils/Zombies.pwn(31) : error 001: expected token: ";", but found "]"
Utils/Zombies.pwn(31) : error 029: invalid expression, assumed zero
Utils/Zombies.pwn(31) : fatal error 107: too many error messages on one line
Код:
]
CreateRoamerZombies()
{
new str[14], _rand = random(sizeof(ZombiesSpawnCords)), _thenpc;
for(new o; o<MAX_ZOMBIES; o++)
{
_rand = random(sizeof(ZombiesSpawnCords));
format(str, sizeof(str), "Zombie_%d", _thenpc);
_thenpc = FCNPC_Create(str);
FCNPC_Spawn(_thenpc, random(311), ZombiesSpawnCords[_rand][0], ZombiesSpawnCords[_rand][1], ZombiesSpawnCords[_rand][2] + 1.0);
zInfo[o][zLabel] = CreateDynamic3DTextLabel(""COL_RED"Roamer Zombie\n"COL_WHITE"Health: 100", -1, 0.0, 0.0, 0.2, 20.0, .attachedplayer = _thenpc, .testlos = 1);
zInfo[o][zID] = _thenpc;
zInfo[o][zType] = ZOMBIE_TYPE_ROAMER;
The one in bold are the lines in the error. Here it is in php (used code cuz I cant use htmls)
PHP код:
CreateRoamerZombies()
{
new str[14], _rand = random(sizeof(ZombiesSpawnCords)), _thenpc;
for(new o; o<MAX_ZOMBIES; o++)
{
_rand = random(sizeof(ZombiesSpawnCords));
format(str, sizeof(str), "Zombie_%d", _thenpc);
_thenpc = FCNPC_Create(str);
FCNPC_Spawn(_thenpc, random(311), ZombiesSpawnCords[_rand][0], ZombiesSpawnCords[_rand][1], ZombiesSpawnCords[_rand][2] + 1.0);
zInfo[o][zLabel] = CreateDynamic3DTextLabel(""COL_RED"Roamer Zombie\n"COL_WHITE"Health: 100", -1, 0.0, 0.0, 0.2, 20.0, .attachedplayer = _thenpc, .testlos = 1);
zInfo[o][zID] = _thenpc;
zInfo[o][zType] = ZOMBIE_TYPE_ROAMER;
Re: Invalid function or declaration -
Kaliber - 17.12.2018
This shows us, just where you use it.
Not how you declared it.
We need to see the
Code and the defines of
PHP код:
ITEM_ID_CIVILIAN_SKIN
Re: Invalid function or declaration -
DarkMythHunter - 17.12.2018
I don't see anything related about that. I don't even know myself if the script works correctly, that is why I am asking for help. I've sent the code, for you to check yourself tho.
Re: Invalid function or declaration -
Kaliber - 17.12.2018
We can't help you without that information.
And btw you send me nothing relevant.
As mentioned now 3 times, we need something like new zInfo
maybe its in an include..or somewhere else..it must be there..so, yeah check it out xD