PDA

View Full Version : Array sizes not matching in enum char


AzaZPPL
03-03-2016, 04:47
I've been trying to figure this one out without any luck.



#define MAX_RADIO 512

enum RadioOptions
{
Radio_Volume,
Char:Radio_Url[MAX_RADIO],
bool:Radio_Active,
}

g_client[MAXPLAYERS + 1][RadioOptions];

public void OnClientPutInServer(int client)
{
g_client[client][Radio_Volume] = 20;
g_client[client][Radio_Url] = "";
g_client[client][Radio_Active] = false;
}


My first question is why does it throw errors if I try to create an enum like this:

enum RadioOptions
{
Radio_Volume,
char Radio_Url[MAX_RADIO],
bool Radio_Active,
}


My second question is why does this:
g_client[client][Radio_Url] = "";
Generate this error:
error 047: array sizes do not match, or destination array is too small

Phil25
03-03-2016, 04:57
AFAIK, new syntax declarations don't work with enums well. You ought to use "String:".

AzaZPPL
03-09-2016, 17:25
For anyone still figuring how to fix this.
I've figured it out. You just gotta stop being a retard like me.

g_client[client][Radio_Url] = "";

FormatEx(g_client[client][Radio_Url], MAX_RADIO, "")

And make sure to change

Char:Radio_Url[MAX_RADIO],

String:Radio_Url[MAX_RADIO],

Grey83
03-10-2016, 10:22
enum RadioOptions
{
Radio_Volume,
...
}Probably should be as follows:enum RadioOptions
{
int Radio_Volume,
...
}?

AzaZPPL
03-10-2016, 10:26
Probably should be as follows:enum RadioOptions
{
int Radio_Volume,
...
}?

Gives out an error. By default Radio_Volume is already an int.

lingzhidiyu
03-15-2016, 05:56
Format(g_client[client][Radio_Url], MAX_RADIO, "");