AMXX-BG.INFO dHUD.inc Raw include

dHUD.inc

Original include source with line numbers.

Back Download .inc
1 /**
2 * Dynamic HUD
3 * v1.02
4 */
5 #if defined _dHUD_included
6 #endinput
7 #endif
8
9 #define _dHUD_included
10
11
12
13 /**
14 * Create new Dynamic HUD object
15 *
16 * @param dhud Build object as copy of given
17 * -1 creates brand new object
18 * @return dhud handle
19 *
20 * Example:
21 * new dhud1 = DHUD_create();//new, empty object
22 * //do sth with dhud1
23 * ...
24 *
25 * new dhud2 = DHUD_create(dhud1); //dhud2 has the same configuration like dhud1
26 */
27 native DHUD_create(dhud = -1);
28
29
30
31 /**
32 * Get total number of frames
33 *
34 * @param dhud dhud handle
35 * @return number of frames
36 */
37 native DHUD_getFrames(dhud);
38
39 /**
40 * Set configuration of choosen frame
41 *
42 * @param dhud dhud handle
43 * @param frame id of frame, starts from 0, if frame > DHUD_getFrames(dhud) leak will be filled by empty frames
44 * @param iColor Color of message in frame
45 * @param x Position on x axis
46 * @param y Position on y axis
47 * @param iLen Duration of frame, iLen = 2 mean frame hold 2 times longer than frame with iLen = 1
48 * set iLen = 0 to remove frame
49 *
50 * @return 1 on success, 0 on failure
51 */
52 native DHUD_setFrame(dhud, frame, iColor[3]={0,0,0}, Float:x=0.0, Float:y=0.0, iLen = 1);
53
54 /**
55 * Get configuration of choosen frame
56 *
57 * @param dhud dhud handle
58 * @param frame id of frame, starts from 0, frame > DHUD_getFrames(dhud) cause log error
59 * @param iColor Color of message in frame
60 * @param x Position on x axis
61 * @param y Position on y axis
62 * @param iLen Duration of frame, iLen = 2 mean frame hold 2 times longer than frame with iLen = 1
63 *
64 * @return 1 on success, 0 on failure
65 */
66 native DHUD_getFrame(dhud, frame, iColor[3], &Float:x, &Float:y, &iLen);
67
68
69
70 /**
71 * Display Dynamic HUD message
72 *
73 * @param id Index of player or 0 for all
74 * @param dhud dhud handle
75 * @param fInterval Period of updating frames
76 * @param channel Channel od HUD, from 1 to 4
77 * @param szMessage[] Message to show
78 *
79 * @return 1 on success, 0 on failure
80 */
81 native DHUD_display(id, dhud, Float:fInterval = 0.1, channel = 4, const szMessage[], any:...);
82
83 /**
84 * Clear Dynamic HUD message from screen
85 *
86 * @param id Index of player or 0 for all
87 * @param dhud dhud handle
88 *
89 * @return 1 on success, 0 on failure
90 */
91 native DHUD_clear(id, dhud);
92
93
94
95 /**
96 * Add new filter to DHUD interface
97 *
98 * @param szName Name for applying
99 * @param szCallback Public function which realize filter
100 * @param szDescription Description of filter and arguments
101 *
102 * Basic form is:
103 * public filterCallback(dhud, frame, startFrame, endFrame, Float:x, Float:y){}
104 *
105 * It is when filter do not use custom parameters.
106 *
107 * Every additional parameter is argument type from amxconst.inc
108 * FP_CELL,
109 * FP_FLOAT,
110 * FP_ARRAY (only array[3]),
111 * FP_STRING (buffer for 128 chars)
112 *
113 * When filter need Float:a and Float:b multipliers should use pair:
114 * DHUD_registerFilter("MyFilter", "cbMyFilter", "<Float:a> <Float:b> - Do something", FP_FLOAT, FP_FLOAT);
115 * public cbMyFilter(dhud, frame, startFrame, endFrame, Float:x, Float:y, Float:a, Float:b){}
116 *
117 * Now applying filter will require 2 additional Floats
118 */
119 native DHUD_registerFilter(const szName[], const szCallback[], const szDescription[], ...);
120
121
122
123
124 /**
125 * dx, dy values, but you can put custom ones, example: 0.04
126 */
127 #define D_ZERO 0.0
128 #define D_SHORT 0.01
129 #define D_LONG 0.1
130
131
132 /**
133 * startFrame endFrame help constants
134 */
135 #define FRAME_FIRST 0
136 #define FRAME_LAST -1
137
138
139 /**
140 * Apply filter on choosen frames
141 *
142 * @param dhud dhud handle
143 * @param szFilter Filter name
144 * @param startFrame First frame for apply
145 * @param endFrame Last frame for apply
146 * @param dx Increasing x
147 * @param dy Increasing y
148 *
149 * @param ... If filter has additional parameters this is place to put them
150 *
151 * @return 1 on success, 0 on failure
152 */
153 native DHUD_applyFilter(dhud, const szFilter[], startFrame, endFrame, Float:dx=D_LONG, Float:dy=D_ZERO, any:...);
154
155
156 /**
157 * Called when message animation is stoped
158 *
159 * @param id Target, player index or 0 for all
160 * @param dhud dhud handle
161 * @param finished true when every frame was displayed, false when message cleared or replaced
162 */
163 forward fwStopAnimation(id, dhud, bool:finished);
164
165
166 /**
167 * Remove chosen frames
168 * @param dhud dhud handle
169 * @param startFrame First removed frame
170 * @param count Number of frames to delete
171 */
172 stock DHUD_removeFrames(dhud, startFrame, count){
173 for(new i=0;i<count;i++)
174 DHUD_setFrame(dhud, startFrame, _,_,_, 0);
175 }
176
177 /**
178 * Remove all frames from dhud object
179 * @param dhud dhud handle
180 */
181 stock DHUD_removeAllFrames(dhud){
182 DHUD_removeFrames(dhud, 0, DHUD_getFrames(dhud));
183 }
184 /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
185 *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
186 */
187