View Single Post
SawceGal
Junior Member
Join Date: May 2020
Old 05-21-2020 , 21:37   Re: Global Array + Enum Struct
Reply With Quote #3

I'm using 1.10, I can upgrade to 1.11 if the bug is fixed.

It won't compile "cannot call methods on an array", but also gives a tag mismatch warning.

This is an example of what I'm trying to do:

PHP Code:
#include <sourcemod>
#include <cstrike>

enum struct enumWeaponClass 

    
char WEAPONCLASS[32]; 
    
int WEAPONLEVEL
    
CSWeaponID WEAPONID


enumWeaponClass gWeaponClass[][] =  

    {
"M4A1 Anti Zombie"4CSWeapon_M4A1},
    {
"Scar"8CSWeapon_SCAR20
}

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_playerclass"ConCmdWeaponClass);
}

public 
Action ConCmdWeaponClass(int clientint args)
{
    for(
int isizeof(gWeaponClass); i++)
        
PrintToChat(client"Class: %s."gWeaponClass[i].WEAPONCLASS);

What would be the best way to achieve that while keeping the code simple to read and easy to modify?
SawceGal is offline