SA-MP Forums Archive
Help, float arrays error! - 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: Help, float arrays error! (/showthread.php?tid=579652)



Help, float arrays error! - Neos07 - 28.06.2015

This is the code:
new Float:Pos[3];

pos = {10.0, 10.0, 10.0};

The error: tag mismatch.

Thank you in advance!


Re: Help, float arrays error! - FilesMAker - 28.06.2015

when putting data you should declare the slot in this case :
pos[0] = 10.0
pos[1] = 10.0
pos[2] = 10.0

or declare values from begining:
new Float:Pos[3] = {
10.0, 10.0, 10.0
};


Re: Help, float arrays error! - maximthepain - 28.06.2015

Quote:
Originally Posted by Neos07
Посмотреть сообщение
This is the code:
new Float:Pos[3];

pos = {10.0, 10.0, 10.0};

The error: tag mismatch.

Thank you in advance!
I have tried this code:
Код:
new Pos[3];
Pos = {10.0,10.0,10.0};
It worked. maybe you didnt notice the fact there is 'P' and not 'p'?

You can also do it this way:
Код:
new Float:Pos[3];
Pos[0] = 10.0;
Pos[1] = 10.0;
Pos[2] = 10.0;



Re: Help, float arrays error! - Neos07 - 28.06.2015

Quote:
Originally Posted by FilesMAker
Посмотреть сообщение
when putting data you should declare the slot in this case :
pos[0] = 10.0
pos[1] = 10.0
pos[2] = 10.0

or declare values from begining:
new Float:Pos[3] = {
10.0, 10.0, 10.0
};
Thank you! But I know this method, just because I will use it many time and I wanna save some place and time.
It works fine with integers.


Re: Help, float arrays error! - Neos07 - 28.06.2015

Quote:
Originally Posted by maximthepain
Посмотреть сообщение
I have tried this code:
Код:
new Pos[3];
Pos = {10.0,10.0,10.0};
It worked. maybe you didnt notice the fact there is 'P' and not 'p'?

You can also do it this way:
Код:
new Float:Pos[3];
Pos[0] = 10.0;
Pos[1] = 10.0;
Pos[2] = 10.0;
Thank you for your reply, but it was just an example of my problem! So it doesn't matter if P or p, I got about 23 errors because I'm using it too much!