From 0edae8772e7086e5649e916e2edc9fb747861044 Mon Sep 17 00:00:00 2001 From: jargon-au Date: Wed, 15 Oct 2014 09:22:26 +1100 Subject: [PATCH 1/2] Add new class natives Adding ZR_GetHumanClass & ZR_GetZombieClass natives to expose external plugins to more than just the clients current active class. --- src/zr/api/class.api.inc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/zr/api/class.api.inc b/src/zr/api/class.api.inc index e9bf022..dd69def 100644 --- a/src/zr/api/class.api.inc +++ b/src/zr/api/class.api.inc @@ -35,6 +35,8 @@ APIClassInit() // Natives CreateNative("ZR_IsValidClassIndex", APIIsValidClassIndex); CreateNative("ZR_GetActiveClass", APIGetActiveClass); + CreateNative("ZR_GetHumanClass", APIGetHumanClass); + CreateNative("ZR_GetZombieClass", APIGetZombieClass); CreateNative("ZR_SelectClientClass", APISelectClientClass); CreateNative("ZR_GetClassByName", APIGetClassByName); CreateNative("ZR_GetClassDisplayName", APIGetClassDisplayName); @@ -67,6 +69,36 @@ public APIGetActiveClass(Handle:plugin, numParams) return ClassGetActiveIndex(client); } +/** + * Native call function (ZR_GetHumanClass) + * + * native bool:ZR_GetHumanClass(client); + */ +public APIGetHumanClass(Handle:plugin, numParams) +{ + new client = GetNativeCell(1); + + // Validate the client index. Player must be alive. + APIValidateClientIndex(client, Condition_True); + + return ClassGetHumanIndex(client); +} + +/** + * Native call function (ZR_GetZombieClass) + * + * native bool:ZR_GetZombieClass(client); + */ +public APIGetZombieClass(Handle:plugin, numParams) +{ + new client = GetNativeCell(1); + + // Validate the client index. Player must be alive. + APIValidateClientIndex(client, Condition_True); + + return ClassGetZombieIndex(client); +} + /** * Native call function (ZR_SelectClientClass) * From 7a842771c897700d9fad4eb74ce7a8605c62476c Mon Sep 17 00:00:00 2001 From: jargon-au Date: Wed, 15 Oct 2014 09:25:07 +1100 Subject: [PATCH 2/2] Add new class natives Adding ZR_GetHumanClass and ZR_GetZombieClass natives to expose external plugins to more than just the clients active class. --- src/include/zr/class.zr.inc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/include/zr/class.zr.inc b/src/include/zr/class.zr.inc index 3612fd4..ad6edcf 100644 --- a/src/include/zr/class.zr.inc +++ b/src/include/zr/class.zr.inc @@ -63,6 +63,24 @@ native bool:ZR_IsValidClassIndex(classIndex); */ native bool:ZR_GetActiveClass(client); +/** + * Gets the current human class index that the player is using. + * + * @param client The client index. + * + * @return The human class index. + */ +native bool:ZR_GetHumanClass(client); + +/** + * Gets the current zombie class index that the player is using. + * + * @param client The client index. + * + * @return The zombie class index. + */ +native bool:ZR_GetZombieClass(client); + /** * Selects a class for a player. *