Weird problem with ints in an array - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Weird problem with ints in an array (
/showthread.php?tid=508351)
Weird problem with ints in an array -
klimgorilla - 21.04.2014
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.
Re: Weird problem with ints in an array -
PrinceKumar - 21.04.2014
First wanna to know why u have written 1 here in vehstats[1]...
Use %d and then check
Re: Weird problem with ints in an array -
klimgorilla - 21.04.2014
Quote:
Originally Posted by PrinceKumar
Use %d and then check
|
Still having the problem.
Re: Weird problem with ints in an array -
PrinceKumar - 21.04.2014
Check my post i have edited it
Re: Weird problem with ints in an array -
klimgorilla - 21.04.2014
Quote:
Originally Posted by PrinceKumar
First wanna to know why u have written 1 here in vehstats[1]...
|
Just for debugging
Re: Weird problem with ints in an array -
Djole1337 - 21.04.2014
I tested your code and it prints 0 for me.
http://puu.sh/8hQEc.png
Re: Weird problem with ints in an array -
klimgorilla - 21.04.2014
Quote:
Originally Posted by Djole1337
|
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.