PAWN crashes -
TheSimpleGuy - 18.10.2014
pawn Code:
new aWeaponID[15][] = {
{"342"}, {"344"}, {"346"}, {"347"}, {"348"}, {"349"}, {"350"}, {"351"}, {"352"}, {"353"},
{"355"}, {"356"}, {"357"}, {"358"}
};
Try to put it on a new .pwn file, you'll see that your compiler will crash, and I don't know why. Help.
Re: PAWN crashes -
dominik523 - 18.10.2014
Code:
new aWeaponID[] = {
{"342"}, {"344"}, {"346"}, {"347"}, {"348"}, {"349"}, {"350"}, {"351"}, {"352"}, {"353"},
{"355"}, {"356"}, {"357"}, {"358"}
};
You are putting weapons IDs which can go into one dimensional array into two dimensional array.
Re: PAWN crashes -
TheSimpleGuy - 18.10.2014
Alright. Thanks, lol. Repped.
Re: PAWN crashes -
TheSimpleGuy - 18.10.2014
** Sorry for double post. I forgot the EDIT button
New problem:
pawn Code:
new aWeaponID[15] = {
{342}, {344}, {346}, {347}, {348}, {349}, {350}, {351}, {352}, {353},
{355}, {356}, {357}, {358}
};
// some codes
if(j == 0) id = AddStaticPickup(aWeaponID[0], 1, x, y, z, -1);
if(j == 1) id = AddStaticPickup(aWeaponID[1], 1, x, y, z, -1);
if(j == 2) id = AddStaticPickup(aWeaponID[2], 1, x, y, z, -1);
if(j == 3) id = AddStaticPickup(aWeaponID[3], 1, x, y, z, -1);
if(j == 4) id = AddStaticPickup(aWeaponID[4], 1, x, y, z, -1);
if(j == 5) id = AddStaticPickup(aWeaponID[5], 1, x, y, z, -1);
if(j == 6) id = AddStaticPickup(aWeaponID[6], 1, x, y, z, -1);
if(j == 7) id = AddStaticPickup(aWeaponID[7], 1, x, y, z, -1);
if(j == 8) id = AddStaticPickup(aWeaponID[8], 1, x, y, z, -1);
if(j == 9) id = AddStaticPickup(aWeaponID[9], 1, x, y, z, -1);
if(j == 10) id = AddStaticPickup(aWeaponID[10], 1, x, y, z, -1);
if(j == 11) id = AddStaticPickup(aWeaponID[11], 1, x, y, z, -1);
if(j == 12) id = AddStaticPickup(aWeaponID[12], 1, x, y, z, -1);
if(j == 13) id = AddStaticPickup(aWeaponID[13], 1, x, y, z, -1);
if(j == 14) id = AddStaticPickup(aWeaponID[14], 1, x, y, z, -1);
if(j == 15) id = AddStaticPickup(aWeaponID[0], 1, x, y, z, -1);
Compile and check what's the error.
Re: PAWN crashes -
dusk - 18.10.2014
Why would weapon IDs be strings?
EDIT: and you probably get errors because you pass a string when a function expects an integer.
Re: PAWN crashes -
ExtremeHostOwner - 18.10.2014
Why can't you show the error
Re: PAWN crashes -
Stinged - 18.10.2014
pawn Code:
new aWeaponID[15] =
{
342, 344, 346, 347, 348, 349, 350, 351, 352, 353,
355, 356, 357, 358
};
Re: PAWN crashes -
Yera96 - 18.10.2014
Why don't you use
pawn Code:
if(j != 15) id = AddStaticPickup(aWeaponID[j], 1, x, y, z, -1);
else id = AddStaticPickup(aWeaponID[0], 1, x, y, z, -1);
And do what Stinged posted.
Re: PAWN crashes -
Stanford - 18.10.2014
extra information: learn how to use switch-cases instead - more efficient and faster than using if conditions!