SA-MP Forums Archive
Value from array is not number? - 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: Value from array is not number? (/showthread.php?tid=363792)



Value from array is not number? - Killer#Mummy - 28.07.2012

Hi!

This is my array:

Код:
new Tuning_SpoilerData[][][] = {
{"Spoiler 1",200,1164},{"Spoiler 2",300,1163},{"Spoiler 3",400,1162}
};
I want to use the third value from array (as you can see it's integer) for object number. The problem is here:

Код:
		new ObjectID = CreateDynamicObject(Tuning_SpoilerData[row][2],0.0,0.0,0.0,0.0,0.0,0.0);
This line give me this error:

Код:
C:\Users\blabla\Desktop\CrazyStunts\gamemodes\CrazyStunts.pwn(613) : error 035: argument type mismatch (argument 1)
How to fix this?


Re: Value from array is not number? - ReVo_ - 28.07.2012

pawn Код:
enum eSpoilers {
SpoilerName[ 50 ],
FirstNumber,
SecondNumber
}
new Tuning_SpoilerData[][eSpoilers] = {
// add rows here
};

new ObjectID = CreateDynamicObject(Tuning_SpoilerData[row][SecondNumber],0.0,0.0,0.0,0.0,0.0,0.0);
If you do something like this maybe you avoid the problem


Re: Value from array is not number? - leonardo1434 - 28.07.2012

The parameters of createdynamicobject is a integer instead of a string.


Re: Value from array is not number? - Killer#Mummy - 28.07.2012

The thing is, that printf("%d",Tuning_SpoilerData[row][2]); prints the right number. I tried with strval but no success.