Skip to content

Commit 7a3d4e7

Browse files
authored
Add "DispatchKeyValueInt" stock (#1764)
1 parent 6e73aba commit 7a3d4e7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

plugins/include/sdktools_functions.inc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,23 @@ native bool DispatchSpawn(int entity);
169169
*/
170170
native bool DispatchKeyValue(int entity, const char[] keyName, const char[] value);
171171

172+
/**
173+
* Dispatches a KeyValue into given entity using an integer value.
174+
*
175+
* @param entity Destination entity index.
176+
* @param keyName Name of the key.
177+
* @param value Integer value.
178+
* @return True on success, false otherwise.
179+
* @error Invalid entity index or lack of mod support.
180+
*/
181+
stock bool DispatchKeyValueInt(int entity, const char[] keyName, int value)
182+
{
183+
char str[12];
184+
FormatEx(str, sizeof(str), "%d", value);
185+
186+
return DispatchKeyValue(entity, keyName, str);
187+
}
188+
172189
/**
173190
* Dispatches a KeyValue into given entity using a floating point value.
174191
*
@@ -373,7 +390,7 @@ native void EntityCollisionRulesChanged(int entity);
373390
* Sets an entity's owner (CBaseEntity::SetEntityOwner).
374391
*
375392
* @param entity The entity index.
376-
* @param owner The owner entity index, can be invalid.
393+
* @param owner The owner entity index, can be invalid.
377394
* @error Invalid entity or lack of mod support.
378395
*/
379396
native void SetEntityOwner(int entity, int owner=INVALID_ENT_REFERENCE);

0 commit comments

Comments
 (0)