From f9d0a96d7777750817b685eadabda7c2cb0148ef Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 1 Apr 2009 19:04:00 +0200 Subject: [PATCH] Corrected newline format. --- src/zr/damagecontrol.inc | 374 +++++++++++++++++++-------------------- src/zr/playerclasses.inc | 32 ++-- 2 files changed, 203 insertions(+), 203 deletions(-) diff --git a/src/zr/damagecontrol.inc b/src/zr/damagecontrol.inc index 3e5ea82..cfeee3d 100755 --- a/src/zr/damagecontrol.inc +++ b/src/zr/damagecontrol.inc @@ -1,188 +1,188 @@ -/** - * ==================== - * Zombie:Reloaded - * File: damagecontrol.inc - * Author: Greyscale - * ==================== - */ - -#define DMG_GENERIC 0 // generic damage was done -#define DMG_BULLET (1 << 1) // shot -#define DMG_SLASH (1 << 2) // cut, clawed, stabbed -#define DMG_BURN (1 << 3) // heat burned -#define DMG_FALL (1 << 5) // fell too far -#define DMG_BLAST (1 << 6) // explosive blast damage -#define DMG_DROWN (1 << 14) // Drowning - -enum ZRHooks -{ - Hook_TraceAttack, - Hook_OnTakeDamage -} - -new gHooks[MAXPLAYERS+1][ZRHooks]; - -InitDmgControl() -{ - /* It's case sensitive! */ - RegConsoleCmd("kill", Attempt_Suicide); - RegConsoleCmd("KILL", Attempt_Suicide); - RegConsoleCmd("jointeam", Attempt_Suicide); - RegConsoleCmd("JOINTEAM", Attempt_Suicide); - RegConsoleCmd("spectate", Attempt_Suicide); -} - -ClientHookAttack(client) -{ - gHooks[client][Hook_TraceAttack] = Hacks_Hook(client, HACKS_HTYPE_TRACEATTACK, TraceAttack, false); - gHooks[client][Hook_OnTakeDamage] = Hacks_Hook(client, HACKS_HTYPE_ONTAKEDAMAGE, OnTakeDamage, false); -} - -ClientUnHookAttack(client) -{ - Hacks_Unhook(gHooks[client][Hook_TraceAttack]); - Hacks_Unhook(gHooks[client][Hook_OnTakeDamage]); -} - -public TraceAttack(client, inflictor, attacker, damage, hitbox, hitgroup) -{ - new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); - - if (!attacker || !IsClientPlayer(attacker) || !IsClientInGame(attacker) || !enabled) - { - return Hacks_Continue; - } - - if (IsPlayerZombie(client) && IsPlayerZombie(attacker)) - { - return 0; - } - - if (IsPlayerHuman(client) && IsPlayerHuman(attacker)) - { - return 0; - } - - return Hacks_Continue; -} - -public OnTakeDamage(client, inflictor, attacker, damage, damagetype, ammotype) -{ - new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); - if (!enabled) - { - return Hacks_Continue; - } - - decl String:classname[64]; - GetEdictClassname(inflictor, classname, sizeof(classname)); - if (StrContains(classname, "trigger") > -1) - { - return Hacks_Continue; - } - - if (damagetype & DMG_FALL) - { - if (!IsPlayerZombie(client)) - { - return Hacks_Continue; - } - - new bool:blockfalldamage = GetClassNoFallDamage(pClass[client]); - if (!blockfalldamage) - { - return Hacks_Continue; - } - - return 0; - } - - if (damagetype & DMG_BLAST) - { - if (!IsPlayerHuman(client) || !IsClientPlayer(attacker) || !IsClientInGame(attacker)) - { - return Hacks_Continue; - } - - return 0; - } - - if (damagetype & DMG_BULLET) - { - if (!client || !IsClientPlayer(client) || !IsClientInGame(client)) - { - return Hacks_Continue; - } - - if (!attacker || !IsClientPlayer(attacker) || !IsClientInGame(attacker)) - { - return Hacks_Continue; - } - - if (IsPlayerZombie(client) && IsPlayerHuman(attacker)) - { - return Hacks_Continue; - } - - if (IsPlayerHuman(client) && IsPlayerZombie(attacker)) - { - new health = GetClientHealth(client); - SetEntityHealth(client, health + damage); - - return Hacks_Continue; - } - - return 0; - } - - return Hacks_Continue; -} - -public Action:Attempt_Suicide(client, argc) -{ - if (!client) - { - return Plugin_Continue; - } - - new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); - if (!enabled) - { - return Plugin_Continue; - } - - - - new bool:suicide = IsPlayerZombie(client) ? GetConVarBool(gCvars[CVAR_SUICIDE_ZOMBIE]) : GetConVarBool(gCvars[CVAR_SUICIDE_HUMAN]); - if (!suicide) - { - return Plugin_Continue; - } - - decl String:cmd[16]; - GetCmdArg(0, cmd, sizeof(cmd)); - - if (!IsPlayerAlive(client)) - { - return Plugin_Continue; - } - - ZR_ReplyToCommand(client, "Suicide text"); - ZR_PrintToChat(client, "Suicide text"); - - decl String:clientname[64]; - decl String:buffer[192]; - - GetClientName(client, clientname, sizeof(clientname)); - if (LogFlagCheck(LOG_GAME_EVENTS, LOG_MODULE_DAMAGECONTROL)) - { - ZR_LogMessageFormatted(client, "damage control", "suicide", "Player \"%s\" attempted suicide.", true, clientname); - } - if (GetConVarBool(gCvars[CVAR_SUICIDE_ECHO])) - { - Format(buffer, sizeof(buffer), "Player '%s' attempted suicide.", clientname); - ZR_PrintToAdminChat(buffer); - } - - return Plugin_Handled; +/** + * ==================== + * Zombie:Reloaded + * File: damagecontrol.inc + * Author: Greyscale + * ==================== + */ + +#define DMG_GENERIC 0 // generic damage was done +#define DMG_BULLET (1 << 1) // shot +#define DMG_SLASH (1 << 2) // cut, clawed, stabbed +#define DMG_BURN (1 << 3) // heat burned +#define DMG_FALL (1 << 5) // fell too far +#define DMG_BLAST (1 << 6) // explosive blast damage +#define DMG_DROWN (1 << 14) // Drowning + +enum ZRHooks +{ + Hook_TraceAttack, + Hook_OnTakeDamage +} + +new gHooks[MAXPLAYERS+1][ZRHooks]; + +InitDmgControl() +{ + /* It's case sensitive! */ + RegConsoleCmd("kill", Attempt_Suicide); + RegConsoleCmd("KILL", Attempt_Suicide); + RegConsoleCmd("jointeam", Attempt_Suicide); + RegConsoleCmd("JOINTEAM", Attempt_Suicide); + RegConsoleCmd("spectate", Attempt_Suicide); +} + +ClientHookAttack(client) +{ + gHooks[client][Hook_TraceAttack] = Hacks_Hook(client, HACKS_HTYPE_TRACEATTACK, TraceAttack, false); + gHooks[client][Hook_OnTakeDamage] = Hacks_Hook(client, HACKS_HTYPE_ONTAKEDAMAGE, OnTakeDamage, false); +} + +ClientUnHookAttack(client) +{ + Hacks_Unhook(gHooks[client][Hook_TraceAttack]); + Hacks_Unhook(gHooks[client][Hook_OnTakeDamage]); +} + +public TraceAttack(client, inflictor, attacker, damage, hitbox, hitgroup) +{ + new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); + + if (!attacker || !IsClientPlayer(attacker) || !IsClientInGame(attacker) || !enabled) + { + return Hacks_Continue; + } + + if (IsPlayerZombie(client) && IsPlayerZombie(attacker)) + { + return 0; + } + + if (IsPlayerHuman(client) && IsPlayerHuman(attacker)) + { + return 0; + } + + return Hacks_Continue; +} + +public OnTakeDamage(client, inflictor, attacker, damage, damagetype, ammotype) +{ + new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); + if (!enabled) + { + return Hacks_Continue; + } + + decl String:classname[64]; + GetEdictClassname(inflictor, classname, sizeof(classname)); + if (StrContains(classname, "trigger") > -1) + { + return Hacks_Continue; + } + + if (damagetype & DMG_FALL) + { + if (!IsPlayerZombie(client)) + { + return Hacks_Continue; + } + + new bool:blockfalldamage = GetClassNoFallDamage(pClass[client]); + if (!blockfalldamage) + { + return Hacks_Continue; + } + + return 0; + } + + if (damagetype & DMG_BLAST) + { + if (!IsPlayerHuman(client) || !IsClientPlayer(attacker) || !IsClientInGame(attacker)) + { + return Hacks_Continue; + } + + return 0; + } + + if (damagetype & DMG_BULLET) + { + if (!client || !IsClientPlayer(client) || !IsClientInGame(client)) + { + return Hacks_Continue; + } + + if (!attacker || !IsClientPlayer(attacker) || !IsClientInGame(attacker)) + { + return Hacks_Continue; + } + + if (IsPlayerZombie(client) && IsPlayerHuman(attacker)) + { + return Hacks_Continue; + } + + if (IsPlayerHuman(client) && IsPlayerZombie(attacker)) + { + new health = GetClientHealth(client); + SetEntityHealth(client, health + damage); + + return Hacks_Continue; + } + + return 0; + } + + return Hacks_Continue; +} + +public Action:Attempt_Suicide(client, argc) +{ + if (!client) + { + return Plugin_Continue; + } + + new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); + if (!enabled) + { + return Plugin_Continue; + } + + + + new bool:suicide = IsPlayerZombie(client) ? GetConVarBool(gCvars[CVAR_SUICIDE_ZOMBIE]) : GetConVarBool(gCvars[CVAR_SUICIDE_HUMAN]); + if (!suicide) + { + return Plugin_Continue; + } + + decl String:cmd[16]; + GetCmdArg(0, cmd, sizeof(cmd)); + + if (!IsPlayerAlive(client)) + { + return Plugin_Continue; + } + + ZR_ReplyToCommand(client, "Suicide text"); + ZR_PrintToChat(client, "Suicide text"); + + decl String:clientname[64]; + decl String:buffer[192]; + + GetClientName(client, clientname, sizeof(clientname)); + if (LogFlagCheck(LOG_GAME_EVENTS, LOG_MODULE_DAMAGECONTROL)) + { + ZR_LogMessageFormatted(client, "damage control", "suicide", "Player \"%s\" attempted suicide.", true, clientname); + } + if (GetConVarBool(gCvars[CVAR_SUICIDE_ECHO])) + { + Format(buffer, sizeof(buffer), "Player '%s' attempted suicide.", clientname); + ZR_PrintToAdminChat(buffer); + } + + return Plugin_Handled; } \ No newline at end of file diff --git a/src/zr/playerclasses.inc b/src/zr/playerclasses.inc index 4d3afd7..c307e83 100755 --- a/src/zr/playerclasses.inc +++ b/src/zr/playerclasses.inc @@ -1015,7 +1015,7 @@ ClassGetOverlayPath(index, String:overlay[], maxlen, cachetype = ZR_CLASS_CACHE_ * Gets the health points from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1047,7 +1047,7 @@ ClassGetHealth(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the running speed value from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1079,7 +1079,7 @@ Float:ClassGetSpeed(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the jump distance boost from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1111,7 +1111,7 @@ Float:ClassGetJumpDistance(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the jump height boost from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1143,7 +1143,7 @@ Float:ClassGetJumpHeight(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the knock back boost from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1175,7 +1175,7 @@ Float:ClassGetKnockback(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the night vision setting from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1207,7 +1207,7 @@ bool:ClassGetNVGs(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the field of view value from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1239,7 +1239,7 @@ ClassGetFOV(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the health regen interval value from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1272,7 +1272,7 @@ Float:ClassGetHealthRegenInterv(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the health regen amount value from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1305,7 +1305,7 @@ ClassGetHealthRegenAmount(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the napalm grenades time from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1337,7 +1337,7 @@ Float:ClassGetNapalmTime(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the no fall damage setting from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1370,7 +1370,7 @@ bool:ClassGetNoFallDamage(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the kill bonus value from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1402,7 +1402,7 @@ ClassGetKillBonus(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the health infect bonus value from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1435,7 +1435,7 @@ ClassGetHealthInfectBonus(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the initial alpha value from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1467,7 +1467,7 @@ ClassGetAlphaInitial(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the alpha value when damaged, from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data. @@ -1500,7 +1500,7 @@ ClassGetAlphaDamaged(index, cachetype = ZR_CLASS_CACHE_PLAYER) * Gets the damage amount needed to change alpha, from the specified class. * * @param index Index of the class in a class cache or a client index, - * depending on the cache type specified. + * depending on the cache type specified. * @param cachetype Optional. Specifies what class cache to read from. Options: * ZR_CLASS_CACHE_ORIGINAL - Unchanced class data. * ZR_CLASS_CACHE_MODIFIED - Changed/newest class data.