PAWN crashes
#1

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

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

Alright. Thanks, lol. Repped.
Reply
#4

** 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.
Reply
#5

Why would weapon IDs be strings?

EDIT: and you probably get errors because you pass a string when a function expects an integer.
Reply
#6

Why can't you show the error
Reply
#7

pawn Code:
new aWeaponID[15] =
{
    342, 344, 346, 347, 348, 349, 350, 351, 352, 353,
    355, 356, 357, 358
};
Reply
#8

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

extra information: learn how to use switch-cases instead - more efficient and faster than using if conditions!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)