Raised This Month: $ Target: $400
 0% 

Can it be bugged?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
andre778
New Member
Join Date: May 2016
Old 05-28-2016 , 20:05   Can it be bugged?
Reply With Quote #1

Hi, I'm using timer on my map, but sometimes players can spawn with god and they can''t die, I found code about gmod in 1 file:
PHP Code:
d#include <sourcemod>
#include <sdkhooks>
#include <smlib>
#include <timer>
#include <timer-mapzones>
#include <timer-physics>
#include <timer-config_loader.sp>

new Handle:g_hFF;

new 
bool:g_bHeadshot[MAXPLAYERS+1];

public 
Plugin:myinfo =
{
    
name        "[Timer] MapZones - Damage Controller",
    
author      "Zipcore, Credits: Alongub",
    
description "[Timer] Damage controller with pvp zones",
    
version     PL_VERSION,
    
url         "forums.alliedmods.net/showthread.php?p=2074699"
};

public 
APLRes:AskPluginLoad2(Handle:myselfbool:lateString:error[], err_max)
{
    
RegPluginLibrary("timer-mapzones_damage_controller");
    
    return 
APLRes_Success;
}

public 
OnPluginStart()
{
    
LoadTimerSettings();
    
LoadPhysics();
    
    
g_hFF FindConVar("mp_friendlyfire");
    
    
HookEvent("player_death"Event_Player_DeathEventHookMode_Pre);
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
OnMapStart()
{
    
LoadTimerSettings();
    
LoadPhysics();    
}

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageHook_OnTakeDamage);
    
SDKHook(clientSDKHook_TraceAttackHook_OnTraceAttack);
}


public 
Action:Hook_OnTraceAttack(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotypehitboxhitgroup)
{
    if(
victim && victim <= MaxClients)
        
g_bHeadshot[victim] = (hitgroup == 1) ? true false;
    
    return 
Plugin_Continue;
}

public 
Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    
g_bHeadshot[client] = false;
}

public 
Action:Event_Player_Death(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    new 
attacker GetClientOfUserId(GetEventInt(event"attacker"));
    
    if(!
attacker || attacker == client)
        return 
Plugin_Changed;

    if (
g_bHeadshot[client])
    {
        
decl String:weapon[64];
        
GetEventString(event"weapon"weaponsizeof(weapon));
        
        new 
Handle:new_event CreateEvent("player_death");
        if (
new_event == INVALID_HANDLE)
        {
            return 
Plugin_Continue;
        }
        
        
SetEventInt(new_event"userid"GetClientUserId(client));
        
SetEventInt(new_event"attacker"GetClientUserId(attacker));
        
SetEventString(new_event"weapon"weapon);
        
SetEventBool(new_event"headshot"true);
        
g_bHeadshot[client] = false;
        
FireEvent(new_event);
        return 
Plugin_Changed;
    }

    return 
Plugin_Continue;


public 
Action:Hook_OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    new 
style_victim Timer_GetStyle(victim);
    
    
//World damage
    
if (attacker == || attacker >= MaxClients)
    {
        new 
style Timer_GetStyle(victim);
        
        
//Allow world damage
        
if(g_Physics[style][StyleAllowWorldDamage])
            return 
Plugin_Continue;
        
        
//Remove punsish angle and prevent damage
        
RemovePunchAngle(victim);
        return 
Plugin_Handled;
    }
    
    
//Player vs. player damage
    
if(Client_IsValid(attackertrue) && IsClientInGame(attacker) && IsPlayerAlive(attacker))
    {
        new 
style_attacker Timer_GetStyle(attacker);
        
        
//Allow damage for PvP styles
        
if(g_Physics[style_victim][StylePvP] && g_Physics[style_attacker][StylePvP])
            return 
Plugin_Continue;
        
        
//Allow damage inside PvP zones
        
if(Timer_IsPlayerTouchingZoneType(victimZtArena) && Timer_IsPlayerTouchingZoneType(attackerZtArena))
            return 
Plugin_Continue;
    }
    
    
//Godmode
    
if (g_Settings[Godmode])
    {
        
//Remove punsish angle and prevent damage
        
RemovePunchAngle(victim);
        return 
Plugin_Handled;
    }
    
    
//Friendly fire
    
if(GetClientTeam(victim) == GetClientTeam(attacker))
    {
        if(
GetConVarBool(g_hFF))
            return 
Plugin_Continue;
        
        
//Remove punsish angle and prevent damage
        
RemovePunchAngle(victim);
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;
}

stock RemovePunchAngle(client)
{
    if(
GetGameMod() == MOD_CSS)
    {
        
SetEntPropVector(clientProp_Send"m_vecPunchAngle"NULL_VECTOR);
        
SetEntPropVector(clientProp_Send"m_vecPunchAngleVel"NULL_VECTOR);
    }

Is it wrong or it's not this?
andre778 is offline
sdz
Senior Member
Join Date: Feb 2012
Old 05-29-2016 , 10:51   Re: Can it be bugged?
Reply With Quote #2

PHP Code:
//Godmode
    
if (g_Settings[Godmode])
    {
        
//Remove punsish angle and prevent damage
        
RemovePunchAngle(victim);
        return 
Plugin_Handled;
    } 
sdz is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode