Add has_map_ent_class native (bug 5814, r=Nextra)

Former-commit-id: bfa749105feb49cf9f9b3878dededa33ae7d699c
This commit is contained in:
Vincent Herbet 2013-08-07 16:40:37 +02:00
parent 5557124f05
commit 7e11cb5cc1
2 changed files with 22 additions and 0 deletions

View File

@ -4623,6 +4623,16 @@ static cell AMX_NATIVE_CALL LookupLangKey(AMX *amx, cell *params)
set_amxstring(amx,params[1],def,params[2]); set_amxstring(amx,params[1],def,params[2]);
return 1; return 1;
}; };
// has_map_ent_class(const classname[])
static cell AMX_NATIVE_CALL has_map_ent_class(AMX *amx, cell *params)
{
int len;
char *name = get_amxstring(amx, params[1], 0, len);
return len && !FNullEnt(FIND_ENTITY_BY_STRING(NULL, "classname", name));
};
static cell AMX_NATIVE_CALL is_rukia_a_hag(AMX *amx, cell *params) static cell AMX_NATIVE_CALL is_rukia_a_hag(AMX *amx, cell *params)
{ {
return 1; return 1;
@ -4728,6 +4738,7 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"get_xvar_float", get_xvar_num}, {"get_xvar_float", get_xvar_num},
{"get_xvar_id", get_xvar_id}, {"get_xvar_id", get_xvar_id},
{"get_xvar_num", get_xvar_num}, {"get_xvar_num", get_xvar_num},
{"has_map_ent_class", has_map_ent_class},
{"int3", int3}, {"int3", int3},
{"is_amd64_server", is_amd64_server}, {"is_amd64_server", is_amd64_server},
{"is_dedicated_server", is_dedicated_server}, {"is_dedicated_server", is_dedicated_server},

View File

@ -1084,5 +1084,16 @@ native admins_lookup(num, AdminProp:Property, Buffer[]="", BufferSize=0);
* Clears the list of dynamically stored admins * Clears the list of dynamically stored admins
*/ */
native admins_flush(); native admins_flush();
/**
* Searches whether a map contains at least one entity with the provided class name.
*
* @param classname The entity classname to check.
*
* @return Returns true if an entity is found, otherwise false.
*/
native bool:has_map_ent_class(const classname[]);
// Keep this always at the bottom of this file // Keep this always at the bottom of this file
#include <message_stocks> #include <message_stocks>