The INTERFACEVERSION_SERVERGAMEDLL is probably no longer valid. There are several routines you can use to discover which version is valid. I'll look and post a link...
In the SDK it's defined as "ServerGameDLL005".
But with updates, the current interface version is "ServerGameDLL006".
Here's what I used to use ... I'm sure it could be different, but it's derived from the SourceMM files (I take ZERO credit for the following).
used like this:
Code:
if(!(gamedll = (IServerGameDLL*)GetAnyInterface ( gameServerFactory, INTERFACEVERSION_SERVERGAMEDLL)))
Code:
int CPlugin::FormatIface(char iface[], unsigned int maxlength) {
int length = (int)strlen(iface);
int i;
int num = 0;
for (i=length-1; i>=0; i--) {
if (!isdigit(iface[i])) {
if (i != length-1) {
num = 1;
}
break;
}
}
if ( (num && ((int)maxlength <= length)) || (!num && ((int)maxlength <= length+3)) )
return -1;
if (i != length-1)
num = atoi(&(iface[++i]));
num++;
Q_snprintf(&(iface[i]), 4, "%03d", num);
return num;
}
void *CPlugin::InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max, int *ret) {
char _if[257]; /* assume no interface goes beyond this */
size_t len = strlen(iface);
int num = 0;
void *pf = NULL;
if (max > IFACE_MAXNUM)
max = IFACE_MAXNUM;
if (len + 4 > sizeof(_if)) {
if (ret)
*ret = IFACE_FAILED;
return NULL;
}
strcpy(_if, iface);
do {
if ( (pf = (fn)(_if, ret)) != NULL )
break;
if (num > max)
break;
} while (( num = FormatIface(_if, len+1) ));
return pf;
}
void *CPlugin::GetAnyInterface(CreateInterfaceFn fn, const char *iface, int min) {
char buffer[257];
int len = static_cast<int>(strlen(iface));
int ret;
if (len > static_cast<int>(sizeof(buffer) - 4))
return NULL;
strcpy(buffer, iface);
if (min != -1) {
char *ptr = &buffer[len-1];
int digits = 0;
while (isdigit(*ptr) && digits <=3) {
*ptr = '\0';
digits++;
ptr--;
}
if (digits != 3) {
/* for now, assume this is an error */
strcpy(buffer, iface);
} else {
char num[4];
min = (min == 0) ? 1 : min;
Q_snprintf(num, sizeof(num), "%03d", min);
strcat(buffer, num);
}
}
return InterfaceSearch(fn, buffer, IFACE_MAXNUM, &ret);
}