Weird problem with ints in an array
#1

I'm trying to store data for vehicles.

This is my array:

pawn Код:
enum VEnum
{
    locked,
    lastDriver,
    type
};
new VehStats[MAX_VEHICLES][VEnum];

pawn Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
      VehStats[i][locked] = 0;
}
printf("LOCKED: %i", VehStats[1][locked]); // Prints LOCKED: 1150318466
Right after this loop I print the value of VehStats[vehicleid][locked] and it has somehow become 1150318466.


EDIT:

http://pastebin.com/NDzhE2RT I'm having the problem in this include. line 158 does print VehStats[vehicleid][locked] correctly but line 164 doesn't.
Reply
#2

First wanna to know why u have written 1 here in vehstats[1]...
Use %d and then check
Reply
#3

Quote:
Originally Posted by PrinceKumar
Посмотреть сообщение
Use %d and then check
Still having the problem.
Reply
#4

Check my post i have edited it
Reply
#5

Quote:
Originally Posted by PrinceKumar
Посмотреть сообщение
First wanna to know why u have written 1 here in vehstats[1]...
Just for debugging
Reply
#6

I tested your code and it prints 0 for me.

http://puu.sh/8hQEc.png
Reply
#7

Quote:
Originally Posted by Djole1337
Посмотреть сообщение
I tested your code and it prints 0 for me.

http://puu.sh/8hQEc.png
Weird, this also works for me in the GameModeInit..

http://pastebin.com/NDzhE2RT I'm having the problem in this include. line 158 does print the int correctly but line 164 doesn't.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)