Advertisement
Guest User

setinfo

a guest
Jul 22nd, 2015
679
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.10 KB | None | 0 0
  1. void __cdecl setinfo(int a1)
  2. {
  3.   int v1; // edi@3
  4.   int v2; // esi@3
  5.   int v3; // eax@13
  6.   int v4; // eax@14
  7.   int v5; // ebx@20
  8.   int v6; // edx@20
  9.   char v7; // cl@21
  10.   BYTE *v8; // esi@27
  11.   int v9; // eax@28
  12.   BYTE *v10; // eax@28
  13.   int v11; // [sp+10h] [bp-40h]@3
  14.   int v12; // [sp+18h] [bp-38h]@0
  15.   int (__stdcall **v13)(char); // [sp+1Ch] [bp-34h]@30
  16.   int v14; // [sp+20h] [bp-30h]@30
  17.  
  18.   if ( *(_DWORD *)a1 != 3 )
  19.   {
  20.     Msg("Syntax: setinfo <key> <value>\n");
  21.     return;
  22.   }
  23.   v1 = *(_DWORD *)(a1 + 1036);
  24.   v11 = *(_DWORD *)(a1 + 1040);
  25.   v2 = (*(int (__stdcall **)(_DWORD))(*(_DWORD *)dword_10855E68 + 60))(*(_DWORD *)(a1 + 1036));
  26.   sub_102F8280("sv_cheats");
  27.   if ( !v2 )
  28.   {
  29.     v5 = (*(int (__stdcall **)(unsigned int))(*(_DWORD *)g_pMemAlloc + 4))(strlen((const char *)v1) + 1);
  30.     v6 = v1;
  31.     do
  32.     {
  33.       v7 = *(_BYTE *)v6++;
  34.       *(_BYTE *)(v5 - v1 + v6 - 1) = v7;
  35.     }
  36.     while ( v7 );
  37.     if ( (*(int (__stdcall **)(signed int))(*(_DWORD *)g_pMemAlloc + 4))(88) )
  38.       v2 = sub_102F79D0(v5, &SrcBuf, 512, "Custom user info value");
  39.     else
  40.       v2 = 0;
  41. LABEL_25:
  42.     (*(void (__thiscall **)(int, int))(*(_DWORD *)(v2 + 24) + 12))(v2 + 24, v11);
  43.     if ( *(_DWORD *)(dword_105D2284 + 232) >= 2 )
  44.     {
  45.       if ( *(_DWORD *)(v2 + 20) & 0x1000 )
  46.       {
  47.         v8 = (BYTE *)"FCVAR_NEVER_AS_STRING";
  48.       }
  49.       else
  50.       {
  51.         v9 = *(_DWORD *)(v2 + 28);
  52.         v8 = &SrcBuf;
  53.         v10 = *(BYTE **)(v9 + 36);
  54.         if ( v10 )
  55.           v8 = v10;
  56.       }
  57.       sub_100C2250(&v13);
  58.       v13 = &off_104B8230;
  59.       v14 = (int)off_104B8268;
  60.       sub_100F45B0(v1, v8);
  61.       (*(void (__stdcall **)(int *, _DWORD, _DWORD))(**(_DWORD **)(dword_105D2284 + 148) + 168))(&v13, 0, 0);
  62.       sub_100C21D0(&v13);
  63.     }
  64.     return;
  65.   }
  66.   if ( (unsigned __int8)(*(int (__thiscall **)(int))(*(_DWORD *)v2 + 4))(v2) )
  67.   {
  68.     Msg("Name %s is already registered as console command\n", v1);
  69.     return;
  70.   }
  71.   if ( !(unsigned __int8)(*(int (__thiscall **)(int, signed int))(*(_DWORD *)v2 + 8))(v2, 512) )
  72.   {
  73.     Msg("Convar %s is already registered but not as user info value\n", v1);
  74.     return;
  75.   }
  76.   if ( (unsigned __int8)(*(int (__thiscall **)(int, signed int))(*(_DWORD *)v2 + 8))(v2, 0x400000)
  77.     && *(_DWORD *)(dword_105D2284 + 232) >= 2
  78.     && (!(unsigned __int8)(*(int (__thiscall **)(int, signed int))(*(_DWORD *)v2 + 8))(v2, 512)
  79.      || !dword_1084D9FC
  80.      || !(unsigned __int8)(*(int (__stdcall **)(_DWORD))(*(_DWORD *)dword_1084D9FC + 436))(0)) )
  81.   {
  82.     v3 = (*(int (__thiscall **)(int))(*(_DWORD *)v2 + 24))(v2);
  83.     ConMsg("Can't change %s when playing, disconnect from the server or switch team to spectators\n", v3);
  84.     return;
  85.   }
  86.   v4 = sub_1022D130();
  87.   if ( v4 == 2 || v4 == 4 || !(unsigned __int8)(*(int (__thiscall **)(_DWORD, signed int))(*(_DWORD *)v2 + 8))(v2, 2) )
  88.   {
  89.     if ( (unsigned __int8)(*(int (__thiscall **)(_DWORD, signed int))(*(_DWORD *)v2 + 8))(v2, 0x4000)
  90.       && !*(_DWORD *)(v12 + 48) )
  91.     {
  92.       Msg("Convar %s is marked as cheat and cheats are off\n", v1);
  93.       return;
  94.     }
  95.     goto LABEL_25;
  96.   }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement