Code:
How to find IsPlayer Index:
string search "effects/nightvision" and xref until you see a function looking similar to this:
.text:103E2066 0F 84 01 01 00 00 jz loc_103E216D
.text:103E206C F3 0F 10 86 D8 A3 00 00 movss xmm0, dword ptr [esi+0A3D8h]
.text:103E2074 0F 57 C9 xorps xmm1, xmm1
.text:103E2077 0F 2F C1 comiss xmm0, xmm1
.text:103E207A 0F 86 ED 00 00 00 jbe loc_103E216D
.text:103E2080 8B 0D B4 1D 23 15 mov ecx, dword_15231DB4
.text:103E2086 6A 00 push 0
.text:103E2088 6A 01 push 1
.text:103E208A 68 84 1D AC 10 push offset aClienteffectTe ; "ClientEffect textures"
.text:103E208F 8B 01 mov eax, [ecx]
.text:103E2091 68 0C 24 B3 10 push offset aEffectsNightvi ; "effects/nightvision"
.text:103E2096 FF 90 50 01 00 00 call dword ptr [eax+150h]
.text:103E209C 8B F8 mov edi, eax
.text:103E209E 85 FF test edi, edi
.text:103E20A0 0F 84 C7 00 00 00 jz loc_103E216D
.text:103E20A6 8B 55 08 mov edx, [ebp+arg_0]
.text:103E20A9 33 C9 xor ecx, ecx ; int
.text:103E20AB 6A 00 push 0 ; int
.text:103E20AD 6A 00 push 0 ; char
.text:103E20AF C7 45 FC 00 FF 00 FF mov [ebp+var_4], 0FF00FF00h
.text:103E20B6 FF 72 18 push dword ptr [edx+18h] ; int
.text:103E20B9 FF 72 10 push dword ptr [edx+10h] ; int
.text:103E20BC FF 72 08 push dword ptr [edx+8] ; int
.text:103E20BF 8B 12 mov edx, [edx]
.text:103E20C1 E8 8A 74 F0 FF call sub_102E9550
.text:103E20C6 F3 0F 10 86 D8 A3 00 00 movss xmm0, dword ptr [esi+0A3D8h]
.text:103E20CE 83 C4 14 add esp, 14h
.text:103E20D1 80 BE 89 A3 00 00 00 cmp byte ptr [esi+0A389h], 0
.text:103E20D8 74 12 jz short loc_103E20EC
.text:103E20DA F3 0F 58 05 44 41 C3 10 addss xmm0, ds:flt_10C34144
.text:103E20E2 F3 0F 5D 05 00 43 C3 10 minss xmm0, ds:dword_10C34300
.text:103E20EA EB 0F jmp short loc_103E20FB
Create Pseudo:
void __userpurge sub_103E2020(int a1@<edi>, int *a2)
{
void **v2; // esi
int v3; // eax
void **v4; // edi
int v5; // edi
int v6; // edx
float v7; // xmm0_4
float v8; // xmm0_4
int v9; // ecx
int v10; // esi
int v11; // [esp-4h] [ebp-Ch]
int v12; // [esp+4h] [ebp-4h]
v2 = dword_151A57D8;
if ( dword_151A57D8 )
{
v11 = a1;
if ( (*(*dword_151A57D8 + 290))(dword_151A57D8) == 4 )
{
v3 = (*(*v2 + 291))(v2);
v4 = v3;
if ( v3 )
{
if ( (*(*v3 + 620))(v3) ) <-------------------- 620 in hex is 0x240 and 620 / 4 = 155 which is the current index Voila.
v2 = v4;
}
}
if ( v2 )
{
if ( *(v2 + 10486) > 0.0 )
{
v5 = (*(*dword_15231DB4 + 336))("effects/nightvision", "ClientEffect textures", 1, 0);
if ( v5 )
{
v12 = -16711936;
v6 = *a2;
sub_102E9550(0, a2[2], a2[4], a2[6], 0, 0);
v7 = *(v2 + 10486);
if ( *(v2 + 41865) )
v8 = fminf(v7 + 15.0, 255.0);
else
v8 = fmaxf(v7 - 40.0, 0.0);
v9 = dword_152193AC;
*(v2 + 10486) = v8;
HIBYTE(v12) = v8;
(*(*v9 + 116))(&v12, v5, 1, v11);
v10 = (*(*dword_15231DB4 + 460))();
if ( v10 )
(*(*v10 + 8))(v10);
(*(*v10 + 324))(v10);
(*(*dword_152193AC + 116))(&v12, v5, 1);
(*(*v10 + 324))(v10, v5);
(*(*v10 + 12))(v10);
(*(*v10 + 4))(v10);
}
}
}
}
}