View Single Post
Author Message
axelnieves2012
Senior Member
Join Date: Oct 2014
Location: Argentina
Old 02-04-2019 , 17:55   [PROBLEM] Array sizes do not match
Reply With Quote #1

Hello, can anyone help me to find what am I doing wrong?
My plugin doesnt compile for some weird reason I can't understand.

PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#pragma semicolon 1
#define    DEBUG    0

#define TEAM_SURVIVOR    2
#define TEAM_INFECTED    3

#define FLAGS_SURVIVOR    1
#define FLAGS_INFECTED    2
#define FLAGS_ALIVE        4
#define FLAGS_DEAD        8
#define PLUGIN_VERSION    "1.0.0"

char L4D1_Z_CLASSES[6][8]     =    {"""Smoker""Boomer""Hunter""Witch""Tank"};
char L4D1_S_CLASSES[4][8]    =    {"Bill""Zoey""Francis""Louis"};
char L4D2_Z_CLASSES[9][8]    =    {"""Smoker""Boomer""Hunter""Spitter""Jockey""Charger""Witch""Tank"};
char L4D2_S_CLASSES[8][9]    =    {"Nick""Rochelle""Coach""Ellis""Bill""Zoey""Francis""Louis"};

new 
left4dead;

//SOME CODE HERE BLABLABLA

char[] StrGetZombieClass(zombie)
{
    if (
left4dead==1)
        return 
L4D1_Z_CLASSES[zombie];
    else
        return 
L4D2_Z_CLASSES[zombie];
}

char[] StrGetSurvivorClass(survivor)
{
    if (
left4dead==1)
        return 
L4D1_S_CLASSES[survivor];
    else
        return 
L4D2_S_CLASSES[survivor]; //ERROR HERE, IN THIS LINE

Error 047: array sizes do not match, or destination array is too small.


I can't understand why I am getting this error. I was not getting this error with zombie classes.
It was compiling alright.
I got this error when I added survivor classes.
If I remove that line, plugin compiles. But I need to return Survivor names as string.
And I dont think checking model is a good idea because I have joined server where survivors were using witch and tank models.

Any idea what's is wrong with my array?

Last edited by axelnieves2012; 02-05-2019 at 16:03.
axelnieves2012 is offline