View Single Post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-17-2012 , 05:43   Re: how to copy a float to a float inside enum ?
Reply With Quote #2

Quote:
is it because TempData only consists of Floats
It's because your members (bd_*) are floats and TempData would be a float too, same tag, no error.
It's fine to do it like that, if you have only floats as members.

Quote:
if it consisted of a float and an integer I would need to declare it as usual without Float type
In case of others type then float, you have to cast the value.

new TempData[PosData];
new Float:origin[3];

TempData[bd_pos] = origin;

In this example, TempData is untagged, while origin is tagged with Float. That's why you have an error.
To remove the error, you have to untag origin, by doing either "_:origin" or "any:origin".
As note, you have only an error with strong tag (started by an upper-case letter). If origin was using a weak tag (started by an lower-case letter), the compiler casts implicitly the value.
__________________

Last edited by Arkshine; 11-17-2012 at 05:43.
Arkshine is offline