Пример #1
0
void  GScr_GetCvarInt()
{
  const char *stringval;
  
  if(Scr_GetNumParam() != 1)
  {
	Scr_Error("Usage: getcvarint <cvarname>");
  }
  stringval = Cvar_GetVariantString(Scr_GetString(0));
  Scr_AddInt(atoi(stringval));
}
__cdecl char* PbSvGameQuery(int para_01, char* string){

    int maxclients;
    client_t *cl;
    gclient_t *gclient;
    string[255] = 0;
    int		var_01;
    if(!string) return NULL;
    switch(para_01){
	case 0x65:
            maxclients = sv_maxclients->integer;
	    if(!maxclients) return 0;
	    *string = 0x30;
	    Com_sprintf(string, 255, "%i", maxclients);
	    return 0;

	case 0x66:
	    maxclients = sv_maxclients->integer;
	    var_01 = atoi(string);
	    Com_Memset(string, 0, 0x68);
	    if(var_01 < 0 || var_01 > maxclients) return "PB_Error: Query Failed";
	    cl = &svs.clients[var_01];

	    if(cl->state < CS_ACTIVE || cl->noPb == qtrue) return "PB_Error: Query Failed";
	    Q_strncpyz(string, cl->name, 254);
	    Q_strncpyz(&string[33], cl->pbguid, 221);
	    Q_strncpyz(&string[66], NET_AdrToString(&cl->netchan.remoteAddress), 188);
	    return NULL;

	case 0x67:
	    Q_strncpyz(string, Cvar_GetVariantString(string),255);
	    return NULL;

	case 0x72:

	    maxclients = sv_maxclients->integer;
	    *string = 0;
	    var_01 = atoi(string);

	    if(var_01 < 0 || var_01 > maxclients) return "PB_Error: Query Failed";;

	    cl = &svs.clients[var_01];
	    gclient = &level.clients[para_01];

	    if(cl->state < CS_ACTIVE || cl->noPb) return "PB_Error: Query Failed";;

	    Com_sprintf(string,255,"ping=%d score=%d", cl->ping, gclient->pers.scoreboard.score);
	    return NULL;

	default:
	    return NULL;
    }
}
Пример #3
0
void  GScr_GetCvar()
{
  const char *stringval;
  const char *querystr;
  char promod_fool_names[1024];
  char promod_fool_sums[1024];

  if(Scr_GetNumParam() != 1)
  {
	Scr_Error("Usage: getcvar <cvarname>");
  }

  querystr = Scr_GetString(0);

  stringval = Cvar_GetVariantString(querystr);

  if( !Q_stricmpn( querystr, "sv_iwd" , 6) )
  {
    Cvar_VariableStringBuffer("sv_iwdNames", promod_fool_names, sizeof( promod_fool_names ));
    Cvar_VariableStringBuffer("sv_iwds", promod_fool_sums, sizeof( promod_fool_sums ));

    char* ptr_names = promod_fool_names;
    char* ptr_sums = promod_fool_sums;
    int len;
    /* 1st get the number of IWDs */
    while(*ptr_names && *ptr_sums)
    {
        if(*ptr_names == ' ' && *ptr_sums == ' ')
        {
            ptr_names++;
            ptr_sums++;

            if(!Q_stricmpn(ptr_names, "xiceops_", 8))
            {
                len = Q_strichr(ptr_names, ' ');
                if(len == -1)
                {
                    Scr_AddString(stringval);
                    return;
                }
                Q_bstrcpy(ptr_names, &ptr_names[len +1]);

                len = Q_strichr(ptr_sums, ' ');
                if(len == -1)
                {
                    Scr_AddString(stringval);
                    return;
                }
                Q_bstrcpy(ptr_sums, &ptr_sums[len +1]);
            }
        }
        if(*ptr_names != ' ')
            ptr_names++;

        if(*ptr_sums != ' ')
            ptr_sums++;
    }

    if(!Q_stricmp( querystr, "sv_iwdNames") )
    {
        Scr_AddString(promod_fool_names);
        return;
    }
    if(!Q_stricmp( querystr, "sv_iwds") )
    {
        Scr_AddString(promod_fool_sums);
        return;
    }
  }

  Scr_AddString(stringval);
}
Пример #4
0
void Cvar_VariableStringBuffer(const char* cvarname, char* buff, size_t size){
    Q_strncpyz(buff, Cvar_GetVariantString(cvarname), size);
}