Lets focus on one thing a time.
You can find more info from here
[TUT] SourcePawn Scripting - Tips, Basics to Advanced
enum struct
https://wiki.alliedmods.net/SourcePa...x#Enum_Structs
Don't know where you have copy that code, but you are not showing
...part.
But if I have to guess, it is global variable
ArrayList, and you are going to push one of enum struck into array.
Also, eGlove struct appear later than eClient, what use eGlove, this will give you compile error.
You need code eGlove above eClient struct. (Need to be right order)
I have not done this complex code before. And I'm not sure do ArrayList inside enum stuct even work after saving in array...
Maybe if simplified coding :/
Try this. I maybe have created ArrayList g_arClients in wrong order. Not sure.
Code:
eClient size 15
[SM] Plugin test.smx reloaded successfully.
sm_test
clientStruct.gloveT.skinDefIndex = 2
clientStruct.gloveT.gloveDefIndex = 2
clientStruct.gloveT.floatValue = 2.200000
clientStruct.gloveT.seed = 2
PHP Code:
ArrayList g_arClients;
enum eWaitingType
{
NONE = 0,
WAITING_TAG = 1,
WAITING_W_SEED = 2,
WAITING_G_SEED = 3,
}
enum struct eGlove
{
int gloveDefIndex;
int skinDefIndex;
float floatValue;
int seed;
}
// struct client
enum struct eClient
{
eWaitingType waitingType;
int TN[2]; // TD[0] = team, TD[1] = weaponnum
ArrayList arWeaponsT;
ArrayList arWeaponsCT;
eGlove gloveT;
eGlove gloveCT;
int knifeTDefIndex;
int knifeCTDefIndex;
}
public int SetGloveSkinDefIndex(int client, int team, int gloveDefIndex, int skinDefIndex)
{
eClient clientStruct;
g_arClients.GetArray(client, clientStruct, sizeof(clientStruct));
if (team == 0)
{
return SetGloveSkinDefIndex(client, 2, gloveDefIndex, skinDefIndex) + SetGloveSkinDefIndex(client, 3, gloveDefIndex, skinDefIndex);
}
else if (team == 2)
{
clientStruct.gloveT.skinDefIndex = skinDefIndex;
clientStruct.gloveT.gloveDefIndex = gloveDefIndex;
}
else if (team == 3) {
clientStruct.gloveCT.skinDefIndex = skinDefIndex;
clientStruct.gloveCT.gloveDefIndex = gloveDefIndex;
}
return g_arClients.SetArray(client, clientStruct, sizeof(clientStruct));
}
public int SetGloveFloatValue(int client, int team, float floatValue)
{
eClient clientStruct;
g_arClients.GetArray(client, clientStruct, sizeof(clientStruct));
if (team == 0)
{
return SetGloveFloatValue(client, 2, floatValue) + SetGloveFloatValue(client, 3, floatValue);
}
else if (team == 2)
{
clientStruct.gloveT.floatValue = floatValue;
}
else if (team == 3)
{
clientStruct.gloveCT.floatValue = floatValue;
}
return g_arClients.SetArray(client, clientStruct, sizeof(clientStruct));
}
public int SetGloveSeed(int client, int team, int seed)
{
eClient clientStruct;
g_arClients.GetArray(client, clientStruct, sizeof(clientStruct));
if (team == 0)
{
return SetGloveSeed(client, 2, seed) + SetGloveSeed(client, 3, seed);
}
else if (team == 2)
{
clientStruct.gloveT.seed = seed;
}
else if (team == 3) {
clientStruct.gloveCT.seed = seed;
}
return g_arClients.SetArray(client, clientStruct, sizeof(clientStruct));
}
public void OnPluginStart()
{
PrintToServer("eClient size %i", sizeof(eClient));
g_arClients = new ArrayList(sizeof(eClient), MAXPLAYERS);
RegConsoleCmd("sm_test", test);
}
public Action test(int client, int args)
{
SetGloveSkinDefIndex(client, 2, 2, 2);
SetGloveFloatValue(client, 2, 2.2);
SetGloveSeed(client, 2, 2);
eClient clientStruct;
g_arClients.GetArray(client, clientStruct, sizeof(clientStruct));
PrintToServer("clientStruct.gloveT.skinDefIndex = %i\nclientStruct.gloveT.gloveDefIndex = %i\n\
clientStruct.gloveT.floatValue = %f\nclientStruct.gloveT.seed = %i",
clientStruct.gloveT.skinDefIndex,
clientStruct.gloveT.gloveDefIndex,
clientStruct.gloveT.floatValue,
clientStruct.gloveT.seed);
return Plugin_Handled;
}
__________________