help with arrays
#3

Quote:
Originally Posted by shitbird
Посмотреть сообщение
What errors are you getting, exactly?

I'm not sure, but I believe you're forgetting the NULL character at the end, please correct me - anyone - if I'm mistaken.

I believe your code right now, is the same as this:
pawn Код:
new a[6][] = {"M4", "RPG", "DOUBLE_RPG", "DOUBLE_M4", "TRIPLE_RPG", "SAW", "\0"}; // 7 cells, but you've only given it 6.
If I'm right, you're going to need 7 cells (counting the NULL character) in order for you to avoid exceeding array size errors.

pawn Код:
new a[7][] = {"M4", "RPG", "DOUBLE_RPG", "DOUBLE_M4", "TRIPLE_RPG", "SAW"}; // a +1
tnx for the comment.
i tried to do this:

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{

    for(new i = 0; i<sizeof(a); i++)
        if(pickupid == a[i]) GivePlayerMoney(playerid,10000);
    return 1;
}
while using the array "a", and get this error:
Код:
error 033: array must be indexed (variable "a")
about the null character - first time im hearing about that. (and i tried, but it does not worked)
Reply


Messages In This Thread
help with arrays - by lidor5353 - 25.08.2012, 10:36
Re: help with arrays - by shitbird - 25.08.2012, 10:44
Re: help with arrays - by lidor5353 - 25.08.2012, 11:00
Re: help with arrays - by shitbird - 25.08.2012, 11:12
Re: help with arrays - by lidor5353 - 25.08.2012, 19:54

Forum Jump:


Users browsing this thread: 2 Guest(s)