forked from IstuntmanI/samp-streamer-plugin-sampgdk-invoke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreamer.hpp
355 lines (329 loc) · 16.3 KB
/
streamer.hpp
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#ifndef STREAMER_H
#define STREAMER_H
#include <string>
#include <sampgdk/sampgdk.h>
// Definitions
#define STREAMER_TYPE_OBJECT (0)
#define STREAMER_TYPE_PICKUP (1)
#define STREAMER_TYPE_CP (2)
#define STREAMER_TYPE_RACE_CP (3)
#define STREAMER_TYPE_MAP_ICON (4)
#define STREAMER_TYPE_3D_TEXT_LABEL (5)
#define STREAMER_TYPE_AREA (6)
#define STREAMER_TYPE_ACTOR (7)
#define STREAMER_AREA_TYPE_CIRCLE (0)
#define STREAMER_AREA_TYPE_CYLINDER (1)
#define STREAMER_AREA_TYPE_SPHERE (2)
#define STREAMER_AREA_TYPE_RECTANGLE (3)
#define STREAMER_AREA_TYPE_CUBOID (4)
#define STREAMER_AREA_TYPE_POLYGON (5)
#define STREAMER_OBJECT_TYPE_GLOBAL (0)
#define STREAMER_OBJECT_TYPE_PLAYER (1)
#define STREAMER_OBJECT_TYPE_DYNAMIC (2)
#define STREAMER_MAX_TYPES (8)
#define STREAMER_MAX_AREA_TYPES (6)
#define STREAMER_MAX_OBJECT_TYPES (3)
#define INVALID_STREAMER_ID (0)
#if !defined STREAMER_OBJECT_SD
#define STREAMER_OBJECT_SD 300.0
#endif
#if !defined STREAMER_OBJECT_DD
#define STREAMER_OBJECT_DD 0.0
#endif
#if !defined STREAMER_PICKUP_SD
#define STREAMER_PICKUP_SD 200.0
#endif
#if !defined STREAMER_CP_SD
#define STREAMER_CP_SD 200.0
#endif
#if !defined STREAMER_RACE_CP_SD
#define STREAMER_RACE_CP_SD 200.0
#endif
#if !defined STREAMER_MAP_ICON_SD
#define STREAMER_MAP_ICON_SD 200.0
#endif
#if !defined STREAMER_3D_TEXT_LABEL_SD
#define STREAMER_3D_TEXT_LABEL_SD 200.0
#endif
#if !defined STREAMER_ACTOR_SD
#define STREAMER_ACTOR_SD 200.0
#endif
// Enumerator
enum
{
E_STREAMER_AREA_ID,
E_STREAMER_ATTACHED_OBJECT,
E_STREAMER_ATTACHED_PLAYER,
E_STREAMER_ATTACHED_VEHICLE,
E_STREAMER_ATTACH_OFFSET_X,
E_STREAMER_ATTACH_OFFSET_Y,
E_STREAMER_ATTACH_OFFSET_Z,
E_STREAMER_ATTACH_R_X,
E_STREAMER_ATTACH_R_Y,
E_STREAMER_ATTACH_R_Z,
E_STREAMER_ATTACH_X,
E_STREAMER_ATTACH_Y,
E_STREAMER_ATTACH_Z,
E_STREAMER_COLOR,
E_STREAMER_DRAW_DISTANCE,
E_STREAMER_EXTRA_ID,
E_STREAMER_HEALTH,
E_STREAMER_INTERIOR_ID,
E_STREAMER_INVULNERABLE,
E_STREAMER_MAX_X,
E_STREAMER_MAX_Y,
E_STREAMER_MAX_Z,
E_STREAMER_MIN_X,
E_STREAMER_MIN_Y,
E_STREAMER_MIN_Z,
E_STREAMER_MODEL_ID,
E_STREAMER_MOVE_R_X,
E_STREAMER_MOVE_R_Y,
E_STREAMER_MOVE_R_Z,
E_STREAMER_MOVE_SPEED,
E_STREAMER_MOVE_X,
E_STREAMER_MOVE_Y,
E_STREAMER_MOVE_Z,
E_STREAMER_NEXT_X,
E_STREAMER_NEXT_Y,
E_STREAMER_NEXT_Z,
E_STREAMER_PLAYER_ID,
E_STREAMER_PRIORITY,
E_STREAMER_ROTATION,
E_STREAMER_R_X,
E_STREAMER_R_Y,
E_STREAMER_R_Z,
E_STREAMER_SIZE,
E_STREAMER_STREAM_DISTANCE,
E_STREAMER_STYLE,
E_STREAMER_SYNC_ROTATION,
E_STREAMER_TEST_LOS,
E_STREAMER_TYPE,
E_STREAMER_WORLD_ID,
E_STREAMER_X,
E_STREAMER_Y,
E_STREAMER_Z
};
namespace Plugins
{
namespace Streamer
{
namespace Settings
{
int GetTickRate( );
bool SetTickRate( int rate );
int GetPlayerTickRate( int playerid );
bool SetPlayerTickRate( int playerid, int rate );
bool ToggleChunkStream( bool toggle );
bool IsToggleChunkStream( );
int GetChunkTickRate( int type, int playerid = -1 );
bool SetChunkTickRate( int type, int rate, int playerid = -1 );
int GetChunkSize( int type );
bool SetChunkSize( int type, int size );
int GetMaxItems( int type );
bool SetMaxItems( int type, int items );
int GetVisibleItems( int type, int playerid = -1 );
bool SetVisibleItems( int type, int items, int playerid = -1 );
bool GetRadiusMultiplier( int type, float * multiplier, int playerid = -1 );
bool SetRadiusMultiplier( int type, float multiplier, int playerid = -1 );
bool GetTypePriority( int types[ ], int maxtypes );
bool SetTypePriority( const int types[ ], int maxtypes );
bool GetCellDistance( float * distance );
bool SetCellDistance( float distance );
bool GetCellSize( float * size );
bool SetCellSize( float size );
bool ToggleItemStatic( int type, int id, bool toggle );
bool IsToggleItemStatic( int type, int id );
bool ToggleItemInvAreas( int type, int id, bool toggle );
bool IsToggleItemInvAreas( int type, int id );
bool ToggleItemCallbacks( int type, int id, bool toggle );
bool IsToggleItemCallbacks( int type, int id );
bool ToggleErrorCallback( bool toggle );
bool IsToggleErrorCallback( );
bool AmxUnloadDestroyItems( bool toggle );
};
namespace Updates
{
bool ProcessActiveItems( );
bool ToggleIdleUpdate( int playerid, bool toggle );
bool IsToggleIdleUpdate( int playerid );
bool ToggleCameraUpdate( int playerid, bool toggle );
bool IsToggleCameraUpdate( int playerid );
bool ToggleItemUpdate( int playerid, int type, bool toggle );
bool IsToggleItemUpdate( int playerid, int type );
bool GetLastUpdateTime( float * time );
bool Update( int playerid, int type = -1 );
bool UpdateEx( int playerid, float x, float y, float z, int worldid = -1, int interiorid = -1, int type = -1, int compensatedtime = -1, bool freezeplayer = 1 );
};
namespace Data
{
bool GetFloatData( int type, int id, int data, float * result );
bool SetFloatData( int type, int id, int data, float value );
int GetIntData( int type, int id, int data );
bool SetIntData( int type, int id, int data, int value );
bool GetArrayData( int type, int id, int data, int dest[ ], int maxdest );
bool SetArrayData( int type, int id, int data, const int src[ ], int maxsrc );
bool IsInArrayData( int type, int id, int data, int value );
bool AppendArrayData( int type, int id, int data, int value );
bool RemoveArrayData( int type, int id, int data, int value );
int GetArrayDataLength( int type, int id, int data );
int GetUpperBound( int type );
};
namespace Miscellaneous
{
bool GetDistanceToItem( float x, float y, float z, int type, int id, float * distance, int dimensions = 3 );
bool ToggleItem( int playerid, int type, int id, int toggle );
bool IsToggleItem( int playerid, int type, int id );
bool ToggleAllItems( int playerid, int type, int toggle, int exceptions[ ], int maxexceptions );
int GetItemInternalID( int playerid, int type, int streamerid );
int GetItemStreamerID( int playerid, int type, int internalid );
bool IsItemVisible( int playerid, int type, int id );
bool DestroyAllVisibleItems( int playerid, int type, int serverwide = 1 );
int CountVisibleItems( int playerid, int type, int serverwide = 1 );
bool DestroyAllItems( int type, int serverwide = 1 );
int CountItems( int type, int serverwide = 1 );
int GetNearbyItems( float x, float y, float z, int type, int items[ ], int maxitems, float range = 300.0, int worldid = -1 );
int GetAllVisibleItems( int playerid, int type, int items[ ], int maxitems );
bool GetItemPos( int type, int id, float * x, float * y, float * z );
bool SetItemPos( int type, int id, float x, float y, float z );
bool GetItemOffset( int type, int id, float * x, float * y, float * z );
bool SetItemOffset( int type, int id, float x, float y, float z );
};
namespace Object
{
int Create( int modelid, double x, double y, double z, double rx, double ry, double rz, int worldid = -1, int interiorid = -1, int playerid = -1, float streamdistance = STREAMER_OBJECT_SD, float drawdistance = STREAMER_OBJECT_DD, int areaid = -1, int priority = 0 );
bool Destroy( int objectid );
bool IsValid( int objectid );
bool SetPos( int objectid, float x, float y, float z );
bool GetPos( int objectid, float * x, float * y, float * z );
bool SetRot( int objectid, float rx, float ry, float rz );
bool GetRot( int objectid, float * rx, float * ry, float * rz );
bool SetNoCameraCol( int objectid );
bool GetNoCameraCol( int objectid );
bool Move( int objectid, float x, float y, float z, float speed, float rx = -1000.0, float ry = -1000.0, float rz = -1000.0 );
bool Stop( int objectid );
bool IsMoving( int objectid );
bool AttachCameraTo( int playerid, int objectid );
bool AttachToObject( int objectid, int attachtoid, float offsetx, float offsety, float offsetz, float rx, float ry, float rz, int syncrotation = 1 );
bool AttachToPlayer( int objectid, int playerid, float offsetx, float offsety, float offsetz, float rx, float ry, float rz );
bool AttachToVehicle( int objectid, int vehicleid, float offsetx, float offsety, float offsetz, float rx, float ry, float rz );
bool Edit( int playerid, int objectid );
bool IsMaterialUsed( int objectid, int materialindex );
bool GetMaterial( int objectid, int materialindex, int * modelid, char txdname[ ], char texturename[ ], int * materialcolor, int maxtxdname, int maxtexturename );
bool SetMaterial( int objectid, int materialindex, int modelid, const char txdname[ ], const char texturename[ ], int materialcolor = 0 );
bool IsMaterialTextUsed( int objectid, int materialindex );
bool GetMaterialText( int objectid, int materialindex, char text[ ], int * materialsize, char fontface[ ], int * fontsize, int * bold, int * fontcolor, int * backcolor, int * textalignment, int maxtext, int maxfontface );
bool SetMaterialText( int objectid, int materialindex, const char text[ ], int materialsize = OBJECT_MATERIAL_SIZE_256x128, const char fontface[ ] = "Arial", int fontsize = 24, int bold = 1, int fontcolor = 0xFFFFFFFF, int backcolor = 0, int textalignment = 0 );
};
namespace Pickup
{
int Create( int modelid, int type, float x, float y, float z, int worldid = -1, int interiorid = -1, int playerid = -1, float streamdistance = STREAMER_PICKUP_SD, int areaid = -1, int priority = 0 );
bool Destroy( int pickupid );
bool IsValid( int pickupid );
};
namespace CP
{
int Create( float x, float y, float z, float size, int worldid = -1, int interiorid = -1, int playerid = -1, float streamdistance = STREAMER_CP_SD, int areaid = -1, int priority = 0 );
bool Destroy( int checkpointid );
bool IsValid( int checkpointid );
bool IsPlayerIn( int playerid, int checkpointid );
int GetPlayerVisible( int playerid );
};
namespace RaceCP
{
int Create( int type, float x, float y, float z, float nextx, float nexty, float nextz, float size, int worldid = -1, int interiorid = -1, int playerid = -1, float streamdistance = STREAMER_RACE_CP_SD, int areaid = -1, int priority = 0 );
bool Destroy( int checkpointid );
bool IsValid( int checkpointid );
bool IsPlayerIn( int playerid, int checkpointid );
int IsPlayerIn( int playerid );
};
namespace MapIcon
{
int Create( float x, float y, float z, int type, int color, int worldid = -1, int interiorid = -1, int playerid = -1, float streamdistance = STREAMER_MAP_ICON_SD, int style = MAPICON_LOCAL, int areaid = -1, int priority = 0 );
int CreateEx( float x, float y, float z, int type, int color, int style, float streamdistance, const int worlds[], const int interiors[], const int players[], const int areas[], int priority, int maxworlds, int maxinteriors, int maxplayers, int maxareas );
bool Destroy( int iconid );
bool IsValid( int iconid );
};
namespace TextLabel
{
int Create( const char text[], int color, float x, float y, float z, float drawdistance, int attachedplayer = INVALID_PLAYER_ID, int attachedvehicle = INVALID_VEHICLE_ID, bool testlos = 0, int worldid = -1, int interiorid = -1, int playerid = -1, float streamdistance = STREAMER_3D_TEXT_LABEL_SD, int areaid = -1, int priority = 0 );
bool Destroy( int id );
bool IsValid( int id );
bool GetText( int id, char text[ ], int maxtext );
bool UpdateText( int id, int color, const char text[ ] );
};
namespace Area
{
int CreateCircle( float x, float y, float size, int worldid = -1, int interiorid = -1, int playerid = -1, int priority = 0 );
int CreateCylinder( float x, float y, float minz, float maxz, float size, int worldid = -1, int interiorid = -1, int playerid = -1, int priority = 0 );
int CreateSphere( float x, float y, float z, float size, int worldid = -1, int interiorid = -1, int playerid = -1, int priority = 0 );
int CreateRectangle( float minx, float miny, float maxx, float maxy, int worldid = -1, int interiorid = -1, int playerid = -1, int priority = 0 );
int CreateCuboid( float minx, float miny, float minz, float maxx, float maxy, float maxz, int worldid = -1, int interiorid = -1, int playerid = -1, int priority = 0 );
int CreateCube( float minx, float miny, float minz, float maxx, float maxy, float maxz, int worldid = -1, int interiorid = -1, int playerid = -1, int priority = 0 );
int CreatePolygon( const float points[ ], float minz, float maxz, int maxpoints, int worldid = -1, int interiorid = -1, int playerid = -1, int priority = 0 );
bool Destroy( int areaid );
bool IsValid( int areaid );
int GetType( int areaid );
int GetDynamicPolygonPoints( int areaid, float points[ ], int maxpoints );
int GetDynamicPolygonNumberPoints( int areaid );
bool IsPlayerIn( int playerid, int areaid, bool recheck = 0 );
bool IsPlayerInAny( int playerid, bool recheck = 0 );
bool IsAnyPlayerIn( int areaid, bool recheck = 0 );
bool IsAnyPlayerInAny( bool recheck = 0 );
int GetPlayerDynamicAreas( int playerid, int areas[ ], int maxareas );
int GetPlayerNumber( int playerid );
bool IsPointIn( int areaid, float x, float y, float z );
bool IsPointInAny( float x, float y, float z );
bool IsLineIn( int areaid, float x1, float y1, float z1, float x2, float y2, float z2 );
bool IsLineInAny( float x1, float y1, float z1, float x2, float y2, float z2 );
int GetDynamicAreasForPoint( float x, float y, float z, int areas[ ], int maxareas );
int GetNumberDynamicAreasForPoint( float x, float y, float z );
int GetDynamicAreasForLine( float x1, float y1, float z1, float x2, float y2, float z2, int areas[ ], int maxareas );
int GetNumberForLine( float x1, float y1, float z1, float x2, float y2, float z2 );
bool AttachToObject( int areaid, int objectid, int type = STREAMER_OBJECT_TYPE_DYNAMIC, int playerid = INVALID_PLAYER_ID, float offsetx = 0.0, float offsety = 0.0, float offsetz = 0.0 );
bool AttachToPlayer( int areaid, int playerid, float offsetx = 0.0, float offsety = 0.0, float offsetz = 0.0 );
bool AttachToVehicle( int areaid, int vehicleid, float offsetx = 0.0, float offsety = 0.0, float offsetz = 0.0 );
bool ToggleSpectateMode( int areaid, bool toggle );
bool IsToggleSpectateMode( int areaid );
};
namespace Actor
{
int Create( int modelid, float x, float y, float z, float r, bool invulnerable = 1, float health = 100.0, int worldid = -1, int interiorid = -1, int playerid = -1, float streamdistance = STREAMER_ACTOR_SD, int areaid = -1, int priority = 0 );
bool Destroy( int actorid );
bool IsValid( int actorid );
bool IsStreamedIn( int actorid, int forplayerid );
int GetVirtualWorld( int actorid );
bool SetVirtualWorld( int actorid, int vworld );
bool ApplyAnimation( int actorid, const char animlib[ ], const char animname[ ], float fdelta, bool loop, int lockx, int locky, int freeze, int time );
bool ClearAnimations( int actorid );
bool GetFacingAngle( int actorid, float * ang );
bool SetFacingAngle( int actorid, float ang );
bool GetPos( int actorid, float * x, float * y, float * z );
bool SetPos( int actorid, float x, float y, float z );
bool GetHealth( int actorid, float * health );
bool SetHealth( int actorid, float health );
bool SetInvulnerable( int actorid, bool invulnerable = 1 );
bool IsInvulnerable( int actorid );
int GetPlayerTarget( int playerid );
int GetPlayerCameraTarget( int playerid );
};
};
};
bool OnDynamicObjectMoved( int objectid );
bool OnPlayerEditDynamicObject( int playerid, int objectid, int response, float x, float y, float z, float rx, float ry, float rz );
bool OnPlayerSelectDynamicObject( int playerid, int objectid, int modelid, float x, float y, float z );
bool OnPlayerShootDynamicObject( int playerid, int weaponid, int objectid, float x, float y, float z );
bool OnPlayerPickUpDynamicPickup( int playerid, int pickupid );
bool OnPlayerEnterDynamicCP( int playerid, int checkpointid );
bool OnPlayerLeaveDynamicCP( int playerid, int checkpointid );
bool OnPlayerEnterDynamicRaceCP( int playerid, int checkpointid );
bool OnPlayerLeaveDynamicRaceCP( int playerid, int checkpointid );
bool OnPlayerEnterDynamicArea( int playerid, int areaid );
bool OnPlayerLeaveDynamicArea( int playerid, int areaid );
bool OnPlayerGiveDamageDynamicActor( int playerid, int actorid, float amount, int weaponid, int bodypart );
bool OnDynamicActorStreamIn( int actorid, int forplayerid );
bool OnDynamicActorStreamOut( int actorid, int forplayerid );
bool Streamer_OnItemStreamIn( int type, int id );
bool Streamer_OnItemStreamOut( int type, int id );
bool Streamer_OnPluginError( const char error[ ] );
#endif