alliedmodders / amxmodx

AMX Mod X - Half-Life 1 Scripting and Administration
http://www.amxmodx.org/
494 stars 197 forks source link

Array inside enum problem #580

Closed justgo97 closed 6 years ago

justgo97 commented 6 years ago

Code to reproduce the issue :

#include <amxmodx>

enum _:ORIGIN_DATA{
    Float:Origin[3],
    OriginTeam
}

public plugin_init()
{
    new TestOrigin[ORIGIN_DATA]

    TestOrigin[Origin][0] = 1.0

    SpawnEnt(TestOrigin[Origin])
}

SpawnEnt( Float:EntOrigin[3] )
{
    server_print("EntOrigin[0]=%f", EntOrigin[0])
}

Error Output :

AMX Mod X Compiler 1.8.3-dev+5181
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

g:\2018\amx\Array_Tag.sma(14) : error 047: array sizes do not match, or destination array is too small

1 Error.
rtxa commented 6 years ago

This SpawnEnt( Float:EntOrigin[3] ) to this SpawnEnt( Float:EntOrigin[] )

Arkshine commented 6 years ago

Sounds like a bug. You should be able to pass an array of the same size.

Looks like it works in SM compiler, a fix should likely exists already.

justgo97 commented 6 years ago

@rtxa It compiles but it gives wrong value :

EntOrigin[0]=1065353216

Edit : Actually it works i was trying to show float as integer...

But still like @Arkshine said it should allow to pass the array with the same size