Add get/Set_gamerules_* natives

This commit is contained in:
Arkshine
2015-10-09 11:26:40 +02:00
parent df507a675b
commit 68f99bc2d5
2 changed files with 380 additions and 13 deletions

View File

@ -808,6 +808,183 @@ native get_ent_data_string(entity, const class[], const member[], value[], maxle
*/
native set_ent_data_string(entity, const class[], const member[], const value[], element = 0);
/**
* Retrieves an integer value from the gamerules object based off a class
* and member name.
*
* @note This native is used to access the following (C++/engine) data types:
* integer, boolean, short, character, pointer, structure, class,
* stringint and function. Unsigned variants (if applicable) are supported
* and will be converted automatically.
*
* @param class Class name
* @param member Member name
* @param element Element to retrieve (starting from 0) if member is an array
*
* @return Integer value
* @error If member is empty, no offset is found or an invalid offset
* is retrieved, or the data type does not match, an error will
* be thrown.
*/
native any:get_gamerules_int(const class[], const member[], element = 0);
/**
* Sets an integer value to the gamerules objecta based off a class
* and member name.
*
* @note This native is used to access the following (C++/engine) data types:
* integer, boolean, short, character, pointer, stringint and function.
* Unsigned variants (if applicable) are supported and will be converted
* automatically.
*
* @param class Class name
* @param member Member name
* @param value Value to set
* @param element Element to set (starting from 0) if member is an array
*
* @noreturn
* @error If member is empty, no offset is found or an invalid offset
* is retrieved, or the data type does not match, an error will
* be thrown.
*/
native set_gamerules_int(const class[], const member[], any:value, element = 0);
/**
* Retrieves a float value from the gamerules object based off a class
* and member name.
*
* @param class Class name
* @param member Member name
* @param element Element to retrieve (starting from 0) if member is an array
*
* @return Float value
* @error If member is empty, no offset is found or an invalid offset
* is retrieved, or the data type does not match, an error will
* be thrown.
*/
native Float:get_gamerules_float(const class[], const member[], element = 0);
/**
* Sets a float value to the gamerules object based off a class
* and member name.
*
* @param class Class name
* @param member Member name
* @param value Value to set
* @param element Element to set (starting from 0) if member is an array
*
* @noreturn
* @error If member is empty, no offset is found or an invalid offset
* is retrieved, or the data type does not match, an error will
* be thrown.
*/
native set_gamerules_float(const class[], const member[], Float:value, element = 0);
/**
* Retrieves a vector from the gamerules object based off a class and member name.
*
* @param class Class name
* @param member Member name
* @param value Vector buffer to store data in
* @param element Element to retrieve (starting from 0) if member is an array
*
* @noreturn
* @error If member is empty, no offset is found or an invalid offset
* is retrieved, or the data type does not match, an error will
* be thrown.
*/
native get_gamerules_vector(const class[], const member[], Float:value[3], element = 0);
/**
* Sets a vector to the gamerules object based off a class and member name.
*
* @param class Class name
* @param member Member name
* @param value Vector to set
* @param element Element to set (starting from 0) if member is an array
*
* @noreturn
* @error If member is empty, no offset is found or an invalid offset
* is retrieved, or the data type does not match, an error will
* be thrown.
*/
native set_gamerules_vector(const class[], const member[], Float:value[3], element = 0);
/**
* Retrieves an entity index from the gamerules object based off a class
* and member name.
*
* @note This native is used to access the following (C++/engine) data types:
* classptr, entvars, edict and ehandle.
*
* @param class Class name
* @param member Member name
* @param element Element to retrieve (starting from 0) if member is an array
*
* @return Entity index if found, -1 otherwise
* @error If member is empty, no offset is found or an invalid offset
* is retrieved, or the data type does not match, an error will
* be thrown.
*/
native get_gamerules_entity(const class[], const member[], element = 0);
/**
* Sets an entity index to the gamerules object based off a class
* and member name.
*
* @note This native is used to access the following (C++/engine) data types:
* classptr, entvars, edict and ehandle.
* @note Pass -1 as value to act as C++ NULL.
*
* @param class Class name
* @param member Member name
* @param value Entity index to set
* @param element Element to set (starting from 0) if member is an array
*
* @noreturn
* @error If member is empty, no offset is found or an invalid offset
* is retrieved, or the data type does not match, an error will
* be thrown.
*/
native set_gamerules_entity(const class[], const member[], value, element = 0);
/**
* Retrieves a string from the gamerules object based off a class and member name.
*
* @note This native is used to access the following (C++/engine) data types:
* string, stringptr.
*
* @param class Class name
* @param member Member name
* @param value Buffer to store data in
* @param maxlen Maximum size of the buffer
* @param element Element to retrieve (starting from 0) if member is an array
*
* @return Number of cells written to buffer
* @error If member is empty, no offset is found or an invalid offset
* is retrieved, or the data type does not match, an error will
* be thrown.
*/
native get_gamerules_string(const class[], const member[], value[], maxlen, element = 0);
/**
* Sets a string to the gamerules object based off a class and member name.
*
* @note This native is used to access the following (C++/engine) data types:
* string, stringptr.
*
* @param class Class name
* @param member Member name
* @param value String to set
* @param element Element to set (starting from 0) if member is an array
*
* @return Number of cells written to buffer
* @error If member is empty, no offset is found or an invalid offset
* is retrieved, or the data type does not match, an error will
* be thrown.
*/
native set_gamerules_string(const class[], const member[], const value[], element = 0);
/**
* Retrieves the size of array of a class member.
*