From b65b8a1cf01702b27284d42a4c8350dff1ef370d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 26 Apr 2006 05:21:29 +0000 Subject: [PATCH] request at28581 --- dlls/nvault/amxxapi.cpp | 17 +++++++++++++++++ plugins/include/nvault.inc | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/dlls/nvault/amxxapi.cpp b/dlls/nvault/amxxapi.cpp index dc88d6c0..f15a84e5 100755 --- a/dlls/nvault/amxxapi.cpp +++ b/dlls/nvault/amxxapi.cpp @@ -187,6 +187,22 @@ static cell AMX_NATIVE_CALL nvault_prune(AMX *amx, cell *params) return pVault->Prune(start, end); } +static cell AMX_NATIVE_CALL nvault_remove(AMX *amx, cell *params) +{ + unsigned int id = params[1]; + if (id >= g_Vaults.size() || !g_Vaults.at(id)) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid vault id: %d\n", id); + return 0; + } + NVault *pVault = g_Vaults.at(id); + int len; + const char *key = MF_GetAmxString(amx, params[2], 0, &len); + pVault->Remove(key); + + return 1; +} + IVaultMngr *GetVaultMngr() { return static_cast(&g_VaultMngr); @@ -220,5 +236,6 @@ AMX_NATIVE_INFO nVault_natives[] = { {"nvault_pset", nvault_pset}, {"nvault_close", nvault_close}, {"nvault_prune", nvault_prune}, + {"nvault_remove", nvault_remove}, {NULL, NULL}, }; diff --git a/plugins/include/nvault.inc b/plugins/include/nvault.inc index 5e67e127..699e303b 100755 --- a/plugins/include/nvault.inc +++ b/plugins/include/nvault.inc @@ -37,3 +37,7 @@ native nvault_prune(vault, start, end); //Closes a vault native nvault_close(vault); + +//Removes a key from the vault +native nvault_remove(vault, const key[]); +