-
Notifications
You must be signed in to change notification settings - Fork 0
/
opws_fix.inc
253 lines (204 loc) · 5.62 KB
/
opws_fix.inc
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#if defined opws_fix_included_
#endinput
#endif
#define opws_fix_included_
#tryinclude <Pawn.RakNet>
#if !defined PAWNRAKNET_INC_
#error "opws_fix.inc requires Pawn.RakNet plugin to work. Get it here: https://github.com/katursis/Pawn.RakNet/releases"
#endif
#if defined PR_SendRPC
#define __PAWNRAKNET_SEND PR_SendRPC
#elseif defined BS_Send
#define __PAWNRAKNET_SEND BS_Send
#endif
static
__opws_fix_PlayerFixCount[MAX_PLAYERS char],
__opws_fix_PlayerMarkers = PLAYER_MARKERS_MODE_GLOBAL,
__opws_fix_Weather = 10,
__opws_fix_WorldTime = 12,
Float:__opws_fix_Gravity = 0.008,
bool:__opws_fix_UsePlayerPedAnims = false,
bool:__opws_fix_LimitChatRadius = false,
bool:__opws_fix_StuntBonus = false,
bool:__opws_fix_DisableEnterExits = false,
bool:__opws_fix_ManualVehicles = false,
bool:__opws_fix_ShowNameTags = true,
Float:__opws_fix_NameTagDistance = 70.0,
Float:__opws_fix_ChatRadius = 10000.0;
public OnPlayerConnect(playerid)
{
__opws_fix_PlayerFixCount{playerid} = (!GetConsoleVarAsInt("lagcompmode") ? 2 : 0);
#if defined opws_fix_OnPlayerConnect
opws_fix_OnPlayerConnect(playerid);
#endif
return 1;
}
public OnPlayerSpawn(playerid)
{
if (__opws_fix_PlayerFixCount{playerid} > 0)
{
__opws_fix_PlayerFixCount{playerid} -= 1;
new BitStream:bs = BS_New(), hostname[50];
GetConsoleVarAsString("hostname", hostname, sizeof(hostname));
BS_WriteValue(bs,
PR_CBOOL, false,
PR_CBOOL, __opws_fix_UsePlayerPedAnims,
PR_CBOOL, true,
PR_CBOOL, __opws_fix_LimitChatRadius,
PR_FLOAT, __opws_fix_ChatRadius,
PR_CBOOL, __opws_fix_StuntBonus,
PR_FLOAT, __opws_fix_NameTagDistance,
PR_CBOOL, __opws_fix_DisableEnterExits,
PR_CBOOL, true,
PR_CBOOL, __opws_fix_ManualVehicles,
PR_INT32, 0,
PR_UINT16, playerid,
PR_CBOOL, __opws_fix_ShowNameTags,
PR_INT32, __opws_fix_PlayerMarkers,
PR_UINT8, __opws_fix_WorldTime,
PR_UINT8, __opws_fix_Weather,
PR_FLOAT, __opws_fix_Gravity,
PR_CBOOL, !!GetConsoleVarAsInt("lanmode"),
PR_INT32, 0,
PR_CBOOL, false,
PR_INT32, GetConsoleVarAsInt("onfoot_rate"),
PR_INT32, GetConsoleVarAsInt("incar_rate"),
PR_INT32, GetConsoleVarAsInt("weapon_rate"),
PR_INT32, 10,
PR_UINT8, __opws_fix_PlayerFixCount{playerid},
PR_UINT8, 0,
PR_UINT8, 0,
PR_UINT8, 0,
PR_UINT8, strlen(hostname),
PR_STRING, hostname,
PR_UINT8, strlen(hostname)
);
__PAWNRAKNET_SEND(bs, playerid, 139, PR_HIGH_PRIORITY, PR_RELIABLE_ORDERED);
BS_Delete(bs);
TogglePlayerSpectating(playerid, true);
TogglePlayerSpectating(playerid, false);
return 1;
}
#if defined opws_fix_OnPlayerSpawn
opws_fix_OnPlayerSpawn(playerid);
#endif
return 1;
}
stock opws_fix_SetWeather(weatherid)
{
__opws_fix_Weather = weatherid;
return SetWeather(weatherid);
}
stock opws_fix_ShowPlayerMarkers(mode)
{
__opws_fix_PlayerMarkers = mode;
return ShowPlayerMarkers(mode);
}
stock opws_fix_ShowNameTags(show)
{
__opws_fix_ShowNameTags = !!show;
return ShowNameTags(show);
}
stock opws_fix_ManualVehEngAndLights()
{
__opws_fix_ManualVehicles = true;
return ManualVehicleEngineAndLights();
}
stock opws_fix_DisableIntEnterExits()
{
__opws_fix_DisableEnterExits = true;
return DisableInteriorEnterExits();
}
stock opws_fix_EnableStuntBonusForAll(enable)
{
__opws_fix_StuntBonus = !!enable;
return EnableStuntBonusForAll(enable);
}
stock opws_fix_UsePlayerPedAnims()
{
__opws_fix_UsePlayerPedAnims = true;
return UsePlayerPedAnims();
}
stock opws_fix_LimitGlobalChatRadius(Float:chat_radius)
{
__opws_fix_LimitChatRadius = true;
__opws_fix_ChatRadius = chat_radius;
return LimitGlobalChatRadius(chat_radius);
}
stock opws_fix_SetWorldTime(hour)
{
__opws_fix_WorldTime = hour;
return SetWorldTime(hour);
}
#if defined _ALS_SetWorldTime
#undef SetWorldTime
#else
#define _ALS_SetWorldTime
#endif
#define SetWorldTime opws_fix_SetWorldTime
#if defined _ALS_SetWeather
#undef SetWeather
#else
#define _ALS_SetWeather
#endif
#define SetWeather opws_fix_SetWeather
#if defined _ALS_ShowPlayerMarkers
#undef ShowPlayerMarkers
#else
#define _ALS_ShowPlayerMarkers
#endif
#define ShowPlayerMarkers opws_fix_ShowPlayerMarkers
#if defined _ALS_ManualVehEngineAndLights
#undef ManualVehicleEngineAndLights
#else
#define _ALS_ManualVehEngineAndLights
#endif
#define ManualVehicleEngineAndLights opws_fix_ManualVehEngAndLights
#if defined _ALS_ShowNameTags
#undef ShowNameTags
#else
#define _ALS_ShowNameTags
#endif
#define ShowNameTags opws_fix_ShowNameTags
#if defined _ALS_DisableInteriorEnterExits
#undef DisableInteriorEnterExits
#else
#define _ALS_DisableInteriorEnterExits
#endif
#define DisableInteriorEnterExits opws_fix_DisableIntEnterExits
#if defined _ALS_EnableStuntBonusForAll
#undef EnableStuntBonusForAll
#else
#define _ALS_EnableStuntBonusForAll
#endif
#define EnableStuntBonusForAll opws_fix_EnableStuntBonusForAll
#if defined _ALS_UsePlayerPedAnims
#undef UsePlayerPedAnims
#else
#define _ALS_UsePlayerPedAnims
#endif
#define UsePlayerPedAnims opws_fix_UsePlayerPedAnims
#if defined _ALS_LimitGlobalChatRadius
#undef LimitGlobalChatRadius
#else
#define _ALS_LimitGlobalChatRadius
#endif
#define LimitGlobalChatRadius opws_fix_LimitGlobalChatRadius
#if defined _ALS_OnPlayerSpawn
#undef OnPlayerSpawn
#else
#define _ALS_OnPlayerSpawn
#endif
#define OnPlayerSpawn opws_fix_OnPlayerSpawn
#if defined opws_fix_OnPlayerSpawn
forward opws_fix_OnPlayerSpawn(playerid);
#endif
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect opws_fix_OnPlayerConnect
#if defined opws_fix_OnPlayerConnect
forward opws_fix_OnPlayerConnect(playerid);
#endif