This repository has been archived by the owner on Oct 3, 2019. It is now read-only.
/
usermsg.cpp
132 lines (99 loc) · 2.71 KB
/
usermsg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include "usermsg.h"
pfnUserMsgHook pResetHUD;
pfnUserMsgHook pSetFOV;
pfnUserMsgHook pTeamInfo;
pfnUserMsgHook pCurWeapon;
pfnUserMsgHook pDeathMsg;
pfnUserMsgHook pWeaponList;
pfnUserMsgHook pAmmoX;
int ResetHUD( const char *pszName , int iSize , void *pbuf )
{
for ( int i = 1; i <= 32; i++ )
{
g_Player[i].bAlive = true;
}
g_Entity.ClearEntity();
g_Sound.ClearSound();
return pResetHUD( pszName , iSize , pbuf );
}
int SetFOV( const char *pszName , int iSize , void *pbuf )
{
BEGIN_READ( pbuf , iSize );
g_Local.iFOV = READ_BYTE();
if ( !g_Local.iFOV )
g_Local.iFOV = 90;
return pSetFOV( pszName , iSize , pbuf );
}
int TeamInfo( const char *pszName , int iSize , void *pbuf )
{
char tt_umsg[] = { 'T','E','R','R','O','R','I','S','T',0 };
char ct_umsg[] = { 'C','T',0 };
BEGIN_READ( pbuf , iSize );
int iIndex = READ_BYTE();
char *szTeam = READ_STRING();
if ( !native_strcmp( szTeam , tt_umsg ) )
{
if ( iIndex == g_Local.iIndex ) { g_Local.iTeam = 1; }
g_Player[iIndex].iTeam = 1;
}
else if ( !native_strcmp( szTeam , ct_umsg ) )
{
if ( iIndex == g_Local.iIndex ) { g_Local.iTeam = 2; }
g_Player[iIndex].iTeam = 2;
}
else
{
if ( iIndex == g_Local.iIndex ) { g_Local.iTeam = 0; }
g_Player[iIndex].iTeam = 0;
}
return pTeamInfo( pszName , iSize , pbuf );
}
int CurWeapon( const char *pszName , int iSize , void *pbuf )
{
BEGIN_READ( pbuf , iSize );
int iState = READ_BYTE();
int iWeaponID = READ_CHAR();
int iClip = READ_CHAR();
if ( iState )
{
g_Local.iWeaponID = iWeaponID;
g_Local.iClip = iClip;
}
return pCurWeapon( pszName , iSize , pbuf );
}
int DeathMsg( const char *pszName , int iSize , void *pbuf )
{
BEGIN_READ( pbuf , iSize );
int iKiller = READ_BYTE();
int iVictim = READ_BYTE();
g_Player[iVictim].bAlive = false;
g_Player[iVictim].bUpdated = false;
g_Player[iVictim].bVisible = false;
g_Player[iVictim].bEnableAim = false;
g_Player[iVictim].dwStartTime = 0;
g_Player[iVictim].isFov = false;
return pDeathMsg( pszName , iSize , pbuf );
}
int WeaponList( const char *pszName , int iSize , void *pbuf )
{
BEGIN_READ( pbuf , iSize );
char* weaponname = READ_STRING();
int ammo1type = READ_CHAR();
int max1 = READ_BYTE();
int ammo2type = READ_CHAR();
int max2 = READ_BYTE();
int slot = READ_CHAR();
int slotpos = READ_CHAR();
int id = READ_CHAR();
int flags = READ_BYTE();
g_WeaponList.WeaponListAdd( weaponname , ammo1type , max1 , ammo2type , max2 , slot , slotpos , id , flags );
return pWeaponList( pszName , iSize , pbuf );
}
int AmmoX( const char *pszName , int iSize , void *pbuf )
{
BEGIN_READ( pbuf , iSize );
int ID = READ_BYTE();
int Count = READ_BYTE();
g_WeaponList.WeaponListAmmoX( ID , Count );
return pAmmoX( pszName , iSize , pbuf );
}