reapi_engine.inc
Original include source with line numbers.
| 1 | #if defined _reapi_engine_included |
| 2 | #endinput |
| 3 | #endif |
| 4 | |
| 5 | #define _reapi_engine_included |
| 6 | |
| 7 | #include <reapi_engine_const> |
| 8 | |
| 9 | /* |
| 10 | * Sets entvars data for an entity. |
| 11 | * Use the var_* EntVars enum |
| 12 | */ |
| 13 | native set_entvar(const index, const EntVars:var, any:...); |
| 14 | |
| 15 | /* |
| 16 | * Returns entvar data from an entity. |
| 17 | * Use the var_* EntVars enum |
| 18 | */ |
| 19 | native any:get_entvar(const index, const EntVars:var, any:...); |
| 20 | |
| 21 | /* |
| 22 | * Sets usercmd data. |
| 23 | * Use the ucmd_* UCmd enum |
| 24 | */ |
| 25 | native set_ucmd(const ucmd, const UCmd:var, any:...); |
| 26 | |
| 27 | /* |
| 28 | * Returns usercmd data from an entity. |
| 29 | * Use the ucmd_* UCmd enum |
| 30 | */ |
| 31 | native any:get_ucmd(const ucmd, const UCmd:var, any:...); |
| 32 | |
| 33 | /* |
| 34 | * Sets a NetAdr var. |
| 35 | * |
| 36 | * @param var The specified mvar, look at the enum NetAdrVars |
| 37 | * |
| 38 | * @return 1 on success. |
| 39 | */ |
| 40 | native set_netadr(const adr, const NetAdrVars:var, any:...); |
| 41 | |
| 42 | /* |
| 43 | * Returns a NetAdr var |
| 44 | * |
| 45 | * @param var The specified mvar, look at the enum NetAdrVars |
| 46 | * |
| 47 | * @return If an integer or boolean or one byte, array or everything else is passed via the 3rd argument and more, look at the argument list for the specified mvar |
| 48 | */ |
| 49 | native any:get_netadr(const adr, const NetAdrVars:var, any:...); |
| 50 | |
| 51 | /* |
| 52 | * Gets value for key in buffer |
| 53 | * |
| 54 | * @param pbuffer Pointer to buffer |
| 55 | * @param key Key string |
| 56 | * @param value Buffer to copy value to |
| 57 | * @param maxlen Maximum size of the buffer |
| 58 | * |
| 59 | * @return Number of cells written to buffer |
| 60 | * @error If invalid buffer handler provided, an error will be thrown. |
| 61 | */ |
| 62 | native get_key_value(const pbuffer, const key[], const value[], const maxlen); |
| 63 | |
| 64 | /* |
| 65 | * Sets value for key in buffer |
| 66 | * |
| 67 | * @param pbuffer Pointer to buffer |
| 68 | * @param key Key string |
| 69 | * @param value Value to set |
| 70 | * |
| 71 | * @noreturn |
| 72 | * @error If invalid buffer handler provided, an error will be thrown. |
| 73 | */ |
| 74 | native set_key_value(const pbuffer, const key[], const value[]); |
| 75 | |
| 76 | /* |
| 77 | * Gets an AMXX string buffer from a infobuffer pointer |
| 78 | * |
| 79 | * @param buffer Info string pointer |
| 80 | * @param value String to copy value to |
| 81 | * @param maxlen Maximum size of the output buffer |
| 82 | * |
| 83 | * @return Returns a string buffer on infobuffer pointer |
| 84 | */ |
| 85 | native get_key_value_buffer(const pbuffer, const output[], const maxlen); |
| 86 | |
| 87 | /* |
| 88 | * Sets value string to entire buffer |
| 89 | * |
| 90 | * @param buffer Pointer to buffer |
| 91 | * @param value Value to set |
| 92 | * @param maxlen Maximum size of the value buffer to set, -1 means copy all characters |
| 93 | * |
| 94 | * @return 1 on success, 0 otherwise |
| 95 | */ |
| 96 | native set_key_value_buffer(const pbuffer, const value[], const maxlen = -1); |
| 97 | |
| 98 | /* |
| 99 | * Gets the position of the bone |
| 100 | * |
| 101 | * @param entity Entity index |
| 102 | * @param bone Number of the bone |
| 103 | * @param vecOrigin Array to store origin in |
| 104 | * @param vecAngles Array to store angles in |
| 105 | * |
| 106 | * @return 1 on success, 0 otherwise |
| 107 | * @error If the index is not within the range of 1 to maxEntities or |
| 108 | * the entity is not valid, an error will be thrown. |
| 109 | */ |
| 110 | native GetBonePosition(const entity, const bone, Float:vecOrigin[3], Float:vecAngles[3] = {0.0, 0.0, 0.0}); |
| 111 | |
| 112 | /* |
| 113 | * Gets the position of the attachment |
| 114 | * |
| 115 | * @param entity Entity index |
| 116 | * @param attachment Number of the attachment |
| 117 | * @param vecOrigin Array to store origin in |
| 118 | * @param vecAngles Array to store angles in |
| 119 | * |
| 120 | * @return 1 on success, 0 otherwise |
| 121 | * @error If the index is not within the range of 1 to maxEntities or |
| 122 | * the entity is not valid, an error will be thrown. |
| 123 | */ |
| 124 | native GetAttachment(const entity, const attachment, Float:vecOrigin[3], Float:vecAngles[3] = {0.0, 0.0, 0.0}); |
| 125 | |
| 126 | /* |
| 127 | * Sets body group value based on entity's model group |
| 128 | * |
| 129 | * @param entity Entity index |
| 130 | * @param group Number of entity's model group index |
| 131 | * @param value Value to assign |
| 132 | * |
| 133 | * @return 1 on success, 0 otherwise |
| 134 | * @error If the index is not within the range of 1 to maxEntities or |
| 135 | * the entity is not valid, an error will be thrown. |
| 136 | * |
| 137 | */ |
| 138 | native SetBodygroup(const entity, const group, const value); |
| 139 | |
| 140 | /* |
| 141 | * Gets body group value based on entity's model group |
| 142 | * |
| 143 | * @param entity Entity index |
| 144 | * @param group Number of entity's model group index |
| 145 | * |
| 146 | * @return Body group value |
| 147 | * @error If the index is not within the range of 1 to maxEntities or |
| 148 | * the entity is not valid, an error will be thrown. |
| 149 | * |
| 150 | */ |
| 151 | native GetBodygroup(const entity, const group); |
| 152 | |
| 153 | /* |
| 154 | * Gets sequence information based on entity's model current sequence index |
| 155 | * |
| 156 | * @param entity Entity index |
| 157 | * @param piFlags Sequence flags (1 = sequence loops) |
| 158 | * @param pflFrameRate Sequence framerate |
| 159 | * @param pflGroundSpeed Sequence ground speed |
| 160 | * |
| 161 | * @return True on success, false otherwise |
| 162 | * @error If the index is not within the range of 1 to maxEntities or |
| 163 | * the entity is not valid, an error will be thrown. |
| 164 | * |
| 165 | */ |
| 166 | native bool:GetSequenceInfo(const entity, &piFlags, &Float:pflFrameRate, &Float:pflGroundSpeed); |
| 167 | |
| 168 | /* |
| 169 | * Sets the name of the map. |
| 170 | * |
| 171 | * @param mapname New map name. |
| 172 | * |
| 173 | * @noreturn |
| 174 | */ |
| 175 | native rh_set_mapname(const mapname[]); |
| 176 | |
| 177 | /* |
| 178 | * Gets the name of the map. |
| 179 | * |
| 180 | * @param output Buffer to copy map name to |
| 181 | * @param len Maximum buffer size |
| 182 | * @param type MNT_SET will return the name of the current map |
| 183 | * MNT_TRUE will return the original map name independant of the name set with via rh_set_mapname |
| 184 | * |
| 185 | * @noreturn |
| 186 | */ |
| 187 | native rh_get_mapname(output[], len, MapNameType:type = MNT_SET); |
| 188 | |
| 189 | /* |
| 190 | * Reverts back the original map name. |
| 191 | * |
| 192 | * @noreturn |
| 193 | */ |
| 194 | native rh_reset_mapname(); |
| 195 | |
| 196 | /* |
| 197 | * Emits a sound from an entity from the engine. |
| 198 | * |
| 199 | * @param entity Entity index or use 0 to emit from worldspawn at the specified position |
| 200 | * @param recipient Recipient index or use 0 to make all clients hear it |
| 201 | * @param channel Channel to emit from |
| 202 | * @param sample Sound file to emit |
| 203 | * @param vol Volume in percents |
| 204 | * @param attn Sound attenuation |
| 205 | * @param flags Emit flags |
| 206 | * @param pitch Sound pitch |
| 207 | * @param emitFlags Additional Emit2 flags, look at the defines like SND_EMIT2_* |
| 208 | * @param origin Specify origin and only on "param" entity worldspawn that is 0 |
| 209 | * |
| 210 | * @return true if the emission was successfull, false otherwise |
| 211 | */ |
| 212 | native bool:rh_emit_sound2(const entity, const recipient, const channel, const sample[], Float:vol = VOL_NORM, Float:attn = ATTN_NORM, const flags = 0, const pitch = PITCH_NORM, emitFlags = 0, const Float:origin[3] = {0.0,0.0,0.0}); |
| 213 | |
| 214 | /* |
| 215 | * Forces an userinfo update. |
| 216 | * |
| 217 | * @param playerEntIndex Player entity index (starts from 1) |
| 218 | * |
| 219 | * @noreturn |
| 220 | */ |
| 221 | native rh_update_user_info(playerEntIndex); |
| 222 | |
| 223 | /* |
| 224 | * Kicks a client from server with message |
| 225 | * |
| 226 | * @param index Client index |
| 227 | * @param message Message that will be sent to client when it is deleted from server |
| 228 | * |
| 229 | * @noreturn |
| 230 | * |
| 231 | */ |
| 232 | native rh_drop_client(const index, const message[] = ""); |
| 233 | |
| 234 | /* |
| 235 | * - |
| 236 | * |
| 237 | * @param output Buffer to copy the ip address |
| 238 | * @param len Maximum buffer size |
| 239 | * |
| 240 | * @noreturn |
| 241 | * |
| 242 | */ |
| 243 | native rh_get_net_from(output[], len); |
| 244 | |
| 245 | /* |
| 246 | * Returns client's netchan playing time in seconds. |
| 247 | * |
| 248 | * @param index Client index |
| 249 | * |
| 250 | * @return Netchan connection time in seconds or 0 if client index is invalid or client is not connected |
| 251 | */ |
| 252 | native rh_get_client_connect_time(const index); |
| 253 | |