# HG changeset patch # User FlaminSarge # Date 1376269714 -3600 # Node ID 91974ce1645373fe858ea1298eb8fd1a2e4416a0 # Parent 64238b77e22f2d6ed49116c4762d58088c95151e Add GetPlayerJingleFile native. (bug 5690, r=asherkin) diff -r 64238b77e22f -r 91974ce16453 extensions/sdktools/vnatives.cpp --- a/extensions/sdktools/vnatives.cpp Mon Aug 12 01:33:04 2013 +0100 +++ b/extensions/sdktools/vnatives.cpp Mon Aug 12 02:08:34 2013 +0100 @@ -1073,6 +1073,32 @@ return 1; } +static cell_t GetPlayerJingleFile(IPluginContext *pContext, const cell_t *params) +{ + IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]); + if (player == NULL) + { + return pContext->ThrowNativeError("Invalid client index %d", params[1]); + } + if (!player->IsInGame()) + { + return pContext->ThrowNativeError("Client %d is not in game", params[1]); + } + + player_info_t info; + char *buffer; + + if (!GetPlayerInfo(params[1], &info) || !info.customFiles[1]) + { + return 0; + } + + pContext->LocalToString(params[2], &buffer); + Q_binarytohex((byte *)&info.customFiles[1], sizeof(info.customFiles[1]), buffer, params[3]); + + return 1; +} + static cell_t GetServerNetStats(IPluginContext *pContext, const cell_t *params) { if (iserver == NULL) @@ -1256,6 +1282,7 @@ {"GetClientAimTarget", sm_GetClientAimTarget}, {"SetEntityModel", sm_SetEntityModel}, {"GetPlayerDecalFile", GetPlayerDecalFile}, + {"GetPlayerJingleFile", GetPlayerJingleFile}, {"GetServerNetStats", GetServerNetStats}, {"EquipPlayerWeapon", WeaponEquip}, {"ActivateEntity", ActivateEntity}, diff -r 64238b77e22f -r 91974ce16453 plugins/include/sdktools_functions.inc --- a/plugins/include/sdktools_functions.inc Mon Aug 12 01:33:04 2013 +0100 +++ b/plugins/include/sdktools_functions.inc Mon Aug 12 02:08:34 2013 +0100 @@ -270,7 +270,7 @@ native SetEntityModel(entity, const String:model[]); /** - * Retrieves the decal file name associated to a given client. + * Retrieves the decal file name associated with a given client. * * @param client Player's index. * @param hex Buffer to store the logo filename. @@ -281,6 +281,17 @@ native bool:GetPlayerDecalFile(client, String:hex[], maxlength); /** + * Retrieves the jingle file name associated with a given client. + * + * @param client Player's index. + * @param hex Buffer to store the jingle filename. + * @param maxlength Maximum length of string buffer. + * @return True on success, otherwise false. + * @error Invalid client or client not in game. + */ +native bool:GetPlayerJingleFile(client, String:hex[], maxlength); + +/** * Returns the average server network traffic in bytes/sec. * * @param in Buffer to store the input traffic velocity.