Add "DispatchKeyValueInt" stock (#1764)

This commit is contained in:
Psykotikism 2022-05-06 06:53:57 -07:00 committed by Your Name
parent b789d30658
commit 25184aa9c7

View File

@ -169,6 +169,23 @@ native bool DispatchSpawn(int entity);
*/
native bool DispatchKeyValue(int entity, const char[] keyName, const char[] value);
/**
* Dispatches a KeyValue into given entity using an integer value.
*
* @param entity Destination entity index.
* @param keyName Name of the key.
* @param value Integer value.
* @return True on success, false otherwise.
* @error Invalid entity index or lack of mod support.
*/
stock bool DispatchKeyValueInt(int entity, const char[] keyName, int value)
{
char str[12];
FormatEx(str, sizeof(str), "%d", value);
return DispatchKeyValue(entity, keyName, str);
}
/**
* Dispatches a KeyValue into given entity using a floating point value.
*
@ -373,7 +390,7 @@ native void EntityCollisionRulesChanged(int entity);
* Sets an entity's owner (CBaseEntity::SetEntityOwner).
*
* @param entity The entity index.
* @param owner The owner entity index, can be invalid.
* @param owner The owner entity index, can be invalid.
* @error Invalid entity or lack of mod support.
*/
native void SetEntityOwner(int entity, int owner=INVALID_ENT_REFERENCE);