From 55a78858357cb4879c14b131aba6385d2b12f41a Mon Sep 17 00:00:00 2001 From: zaCade Date: Sun, 29 Sep 2019 10:37:23 +0200 Subject: [PATCH] Few more for organization :D --- src/zr/antistick.inc | 22 +++++++++--------- src/zr/cookies.inc | 44 +++++++++++++++++------------------ src/zr/overlays.inc | 24 +++++++++---------- src/zr/tools_functions.inc | 4 ++-- src/zr/weapons/weaponammo.inc | 40 +++++++++++++++---------------- 5 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/zr/antistick.inc b/src/zr/antistick.inc index c960fc2..ea6a519 100644 --- a/src/zr/antistick.inc +++ b/src/zr/antistick.inc @@ -414,17 +414,6 @@ stock bool:AntiStickIsModelBoxColliding(client1, client2) return true; } -/** - * Sets the collision group on a client. - * - * @param client The client index. - * @param collisiongroup Collision group flag. - */ -AntiStickSetCollisionGroup(client, collisiongroup) -{ - SetEntProp(client, Prop_Data, "m_CollisionGroup", collisiongroup); -} - /** * Gets the collision group on a client. * @@ -436,6 +425,17 @@ AntiStickGetCollisionGroup(client) return GetEntProp(client, Prop_Data, "m_CollisionGroup"); } +/** + * Sets the collision group on a client. + * + * @param client The client index. + * @param collisiongroup Collision group flag. + */ +AntiStickSetCollisionGroup(client, collisiongroup) +{ + SetEntProp(client, Prop_Data, "m_CollisionGroup", collisiongroup); +} + /** * Converts a collision group value into a name. * diff --git a/src/zr/cookies.inc b/src/zr/cookies.inc index 79e575e..cd31089 100644 --- a/src/zr/cookies.inc +++ b/src/zr/cookies.inc @@ -36,6 +36,22 @@ CookiesInit() ZHPOnCookiesCreate(); } +/** + * Returns a cookie value as a bool. + * + * @param client The client index. + * @param cookie The handle to the cookie. + */ +bool:CookiesGetClientCookieBool(client, Handle:cookie) +{ + // Get cookie string. + decl String:cookievalue[8]; + GetClientCookie(client, cookie, cookievalue, sizeof(cookievalue)); + + // Return string casted into an int, then to bool. + return bool:StringToInt(cookievalue); +} + /** * Accepts a bools for setting client cookies. * @@ -54,19 +70,18 @@ CookiesSetClientCookieBool(client, Handle:cookie, bool:cookievalue) } /** - * Returns a cookie value as a bool. + * Gets a integer value from a cookie. * * @param client The client index. * @param cookie The handle to the cookie. */ -bool:CookiesGetClientCookieBool(client, Handle:cookie) +CookiesGetInt(client, Handle:cookie) { - // Get cookie string. - decl String:cookievalue[8]; - GetClientCookie(client, cookie, cookievalue, sizeof(cookievalue)); + decl String:strValue[16]; + strValue[0] = 0; + GetClientCookie(client, cookie, strValue, sizeof(strValue)); - // Return string casted into an int, then to bool. - return bool:StringToInt(cookievalue); + return StringToInt(strValue); } /** @@ -85,18 +100,3 @@ CookiesSetInt(client, Handle:cookie, value) // Set string value. SetClientCookie(client, cookie, strValue); } - -/** - * Gets a integer value from a cookie. - * - * @param client The client index. - * @param cookie The handle to the cookie. - */ -CookiesGetInt(client, Handle:cookie) -{ - decl String:strValue[16]; - strValue[0] = 0; - GetClientCookie(client, cookie, strValue, sizeof(strValue)); - - return StringToInt(strValue); -} diff --git a/src/zr/overlays.inc b/src/zr/overlays.inc index 426cf7f..fe29cb1 100644 --- a/src/zr/overlays.inc +++ b/src/zr/overlays.inc @@ -228,6 +228,18 @@ OverlaysChannel:OverlaysClientFindChannel(client) return OVERLAYS_CHANNEL_NONE; } +/** + * Get current value of a channel state of a client. + * + * @param client The client index. + * @param channel The channel to get state of. + */ +bool:OverlaysClientGetChannelState(client, OverlaysChannel:channel) +{ + // Return current value. + return g_bOverlayChannel[client][channel]; +} + /** * Toggle or set new value to a channel state of a client. * @@ -259,18 +271,6 @@ bool:OverlaysClientSetChannelState(client, OverlaysChannel:channel, bool:update return g_bOverlayChannel[client][channel]; } -/** - * Get current value of a channel state of a client. - * - * @param client The client index. - * @param channel The channel to get state of. - */ -bool:OverlaysClientGetChannelState(client, OverlaysChannel:channel) -{ - // Return current value. - return g_bOverlayChannel[client][channel]; -} - /** * Set overlay path for a channel. * diff --git a/src/zr/tools_functions.inc b/src/zr/tools_functions.inc index 2ce63f7..b91dd85 100644 --- a/src/zr/tools_functions.inc +++ b/src/zr/tools_functions.inc @@ -71,10 +71,10 @@ stock ToolsGetClientVelocity(client, Float:vecVelocity[3]) } /** - * Gets client's velocity. + * Sets client's velocity. * * @param client The client index. - * @param vecVelocity Array to store vector in. + * @param vecVelocity Velocity to set on client. */ stock ToolsSetClientVelocity(client, const Float:vecVelocity[3]) { diff --git a/src/zr/weapons/weaponammo.inc b/src/zr/weapons/weaponammo.inc index cbf23c4..5368cf6 100644 --- a/src/zr/weapons/weaponammo.inc +++ b/src/zr/weapons/weaponammo.inc @@ -116,6 +116,21 @@ WeaponAmmoOnOffsetsFound() } } +/** + * Get clip/reserve ammo on a weapon. + * + * @param weapon The weapon index. + * @param clip True gets clip ammo, false gets reserve. + */ +stock WeaponAmmoGetAmmo(weapon, bool:clip) +{ + // Set variable to offset we are changing. + new ammooffset = clip ? g_iToolsClip1 : g_iToolsClip2; + + // Return ammo offset value. + return GetEntData(weapon, ammooffset); +} + /** * Set clip/reserve ammo on a weapon. * @@ -143,18 +158,14 @@ stock WeaponAmmoSetAmmo(weapon, bool:clip, value, bool:add = false) } /** - * Get clip/reserve ammo on a weapon. + * Get the count of any grenade-type a client has. * - * @param weapon The weapon index. - * @param clip True gets clip ammo, false gets reserve. + * @param client The client index. + * @param slot The type of */ -stock WeaponAmmoGetAmmo(weapon, bool:clip) +stock WeaponAmmoGetGrenadeCount(client, WeaponAmmoGrenadeType:type) { - // Set variable to offset we are changing. - new ammooffset = clip ? g_iToolsClip1 : g_iToolsClip2; - - // Return ammo offset value. - return GetEntData(weapon, ammooffset); + return GetEntData(client, g_iToolsAmmo + (_:type * 4)); } /** @@ -179,17 +190,6 @@ stock WeaponAmmoSetGrenadeCount(client, WeaponAmmoGrenadeType:type, value, bool: SetEntData(client, g_iToolsAmmo + (_:type * 4), ammovalue + value, _, true); } -/** - * Get the count of any grenade-type a client has. - * - * @param client The client index. - * @param slot The type of - */ -stock WeaponAmmoGetGrenadeCount(client, WeaponAmmoGrenadeType:type) -{ - return GetEntData(client, g_iToolsAmmo + (_:type * 4)); -} - /** * Takes a weapon entity and returns an entry in enum WeaponAmmoGrenadeType. *