Add GetPlayerJingleFile native. (bug 5690, r=asherkin)
Add GetPlayerJingleFile native. (
bug 5690, r=asherkin)
1.1 --- a/extensions/sdktools/vnatives.cpp Mon Aug 12 01:33:04 2013 +0100
1.2 +++ b/extensions/sdktools/vnatives.cpp Mon Aug 12 02:08:34 2013 +0100
1.3 @@ -1073,6 +1073,32 @@
1.4 return 1;
1.5 }
1.6
1.7 +static cell_t GetPlayerJingleFile(IPluginContext *pContext, const cell_t *params)
1.8 +{
1.9 + IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]);
1.10 + if (player == NULL)
1.11 + {
1.12 + return pContext->ThrowNativeError("Invalid client index %d", params[1]);
1.13 + }
1.14 + if (!player->IsInGame())
1.15 + {
1.16 + return pContext->ThrowNativeError("Client %d is not in game", params[1]);
1.17 + }
1.18 +
1.19 + player_info_t info;
1.20 + char *buffer;
1.21 +
1.22 + if (!GetPlayerInfo(params[1], &info) || !info.customFiles[1])
1.23 + {
1.24 + return 0;
1.25 + }
1.26 +
1.27 + pContext->LocalToString(params[2], &buffer);
1.28 + Q_binarytohex((byte *)&info.customFiles[1], sizeof(info.customFiles[1]), buffer, params[3]);
1.29 +
1.30 + return 1;
1.31 +}
1.32 +
1.33 static cell_t GetServerNetStats(IPluginContext *pContext, const cell_t *params)
1.34 {
1.35 if (iserver == NULL)
1.36 @@ -1256,6 +1282,7 @@
1.37 {"GetClientAimTarget", sm_GetClientAimTarget},
1.38 {"SetEntityModel", sm_SetEntityModel},
1.39 {"GetPlayerDecalFile", GetPlayerDecalFile},
1.40 + {"GetPlayerJingleFile", GetPlayerJingleFile},
1.41 {"GetServerNetStats", GetServerNetStats},
1.42 {"EquipPlayerWeapon", WeaponEquip},
1.43 {"ActivateEntity", ActivateEntity},
2.1 --- a/plugins/include/sdktools_functions.inc Mon Aug 12 01:33:04 2013 +0100
2.2 +++ b/plugins/include/sdktools_functions.inc Mon Aug 12 02:08:34 2013 +0100
2.3 @@ -270,7 +270,7 @@
2.4 native SetEntityModel(entity, const String:model[]);
2.5
2.6 /**
2.7 - * Retrieves the decal file name associated to a given client.
2.8 + * Retrieves the decal file name associated with a given client.
2.9 *
2.10 * @param client Player's index.
2.11 * @param hex Buffer to store the logo filename.
2.12 @@ -281,6 +281,17 @@
2.13 native bool:GetPlayerDecalFile(client, String:hex[], maxlength);
2.14
2.15 /**
2.16 + * Retrieves the jingle file name associated with a given client.
2.17 + *
2.18 + * @param client Player's index.
2.19 + * @param hex Buffer to store the jingle filename.
2.20 + * @param maxlength Maximum length of string buffer.
2.21 + * @return True on success, otherwise false.
2.22 + * @error Invalid client or client not in game.
2.23 + */
2.24 +native bool:GetPlayerJingleFile(client, String:hex[], maxlength);
2.25 +
2.26 +/**
2.27 * Returns the average server network traffic in bytes/sec.
2.28 *
2.29 * @param in Buffer to store the input traffic velocity.