void ServerCommand (void) { char *cmd; if(hdll == NULL) return; cmd = gi.argv(1); if(!q2a_strcmp(cmd, "lua_reload")) { q2a_lua_reload(); return; } if(!q2a_strcmp(cmd, "lua_init")) { q2a_lua_init(); return; } if(!q2a_strcmp(cmd, "lua_shutdown")) { q2a_lua_shutdown(); return; } if(!q2a_strcmp(cmd, "lua_restart")) { q2a_lua_shutdown(); q2a_lua_init(); return; } if(q2a_lua_ServerCommand(cmd)) return; dllglobals->ServerCommand(); copyDllInfo(); }
/* =============== Info_ValueForKey Searches the string for the given key and returns the associated value, or an empty string. =============== */ char *Info_ValueForKey(char *s, char *key) { char pkey[512]; static char value[2][512];// use two buffers so compares // work without stomping on each other static int valueindex; char *o; valueindex ^= 1; if (*s == '\\') s++; while (1) { o = pkey; while (*s != '\\') { if (!*s) return ""; *o++ = *s++; } *o = 0; s++; o = value[valueindex]; while (*s != '\\' && *s) { if (!*s) return ""; *o++ = *s++; } *o = 0; if (!q2a_strcmp (key, pkey) ) return value[valueindex]; if (!*s) return ""; s++; } }
void checkVariableValid(edict_t *ent, int client, char *value) { switch (checkvarList[proxyinfo[client].checkvar_idx].type) { case CV_CONSTANT: if (q2a_strcmp(checkvarList[proxyinfo[client].checkvar_idx].value, value) != 0) { sprintf(buffer, "%s %s\n", checkvarList[proxyinfo[client].checkvar_idx].variablename, checkvarList[proxyinfo[client].checkvar_idx].value); stuffcmd(ent, buffer); } break; case CV_RANGE: { double fvalue = q2a_atof(value); if (fvalue < checkvarList[proxyinfo[client].checkvar_idx].lower) { sprintf(buffer, "%s %g\n", checkvarList[proxyinfo[client].checkvar_idx].variablename, checkvarList[proxyinfo[client].checkvar_idx].lower); stuffcmd(ent, buffer); } else if (fvalue > checkvarList[proxyinfo[client].checkvar_idx].upper) { sprintf(buffer, "%s %g\n", checkvarList[proxyinfo[client].checkvar_idx].variablename, checkvarList[proxyinfo[client].checkvar_idx].upper); stuffcmd(ent, buffer); } break; } } }